rosenberg_funcs: warn about information leaks to the network
[smatch.git] / validation / sizeof-function.c
blob8ff67f2149981de7a9c13c912b0525df3ec207a2
1 extern int fun(void);
2 extern int (*ptr)(void);
4 static inline int inl(int *a)
6 return *a + 1;
10 int test(void);
11 int test(void)
13 unsigned int s = 0;
15 // OK
16 s += sizeof &fun;
17 s += sizeof ptr;
18 s += sizeof &ptr;
19 s += sizeof &inl;
21 // KO
22 s += sizeof fun;
23 s += sizeof *fun;
25 s += sizeof *ptr;
27 s += sizeof inl;
28 s += sizeof *inl;
30 s += sizeof __builtin_trap;
31 s += sizeof *__builtin_trap;
33 return s;
37 * check-name: sizeof-function
38 * check-command: sparse -Wpointer-arith -Wno-decl $file
40 * check-error-start
41 sizeof-function.c:22:14: warning: expression using sizeof on a function
42 sizeof-function.c:23:14: warning: expression using sizeof on a function
43 sizeof-function.c:25:14: warning: expression using sizeof on a function
44 sizeof-function.c:27:14: warning: expression using sizeof on a function
45 sizeof-function.c:28:14: warning: expression using sizeof on a function
46 sizeof-function.c:30:14: warning: expression using sizeof on a function
47 sizeof-function.c:31:14: warning: expression using sizeof on a function
48 * check-error-end