xref: /illumos-gate/usr/src/tools/smatch/src/validation/sm_buf_size7.c (revision f52943a93040563107b95bccb9db87d9971ef47d)
1 #include "check_debug.h"
2 
3 int test(void)
4 {
5 	int a[] = { [1] = 2 };
6 	int b[] = { 1, 2, 3 };
7 	int c[] = { 0, [0] = 1, 2, 3};
8 	int d[] = { 0, [3] = 4, 5};
9 
10 	__smatch_buf_size(a);
11 	__smatch_buf_size(b);
12 	__smatch_buf_size(c);
13 	__smatch_buf_size(d);
14 }
15 
16 /*
17  * check-name: smatch buf size #7
18  * check-command: smatch -I.. sm_buf_size7.c
19  *
20  * check-output-start
21 sm_buf_size7.c:10 test() buf size: 'a' 2 elements, 8 bytes
22 sm_buf_size7.c:11 test() buf size: 'b' 3 elements, 12 bytes
23 sm_buf_size7.c:12 test() buf size: 'c' 3 elements, 12 bytes
24 sm_buf_size7.c:13 test() buf size: 'd' 5 elements, 20 bytes
25  * check-output-end
26  */
27