File: builtin-args-checking.c

package info (click to toggle)
sparse 0.6.4-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,868 kB
  • sloc: ansic: 46,050; sh: 614; python: 301; perl: 293; makefile: 279
file content (45 lines) | stat: -rw-r--r-- 1,805 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
static unsigned int bad_nbr_args_cte(int a)
{
	int r = 0;
	r |= __builtin_bswap16();
	r |= __builtin_bswap16(1, 2);
	r |= __builtin_bswap32();
	r |= __builtin_bswap32(1, 2);
	r |= __builtin_bswap64();
	r |= __builtin_bswap64(1, 2);
	return r;
}

static unsigned int bad_nbr_args_var(int a, int b)
{
	int r = 0;
	r |= __builtin_bswap16();
	r |= __builtin_bswap16(a, b);
	r |= __builtin_bswap32();
	r |= __builtin_bswap32(a, b);
	r |= __builtin_bswap64();
	r |= __builtin_bswap64(a, b);
	return r;
}

/*
 * check-name: builtin-args-checking
 * check-command: sparse $file
 * check-description: Check that the arguments checking is done
 *                    for expanded builtins with a prototype.
 *
 * check-error-start
builtin-args-checking.c:4:31: error: not enough arguments for function __builtin_bswap16
builtin-args-checking.c:5:31: error: too many arguments for function __builtin_bswap16
builtin-args-checking.c:6:31: error: not enough arguments for function __builtin_bswap32
builtin-args-checking.c:7:31: error: too many arguments for function __builtin_bswap32
builtin-args-checking.c:8:31: error: not enough arguments for function __builtin_bswap64
builtin-args-checking.c:9:31: error: too many arguments for function __builtin_bswap64
builtin-args-checking.c:16:31: error: not enough arguments for function __builtin_bswap16
builtin-args-checking.c:17:31: error: too many arguments for function __builtin_bswap16
builtin-args-checking.c:18:31: error: not enough arguments for function __builtin_bswap32
builtin-args-checking.c:19:31: error: too many arguments for function __builtin_bswap32
builtin-args-checking.c:20:31: error: not enough arguments for function __builtin_bswap64
builtin-args-checking.c:21:31: error: too many arguments for function __builtin_bswap64
 * check-error-end
 */