We were checking an empty proof because the test writes to stderr and we
were redirecting stdout to the file. With the correct redirection the hash
is different, so proof.answer is also adjusted.
The x86 test was calling blood-elf with the 64bits flag. Removed to ask for
32bits behaviour.
For consistency, --BaseAddress is now using the usual value for the arch.
Also, unused input file is removed here.
- disables --bootstrap-mode where it was enabled, except for test1000
which needs to build in bootstrap-mode to check that M2-Planet can be
compiled by cc_*
- the only hold-out is test0021 which needs getcwd which is missing in
M2libc
- note that test0106 needs a fix to fgetc or it will never notice it has
reached the end of stdin
- no longer generate CONSTANT lines for #defined constants
- "#define FOO 1" turns "return FOO;" into "return 1;"
- Macros expanding into a macro is not supported:
#define FOO 1
#define BAR FOO
will expand BAR to FOO, not to 1
- Expansion inside #if conditions is not supported.
- Function-like macros are not supported.
- // and # lines always appear in the result of read_all_tokens
- in bootstrap mode, // tokens (but not the subsequent lines) and #
lines are stripped. no preprocessing happens.
- in non-bootstrap mode, // lines are stripped and # lines stay for the
preprocessing phase
- updates tests to pass --bootstrap-mode when necessary
- support for #if, #elif, #else, #endif, but no macro expansion just
yet. Any macro is treated as undefined and expands to 0.
for example:
./bin/M2-Planet -E test.c
#if 1 == FOO
foo
#else
bar
#endif
results in
bar
- change the lexer to not remove preprocessor directives
- preprocess() removes any lines starting with a macro directive that it
doesn't understand (which is currently all of them)
- needed to determine start and end of macro directives
- the main parser doesn't need them, so strip out the newline tokens
before parsing to avoid changing it
Note that this is a backwards incompatible change: Unlike POSIX, exit()
will not flush all open streams, so you are responsible for flushing or
closing all your streams before successful exit.
Also, file.c will now also require calloc.c (and malloc.c).
Updated the test cases accordingly.
Only implemented and tested for x86.