This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: two one-line fixes for cpphash.c
- To: Zack Weinberg <zack at wolery dot cumb dot org>
- Subject: Re: two one-line fixes for cpphash.c
- From: Alexandre Oliva <oliva at lsd dot ic dot unicamp dot br>
- Date: 14 Mar 2000 23:10:18 -0300
- Cc: gcc-patches at gcc dot gnu dot org
- References: <20000309094853.H8792@wolery.cumb.org>
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