It seems the code was similarly wrong before I introduced the flag
CALLED_NOLIST in f07c9045f5bf60ccd821a33bb4ebf06d06fe7c48.
No change in regression tests as we don't have macro libraries available
to test.
several compilers:
- gcc version 4.5.3 (NetBSD nb2 20110806)
- gcc version 4.9.2 (Ubuntu 4.9.2-10ubuntu13)
- Ubuntu clang version 3.6.0-2ubuntu1 (tags/RELEASE_360/final) (based on LLVM 3.6.0)
The warnings were mostly about local variables shadowing others,
unused function parameters, and C++ style comments. Some variables were
indeed used before set.
Note that on Linux, using -std=c99 does stupid things like *remove* the
declaration of strdup() from <string.h>. Therefore I've reluctantly used
-std=gnu99.
They behave observably different from generic string parsing and trying
to account for them generically just gets in the way.
.rept is treated the same as a macro.
The original intent of the code, when faced with something like
.MACRO A
.MACRO B
.ENDM A
is to terminate the outer macro definition immediately.
However some macros redefine themselves, and that broke.
For now, detect self-redefinition and disable the early
end if there is one.
Since this does not match what's described on page 7-3,
this will change if it doesn't break my test cases.
Also, to make Kermit sources work, only increase the local symbol block
counter if there actually was a local symbol used in the block.
This way, conditional inclusions (which include source text only in the
first pass) will have less potential for de-synchronisation between the
passes. After all, if the generated internal local symbol names do
not match, phase errors will result (showing themselves as strange label
redefinition problems).