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]

Re: two one-line fixes for cpphash.c


On Mar  9, 2000, Zack Weinberg <zack@wolery.cumb.org> wrote:

> +	      && !strncmp (tok, "__VA_ARGS__", sizeof "__VA_ARGS__" - 1))

This is wrong.  It also warns if the parameter name is
`__VA_ARGS__foobar'.  Here's a patch.  Ok to install?

Index: gcc/ChangeLog
from  Alexandre Oliva  <oliva@lsd.ic.unicamp.br>
	
	* cpphash.c (collect_formal_parameters): Do not complain about
	parameter names that just start with `__VA_ARGS__'.
	
Index: gcc/cpphash.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cpphash.c,v
retrieving revision 1.56
diff -u -r1.56 cpphash.c
--- gcc/cpphash.c	2000/03/14 06:10:27	1.56
+++ gcc/cpphash.c	2000/03/15 02:07:38
@@ -599,7 +599,8 @@
 	      continue;
 	    }
 	  if (CPP_PEDANTIC (pfile) && CPP_OPTIONS (pfile)->c99
-	      && !strncmp (tok, "__VA_ARGS__", sizeof "__VA_ARGS__" - 1))
+	      && len == sizeof "__VA_ARGS__" - 1
+	      && !strncmp (tok, "__VA_ARGS__", len))
 	    cpp_pedwarn (pfile,
 	"C99 does not permit use of `__VA_ARGS__' as a macro argument name");
 	  namebuf = (U_CHAR *) xrealloc (namebuf, argslen + len + 1);

-- 
Alexandre Oliva     http://www.ic.unicamp.br/~oliva/     Enjoy Guaranį
Cygnus Solutions, a Red Hat company        aoliva@{redhat, cygnus}.com
Free Software Developer and Evangelist    CS PhD student at IC-Unicamp
oliva@{lsd.ic.unicamp.br, gnu.org}   Write to mailing lists, not to me

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