This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PR C/12466 -Wold-style-definition incorrectly warns withellipsises


http://gcc.gnu.org/PR12466 for details.

Essentially void foo(const char * format, ...) {}
warns using -Wold-style-definition.

OK to install?

Kelley Cook
2003-09-30  Kelley Cook  <kelleycook@wideopenwest.com>

gcc:
	PR C/12466
	* c-parse.in (parmlist_2): Mark declaration with an ellipsis as ISO C.

gcc/testsuite:
	* gcc.dg/Wold-style-definition-1.c: Add in 3 ellipsis testcases.

--- c-parse.in.orig	2003-09-30 13:25:07.675507500 -0400
+++ c-parse.in	2003-09-30 13:23:28.121363000 -0400
@@ -2561,13 +2561,16 @@ parmlist_2:  /* empty */
 		     tries to verify that BUILT_IN_NEXT_ARG is being used
 		     correctly.  */
 		  error ("ISO C requires a named argument before `...'");
+		  parsing_iso_function_signature = true;
 		}
 	| parms
 		{ $$ = get_parm_info (1);
 		  parsing_iso_function_signature = true;
 		}
 	| parms ',' ELLIPSIS
-		{ $$ = get_parm_info (0); }
+		{ $$ = get_parm_info (0);
+		  parsing_iso_function_signature = true;
+		}
 	;
 
 parms:
--- testsuite/gcc.dg/Wold-style-definition-1.c.orig	2003-09-30 13:27:01.550387000 -0400
+++ testsuite/gcc.dg/Wold-style-definition-1.c	2003-09-30 13:30:06.948825500 -0400
@@ -22,3 +22,10 @@ void bar4 (a) {} /* { dg-warning "old-st
 void bar5 (int a) {}
 
 void bar6 (void) {}
+
+void bar7 ( ... ) {} /* { dg-error "ISO C requires a named argument" } */
+
+void bar8 (int a, ... ) {}
+
+void bar9 (a, ... ) {} /* { dg-warning "old-style parameter declaration" } */
+

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]