• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 struct f {
2 	int i;
3 	long f[];
4 };
5 
6 struct s {
7 	struct f f;
8 };
9 
10 union u {
11 	struct f f;
12 };
13 
14 // trigger the examination of the offending types
foo(struct s * s,union u * u)15 static int foo(struct s *s, union u *u)
16 {
17 	return    __builtin_offsetof(typeof(*s), f)
18 		+ __builtin_offsetof(typeof(*u), f);
19 }
20 
21 /*
22  * check-name: flex-array-nested
23  * check-command: sparse -Wflexible-array-nested $file
24  *
25  * check-error-start
26 flex-array-nested.c:7:18: warning: nested flexible array
27 flex-array-nested.c:11:18: warning: nested flexible array
28  * check-error-end
29  */
30