summaryrefslogtreecommitdiff
path: root/gcc/cppmacro.c
diff options
context:
space:
mode:
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2002-06-10 06:03:13 +0000
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2002-06-10 06:03:13 +0000
commit3396dc8065ec59cb307362fa820c58cb5cde9bff (patch)
treeadbb48f5611c4e938179b3f12970a0c7bef07ce1 /gcc/cppmacro.c
parent08cb25b34934ce594d9f56eb9c56ef96ad6fedb4 (diff)
downloadgcc-3396dc8065ec59cb307362fa820c58cb5cde9bff.tar.gz
* cpphash.h (struct cpp_macro): Put comments on their own lines.
(_cpp_expansions_different_trad): New. * cppmacro.c (warn_of_redefinition): Fix for traditional case. * cpptrad.c (canonicalize_text): New. (scan_out_logical_line): Handle no arguments correctly. (save_replacement_text): Commit memory when finished. (_cpp_expansions_different_trad): New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@54432 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cppmacro.c')
-rw-r--r--gcc/cppmacro.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/gcc/cppmacro.c b/gcc/cppmacro.c
index d5179487637..a9ca6cf2dbf 100644
--- a/gcc/cppmacro.c
+++ b/gcc/cppmacro.c
@@ -1176,9 +1176,9 @@ warn_of_redefinition (pfile, node, macro2)
definitions are the same. (6.10.3 paragraph 2). */
macro1 = node->value.macro;
- /* The quick failures. */
- if (macro1->count != macro2->count
- || macro1->paramc != macro2->paramc
+ /* Don't check count here as it can be different in valid
+ traditional redefinitions with just whitespace differences. */
+ if (macro1->paramc != macro2->paramc
|| macro1->fun_like != macro2->fun_like
|| macro1->variadic != macro2->variadic)
return true;
@@ -1190,11 +1190,12 @@ warn_of_redefinition (pfile, node, macro2)
/* Check the replacement text or tokens. */
if (CPP_OPTION (pfile, traditional))
- return memcmp (macro1->exp.text, macro2->exp.text, macro1->count);
+ return _cpp_expansions_different_trad (macro1, macro2);
- for (i = 0; i < macro1->count; i++)
- if (!_cpp_equiv_tokens (&macro1->exp.tokens[i], &macro2->exp.tokens[i]))
- return true;
+ if (macro1->count == macro2->count)
+ for (i = 0; i < macro1->count; i++)
+ if (!_cpp_equiv_tokens (&macro1->exp.tokens[i], &macro2->exp.tokens[i]))
+ return true;
return false;
}