xref: /illumos-gate/usr/src/tools/smatch/src/validation/Waddress-array.c (revision 4e5ef1cee66fbfbbd2b3e56b81e2bb5700f4a59e)
1 int foo(void) {
2 	extern int a[];
3 
4 	if (a)
5 		return 1;
6 	return 0;
7 }
8 
9 int bar(void) {
10 	int a[2];
11 
12 	if (a)
13 		return 1;
14 	return 0;
15 }
16 
17 /*
18  * check-name: Waddress-array
19  * check-command: sparse -Wno-decl -Waddress $file
20  *
21  * check-error-start
22 Waddress-array.c:4:13: warning: the address of an array will always evaluate as true
23 Waddress-array.c:12:13: warning: the address of an array will always evaluate as true
24  * check-error-end
25  */
26