From b4d3c9a094be86df0085fdf3dceae86dd7c23ede Mon Sep 17 00:00:00 2001 From: Olaf Seibert Date: Fri, 8 May 2015 23:19:13 +0200 Subject: [PATCH] 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. --- assemble.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assemble.c b/assemble.c index 9d2e3ce..6920d90 100644 --- a/assemble.c +++ b/assemble.c @@ -244,7 +244,7 @@ static int assemble( /* Try to resolve macro */ op = lookup_sym(label, ¯o_st); - if (op && op->stmtno < stmtno) { + if (op /*&& op->stmtno < stmtno*/) { STREAM *macstr; free(label);