aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Viro <viro@parcelfarce.linux.theplanet.co.uk>2004-06-06 18:38:22 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:02:02 -0700
commit625b39274679530fc4756bffe1649448a8a54222 (patch)
tree45f7f06c079e062c5712753a99f15dcdc6347e42 /token.h
parentIntroduce a "incomplete type" rather than leaving (diff)
downloadsparse-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.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/token.h b/token.h
index cc9ff9a..d7a894b 100644
--- a/token.h
+++ b/token.h
@@ -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;
};
};