diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-09-24 10:20:40 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-09-24 10:20:40 -0700 |
commit | 7383b407d9dac305ff150431df40f03051f6d6c9 (patch) | |
tree | 69cfc73ee6fb266625cd6b6f3dd0c8108126f0bb | |
parent | 917a3496f062ce35547816b560ba5a1b2c563574 (diff) | |
download | nasm-7383b407d9dac305ff150431df40f03051f6d6c9.tar.gz |
Add __PASS__ builtin macro
Add a new builtin macro, __PASS__, which is either 1 (for a
preparatory pass), 2 (for a final pass, including preprocessor only),
or 0 (for dependency generation.) This might be useful in special
contexts.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | preproc.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -4218,6 +4218,8 @@ static void pp_reset(char *file, int apass, efunc errfunc, evalfunc eval, ListGen * listgen, StrList **deplist) { + Token *t; + _error = errfunc; cstk = NULL; istk = nasm_malloc(sizeof(Include)); @@ -4256,6 +4258,15 @@ pp_reset(char *file, int apass, efunc errfunc, evalfunc eval, *deptail = sl; deptail = &sl->next; } + + /* Define the __PASS__ macro. This is defined here unlike + all the other builtins, because it is special -- it varies between + passes. */ + t = nasm_malloc(sizeof(*t)); + t->next = NULL; + make_tok_num(t, pass); + t->a.mac = NULL; + define_smacro(NULL, "__PASS__", true, 0, t); } static char *pp_getline(void) |