]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
cpphash.c (collect_formal_parameters): strncmp returns 0 for match.
authorZack Weinberg <zack@wolery.cumb.org>
Thu, 9 Mar 2000 17:49:26 +0000 (17:49 +0000)
committerZack Weinberg <zack@gcc.gnu.org>
Thu, 9 Mar 2000 17:49:26 +0000 (17:49 +0000)
* cpphash.c (collect_formal_parameters): strncmp returns 0 for
match.  (cpp_compare_defs): Count the nul separator when
advancing over argument names.

From-SVN: r32448

gcc/ChangeLog
gcc/cpphash.c
gcc/testsuite/gcc.dg/cpp-redef-2.c

index 824e4d4baa659581d0c4b4c5f67af67e7de50266..a362174c9e0b1e20d90b7a281592e6086eb6f9b2 100644 (file)
@@ -1,3 +1,9 @@
+2000-03-09  Zack Weinberg  <zack@wolery.cumb.org>
+
+       * cpphash.c (collect_formal_parameters): strncmp returns 0 for
+       match.  (cpp_compare_defs): Count the nul separator when
+       advancing over argument names.
+
 2000-03-09  Bernd Schmidt  <bernds@cygnus.co.uk>
 
        * recog.c (preprocess_constraints): Matching constraints affect
index fc4051b8d4c914e91109ba5c483bbc5ad8f303c1..51c5de01c99803f8604a7599523281f99614218a 100644 (file)
@@ -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 8d34ddfa05d5e450c5ab65f3f254585d572b35bf..d57f26acf413fdb1eb81b915bcce92299ee58c6e 100644 (file)
@@ -1,7 +1,7 @@
 /* Test for redefining macros with significant differences.  */
 
 /* { dg-do preprocess }
-   { dg-options "-pedantic -Wall" } */
+   { dg-options "-ansi -pedantic -Wall" } */
 
 #define mac(a, b) (a) + (b)
 #define mac(a, b) (a) * (b)