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>
This commit is contained in:
H. Peter Anvin 2008-09-24 10:20:40 -07:00
parent 917a3496f0
commit 7383b407d9

View File

@ -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)