Fix undefined macros in second pass when conditional inclusion is used...

Given the following conditional inclusion, as seen in RSX Kermit-11
sources:

        .if ndf, K11INC
        .ift
        .include /IN:K11MAC.MAC/
        .include /IN:K11DEF.MAC/
        .endc

macros defined in K11MAC.MAC are unknown when used later on.

The assembler keeps a running count of the line number (stmtno) and
stores it in the macro definition. In the second pass, it tries to avoid
cases of use-before-defined, because it doesn't really forget the
macros.

However, in this case, the second pass has fewer lines, because there
was some conditional inclusion... so when the macro is used in the
second pass, its running line number (including the skipped inclusions)
is lower than the line number where the macro was defined...

The line number check would also interfere when the /PASS:1 and /PASS:2
input file modifiers would be implemented.

It seems to me that in most normal cases, a use-before-defined is
already detected in the first pass, so the check is not really needed.

Therefore I have simply removed it.
This commit is contained in:
Olaf Seibert 2015-05-08 23:19:13 +02:00
parent 184fae4b67
commit b4d3c9a094

View File

@ -244,7 +244,7 @@ static int assemble(
/* Try to resolve macro */
op = lookup_sym(label, &macro_st);
if (op && op->stmtno < stmtno) {
if (op /*&& op->stmtno < stmtno*/) {
STREAM *macstr;
free(label);