Home | History | Annotate | Line # | Download | only in lint1
      1 /*	$NetBSD: msg_352.c,v 1.3 2024/03/01 17:22:55 rillig Exp $	*/
      2 # 3 "msg_352.c"
      3 
      4 // Test for message: nested 'extern' declaration of '%s' [352]
      5 
      6 /*
      7  * C allows to declare external functions or objects inside function bodies,
      8  * which invites inconsistent types.
      9  *
     10  * Instead, any external functions or objects should be declared in headers.
     11  */
     12 
     13 /* lint1-extra-flags: -X 351 */
     14 
     15 int
     16 function(void)
     17 {
     18 	/* expect+1: warning: nested 'extern' declaration of 'external_func' [352] */
     19 	extern int external_func(void);
     20 	/* expect+1: warning: nested 'extern' declaration of 'external_var' [352] */
     21 	extern int external_var;
     22 
     23 	return external_func() + external_var;
     24 }
     25