This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
two one-line fixes for cpphash.c
- To: gcc-patches at gcc dot gnu dot org
- Subject: two one-line fixes for cpphash.c
- From: Zack Weinberg <zack at wolery dot cumb dot org>
- Date: Thu, 9 Mar 2000 09:48:54 -0800
This patch fixes a couple of one-line bugs which show up running the
test suite.
dejagnu has a bug which causes a spurious failure in cpp-redef-2.c.
If it bothers you, apply this patch to /usr/share/dejagnu/dg.exp:
--- dg.exp.old Thu Mar 9 09:45:46 2000
+++ dg.exp Thu Mar 9 09:46:07 2000
@@ -718,7 +718,7 @@
set pattern [lindex $i 2]
set comment [lindex $i 3]
#send_user "Before:\n$comp_output\n"
- if [regsub -all "(^|\n)(\[^\n\]+$line\[^\n\]*($pattern)\[^\n\]*\n?)+" $comp_output "\n" comp_output] {
+ if [regsub -all "(^|\n)(\[^\n:\]+$line\[^\n\]*($pattern)\[^\n\]*\n?)+" $comp_output "\n" comp_output] {
set comp_output [string trimleft $comp_output]
set ok pass
set uhoh fail
zw
* cpphash.c (collect_formal_parameters): strncmp returns 0 for
match. (cpp_compare_defs): Count the nul separator when
advancing over argument names.
===================================================================
Index: cpphash.c
--- cpphash.c 2000/03/08 20:37:23 1.50
+++ cpphash.c 2000/03/09 17:47:21
@@ -588,7 +588,7 @@ collect_formal_parameters (pfile)
continue;
}
if (CPP_PEDANTIC (pfile) && CPP_OPTIONS (pfile)->c99
- && strncmp (tok, "__VA_ARGS__", sizeof "__VA_ARGS__" - 1))
+ && !strncmp (tok, "__VA_ARGS__", sizeof "__VA_ARGS__" - 1))
cpp_pedwarn (pfile,
"C99 does not permit use of `__VA_ARGS__' as a macro argument name");
namebuf = xrealloc (namebuf, argslen + len + 1);
@@ -1495,7 +1495,7 @@ _cpp_compare_defs (pfile, d1, d2)
int i = d1->nargs;
while (i--)
{
- len = strlen (arg1);
+ len = strlen (arg1) + 1;
if (strcmp (arg1, arg2))
return 1;
arg1 += len;