diff options
| author | Linus Torvalds <torvalds@home.transmeta.com> | 2003-03-24 00:48:59 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 20:59:40 -0700 |
| commit | c2d021e2f3554ea48728f6a3e0422167df4609c7 (patch) | |
| tree | ec30d2aeaf0ff36e1bf54c1ed0ce54e82874b1af | |
| parent | 5d61a948bbbd85d5db88dd757d928f3c47b96f00 (diff) | |
| download | sparse-dev-c2d021e2f3554ea48728f6a3e0422167df4609c7.tar.gz | |
Don't expand arguments that are preceded by '#' or preceded or followed
by '##' (ANSI C - Appending A �12.3)
| -rw-r--r-- | pre-process.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/pre-process.c b/pre-process.c index 3b7cfb47..5130c4a6 100644 --- a/pre-process.c +++ b/pre-process.c @@ -161,7 +161,7 @@ static void insert(struct token *token, struct token *prev) prev->next = token; } -static void replace(struct token *token, struct token *prev, struct token *list) +static struct token * replace(struct token *token, struct token *prev, struct token *list) { int newline = token->newline; @@ -173,6 +173,7 @@ static void replace(struct token *token, struct token *prev, struct token *list) prev = newtok; list = list->next; } + return prev; } static struct token *get_argument(int nr, struct token *args) @@ -224,6 +225,7 @@ static struct token *expand_one_arg(struct token *head, struct token *token, struct token *arglist, struct token *arguments) { int nr = arg_number(arglist, token->ident); + struct token *orig_head = head; if (nr >= 0) { struct token *arg = get_argument(nr, arguments); @@ -239,8 +241,9 @@ static struct token *expand_one_arg(struct token *head, struct token *token, empty_arg_token.next = &eof_token_entry; } - replace(token, head, arg); - head = expand_list(head); + head = replace(token, head, arg); + if (!match_op(orig_head, SPECIAL_HASHHASH) && !match_op(last, SPECIAL_HASHHASH) && !match_op(orig_head, '#')) + head = expand_list(orig_head); head->next = last; return head; } |
