From: Zack Weinberg Date: Thu, 9 Mar 2000 17:49:26 +0000 (+0000) Subject: cpphash.c (collect_formal_parameters): strncmp returns 0 for match. X-Git-Tag: prereleases/libstdc++-2.92~7773 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8051b17802cf05b70177ae9a370940ba677f1add;p=thirdparty%2Fgcc.git cpphash.c (collect_formal_parameters): strncmp returns 0 for match. * 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 824e4d4baa65..a362174c9e0b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2000-03-09 Zack Weinberg + + * 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 * recog.c (preprocess_constraints): Matching constraints affect diff --git a/gcc/cpphash.c b/gcc/cpphash.c index fc4051b8d4c9..51c5de01c998 100644 --- a/gcc/cpphash.c +++ b/gcc/cpphash.c @@ -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; diff --git a/gcc/testsuite/gcc.dg/cpp-redef-2.c b/gcc/testsuite/gcc.dg/cpp-redef-2.c index 8d34ddfa05d5..d57f26acf413 100644 --- a/gcc/testsuite/gcc.dg/cpp-redef-2.c +++ b/gcc/testsuite/gcc.dg/cpp-redef-2.c @@ -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)