Home | History | Annotate | Line # | Download | only in lint1
msg_343.c revision 1.1
      1 /*	$NetBSD: msg_343.c,v 1.1 2021/04/14 18:27:11 rillig Exp $	*/
      2 # 3 "msg_343.c"
      3 
      4 /* Test for message: static array size is a C99 extension [343] */
      5 
      6 /* lint1-flags: -sw */
      7 
      8 void takes_int_pointer(int []);
      9 void takes_int_pointer_with_ignored_size(int [3]);
     10 void takes_int_array(int[static 3]);	/* expect: 343 */
     11 /* expect+1: syntax error 'volatile' */
     12 void takes_volatile_int_array(int[volatile 3]);
     13 
     14 int
     15 returns_int_pointer(int a[])
     16 {
     17 	return a[0];
     18 }
     19 
     20 int
     21 returns_int_pointer_with_ignored_size(int a[3])
     22 {
     23 	return a[0];
     24 }
     25 
     26 int
     27 returns_int_array(int a[static 3])	/* expect: 343 */
     28 {
     29 	return a[0];
     30 }
     31 
     32 int
     33 /* expect+1: syntax error 'volatile' */
     34 returns_volatile_int_array(int a[volatile 3])
     35 {
     36 	/* expect+2: cannot dereference non-pointer type */
     37 	/* expect+1: expects to return value */
     38 	return a[0];
     39 }
     40