This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] macro redefinition with different token count
- From: DJ Delorie <dj at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 29 May 2003 19:36:05 -0400
- Subject: [patch] macro redefinition with different token count
warn_of_redefinition goes to great lengths to compare tokens for
equality, but doesn't handle the case where there are different
numbers of tokens - it silently allows the redefinition.
2003-05-29 DJ Delorie <dj@redhat.com>
* cppmacro.c (warn_of_redefinition): Handle cases where the two
definitions have different numbers of tokens.
Index: cppmacro.c
===================================================================
RCS file: /usr/dj/gnu/gcc/repository/gcc/gcc/cppmacro.c,v
retrieving revision 1.133
diff -p -2 -r1.133 cppmacro.c
*** cppmacro.c 24 Apr 2003 20:03:57 -0000 1.133
--- cppmacro.c 29 May 2003 23:34:21 -0000
*************** warn_of_redefinition (pfile, node, macro
*** 1276,1283 ****
return _cpp_expansions_different_trad (macro1, macro2);
! if (macro1->count == macro2->count)
! for (i = 0; i < macro1->count; i++)
! if (!_cpp_equiv_tokens (¯o1->exp.tokens[i], ¯o2->exp.tokens[i]))
! return true;
return false;
--- 1276,1285 ----
return _cpp_expansions_different_trad (macro1, macro2);
! if (macro1->count != macro2->count)
! return true;
!
! for (i = 0; i < macro1->count; i++)
! if (!_cpp_equiv_tokens (¯o1->exp.tokens[i], ¯o2->exp.tokens[i]))
! return true;
return false;