mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-01-18 16:25:05 +08:00
Set __PASS__ to 3 for preprocess only
When running the preprocessor only, set __PASS__ to 3. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
2c8ad285fd
commit
61f130f4e9
@ -3674,9 +3674,8 @@ For example, if the \c{altreg} package is included (see
|
||||
|
||||
The macro \c{__PASS__} is defined to be \c{1} on preparatory passes,
|
||||
and \c{2} on the final pass. In preprocess-only mode, it is set to
|
||||
\c{2} (there being only the final pass); when running only to generate
|
||||
dependencies (due to the \c{-M} or \c{-MG} option, see \k{opt-M}) it
|
||||
is set to \c{0}.
|
||||
\c{3}, and when running only to generate dependencies (due to the
|
||||
\c{-M} or \c{-MG} option, see \k{opt-M}) it is set to \c{0}.
|
||||
|
||||
\e{Avoid using this macro if at all possible. It is tremendously easy
|
||||
to generate very strange errors by misusing it, and the semantics may
|
||||
|
2
nasm.c
2
nasm.c
@ -382,7 +382,7 @@ int main(int argc, char **argv)
|
||||
location.known = false;
|
||||
|
||||
/* pass = 1; */
|
||||
preproc->reset(inname, 2, report_error, evaluate, &nasmlist,
|
||||
preproc->reset(inname, 3, report_error, evaluate, &nasmlist,
|
||||
depend_ptr);
|
||||
|
||||
while ((line = preproc->getline())) {
|
||||
|
19
preproc.c
19
preproc.c
@ -4249,7 +4249,14 @@ pp_reset(char *file, int apass, efunc errfunc, evalfunc eval,
|
||||
do_predef = true;
|
||||
list = listgen;
|
||||
evaluate = eval;
|
||||
pass = apass;
|
||||
|
||||
/*
|
||||
* 0 for dependencies, 1 for preparatory passes, 2 for final pass.
|
||||
* The caller, however, will also pass in 3 for preprocess-only so
|
||||
* we can set __PASS__ accordingly.
|
||||
*/
|
||||
pass = apass > 2 ? 2 : apass;
|
||||
|
||||
dephead = deptail = deplist;
|
||||
if (deplist) {
|
||||
StrList *sl = nasm_malloc(strlen(file)+1+sizeof sl->next);
|
||||
@ -4259,12 +4266,14 @@ pp_reset(char *file, int apass, efunc errfunc, evalfunc eval,
|
||||
deptail = &sl->next;
|
||||
}
|
||||
|
||||
/* Define the __PASS__ macro. This is defined here unlike
|
||||
all the other builtins, because it is special -- it varies between
|
||||
passes. */
|
||||
/*
|
||||
* 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);
|
||||
make_tok_num(t, apass);
|
||||
t->a.mac = NULL;
|
||||
define_smacro(NULL, "__PASS__", true, 0, t);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user