db/fixup_kernel.sh: commit all my stuff
[smatch.git] / validation / builtin-args-checking.c
blob55f34d2bccc5fe536e75132ac3ae5214a3584aae
1 static unsigned int bad_nbr_args_cte(int a)
3 int r = 0;
4 r |= __builtin_bswap16();
5 r |= __builtin_bswap16(1, 2);
6 r |= __builtin_bswap32();
7 r |= __builtin_bswap32(1, 2);
8 r |= __builtin_bswap64();
9 r |= __builtin_bswap64(1, 2);
10 return r;
13 static unsigned int bad_nbr_args_var(int a, int b)
15 int r = 0;
16 r |= __builtin_bswap16();
17 r |= __builtin_bswap16(a, b);
18 r |= __builtin_bswap32();
19 r |= __builtin_bswap32(a, b);
20 r |= __builtin_bswap64();
21 r |= __builtin_bswap64(a, b);
22 return r;
26 * check-name: builtin-args-checking
27 * check-command: sparse $file
28 * check-description: Check that the arguments checking is done
29 * for expanded builtins with a prototype.
31 * check-error-start
32 builtin-args-checking.c:4:31: error: not enough arguments for function __builtin_bswap16
33 builtin-args-checking.c:5:31: error: too many arguments for function __builtin_bswap16
34 builtin-args-checking.c:6:31: error: not enough arguments for function __builtin_bswap32
35 builtin-args-checking.c:7:31: error: too many arguments for function __builtin_bswap32
36 builtin-args-checking.c:8:31: error: not enough arguments for function __builtin_bswap64
37 builtin-args-checking.c:9:31: error: too many arguments for function __builtin_bswap64
38 builtin-args-checking.c:16:31: error: not enough arguments for function __builtin_bswap16
39 builtin-args-checking.c:17:31: error: too many arguments for function __builtin_bswap16
40 builtin-args-checking.c:18:31: error: not enough arguments for function __builtin_bswap32
41 builtin-args-checking.c:19:31: error: too many arguments for function __builtin_bswap32
42 builtin-args-checking.c:20:31: error: not enough arguments for function __builtin_bswap64
43 builtin-args-checking.c:21:31: error: too many arguments for function __builtin_bswap64
44 * check-error-end