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