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]

two one-line fixes for cpphash.c


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;

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