diff options
author | 2004-06-06 18:38:22 -0700 | |
---|---|---|
committer | 2005-04-07 21:02:02 -0700 | |
commit | 625b39274679530fc4756bffe1649448a8a54222 (patch) | |
tree | 45f7f06c079e062c5712753a99f15dcdc6347e42 /token.h | |
parent | Introduce a "incomplete type" rather than leaving (diff) | |
download | sparse-625b39274679530fc4756bffe1649448a8a54222.tar.gz sparse-625b39274679530fc4756bffe1649448a8a54222.tar.bz2 sparse-625b39274679530fc4756bffe1649448a8a54222.zip |
[PATCH] cleanup of macro arguments handling
Trivial observation: we don't have to check every bloody identifier in
the body of macro and see if it's a formal argument _every_ _time_ _we_
_do_ _substitution_.
New token type: TOKEN_MACRO_ARGUMENT, with token->argnum as its data.
Occurs only in bodies of macros with arguments.
handle_define() goes through the body, checks which identifier tokens
are arguments (using the same arg_number() we used to do on every
expansion) and turns those into TOKEN_MACRO_ARGUMENT ones.
expand_arguments() simply checks for TOKEN_MACRO_ARGUMENT.
expand_one_argument() doesn't need arglist argument anymore - it gets
argument number from token->argnum.
Diffstat (limited to 'token.h')
-rw-r--r-- | token.h | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -56,6 +56,7 @@ enum token_type { TOKEN_SPECIAL, TOKEN_STREAMBEGIN, TOKEN_STREAMEND, + TOKEN_MACRO_ARGUMENT, }; /* Combination tokens */ @@ -126,6 +127,7 @@ struct token { unsigned int special; struct string *string; int character; + int argnum; }; }; |