From 7383b407d9dac305ff150431df40f03051f6d6c9 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Wed, 24 Sep 2008 10:20:40 -0700 Subject: [PATCH] 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 --- preproc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/preproc.c b/preproc.c index 915b0cbe..ba895a55 100644 --- a/preproc.c +++ b/preproc.c @@ -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) -- 2.11.4.GIT