Home | History | Annotate | Line # | Download | only in lint1
      1 /*	$NetBSD: decl_struct_c90.c,v 1.4 2022/02/27 11:40:30 rillig Exp $	*/
      2 # 3 "decl_struct_c90.c"
      3 
      4 /*
      5  * Test declaration of struct types, in C90 without any GNU extensions.
      6  */
      7 
      8 /* lint1-flags: -sw */
      9 
     10 struct unnamed_member {
     11 	enum { A, B, C } tag;
     12 	union {
     13 		int a_value;
     14 		void *b_value;
     15 		void (*c_value)(void);
     16 	};
     17 	/* expect-1: warning: anonymous struct/union members is a C11 feature [49] */
     18 };
     19 
     20 /*
     21  * All of K&R, C90, C99 require that a struct member declaration is
     22  * terminated with a semicolon.
     23  *
     24  * Before cgram.y 1.328 from 2021-07-15, lint allowed the missing semicolon
     25  * in non-C90 mode, no idea why.
     26  */
     27 struct missing_semicolon {
     28 	int member
     29 };
     30 /* expect-1: error: syntax error '}' [249] */
     31 /* expect+1: error: cannot recover from previous errors [224] */
     32