Home | History | Annotate | Line # | Download | only in lint1
msg_352.c revision 1.1
      1 /*	$NetBSD: msg_352.c,v 1.1 2023/03/28 20:04:52 rillig Exp $	*/
      2 # 3 "msg_352.c"
      3 
      4 // Test for message 352: 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 int
     14 function(void)
     15 {
     16 	/* expect+1: warning: nested 'extern' declaration of 'external_func' [352] */
     17 	extern int external_func(void);
     18 	/* expect+1: warning: nested 'extern' declaration of 'external_var' [352] */
     19 	extern int external_var;
     20 
     21 	return external_func() + external_var;
     22 }
     23