diff options
| author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-06-06 18:49:04 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 21:02:03 -0700 |
| commit | 87c310de375e6ae1b3a1740ffa353355cbd363ac (patch) | |
| tree | 4a74cd4e5fd067c758710e011d32e658d6b2990d /pre-process.c | |
| parent | 625b39274679530fc4756bffe1649448a8a54222 (diff) | |
| download | sparse-dev-87c310de375e6ae1b3a1740ffa353355cbd363ac.tar.gz | |
Fix equality testing for macro re-definition.
We just move the arglist re-write up to before
the equality test, so that we have rewritten
the expansion in both the new and the old version.
Otherwise we'd get spurious differences due to
the rewriting and thus incorrect warnings.
Diffstat (limited to 'pre-process.c')
| -rw-r--r-- | pre-process.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/pre-process.c b/pre-process.c index 30378fac..79093387 100644 --- a/pre-process.c +++ b/pre-process.c @@ -646,19 +646,6 @@ static int handle_define(struct stream *stream, struct token *head, struct token arglist = arglist->next; } - sym = lookup_symbol(name, NS_PREPROCESSOR); - if (sym) { - if (token_list_different(sym->expansion, expansion) || - token_list_different(sym->arglist, arglist)) { - warn(left->pos, "preprocessor token %.*s redefined", - name->len, name->name); - info(sym->pos, "this was the original definition"); - } - return 1; - } - sym = alloc_symbol(left->pos, SYM_NODE); - bind_symbol(sym, name, NS_PREPROCESSOR); - if (arglist) { struct token *p; for (p = expansion; !eof_token(p); p = p->next) { @@ -672,6 +659,19 @@ static int handle_define(struct stream *stream, struct token *head, struct token } } + sym = lookup_symbol(name, NS_PREPROCESSOR); + if (sym) { + if (token_list_different(sym->expansion, expansion) || + token_list_different(sym->arglist, arglist)) { + warn(left->pos, "preprocessor token %.*s redefined", + name->len, name->name); + info(sym->pos, "this was the original definition"); + } + return 1; + } + sym = alloc_symbol(left->pos, SYM_NODE); + bind_symbol(sym, name, NS_PREPROCESSOR); + sym->expansion = expansion; sym->arglist = arglist; return 1; |
