Commit Graph

177 Commits

Author SHA1 Message Date
Jeremiah Orians 32ef09f964
Update M2libc and update known_issues.org 2021-02-06 13:40:28 -05:00
Jeremiah Orians fc4c1998aa
Remove test/common_knight/ files and switch knight-posix to M2libc 2021-02-06 00:45:32 -05:00
Jeremiah Orians a9d88e8e6c
Add support for -D variable and -D variable=value 2021-02-05 21:34:00 -05:00
Jeremiah Orians 8007ae9ce6
Add support for #if defined(__M2__) to enable M2-Planet specific functionality 2021-02-05 20:39:54 -05:00
Jeremiah Orians 62eedce858
Remove test/common_aarch64 files and switch AArch64 to M2libc 2021-02-05 15:54:38 -05:00
Jeremiah Orians a65619dbf4
Remove test/common_knight/*native files and switch knight-native to M2libc 2021-02-03 19:47:18 -05:00
Jeremiah Orians ba1fc44f29
Remove test/common_armv7l files and switch armv7l to M2libc 2021-02-03 07:30:15 -05:00
Jeremiah Orians 695672985e
Remove test/common_amd64 files and switch amd64 to M2libc 2021-02-03 00:32:47 -05:00
Jeremiah Orians 6f8e2eb905
Removed need for fixup 2021-02-02 23:39:27 -05:00
Jeremiah Orians c5068b227a
Add support for &global_variable 2021-01-28 22:22:08 -05:00
Jeremiah Orians f2094a9e5b
Migrate knight-posix to M2libc 2021-01-22 00:35:43 -05:00
Jeremiah Orians 3c6b23f734
Update M2libc to remove duplicate opens 2021-01-21 22:41:23 -05:00
deesix 818784228c Use M2libc in all x86 tests < test1000 2021-01-21 00:00:00 +01:00
deesix e660caca73 Use M2libc in all armv7l tests < test1000 2021-01-21 00:00:00 +01:00
deesix 7860378b75 Use M2libc in all amd64 tests < test1000 2021-01-21 00:00:00 +01:00
deesix 55db771e29 tests: get proof from test0025 stderr (and other minor fixes)
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.
2021-01-17 00:00:00 +01:00
deesix bcd0f49859 Use M2libc in all AArch64 tests < test1000
Finally test0021, now that M2libc has getcwd.

See b83086642e
2021-01-15 00:00:00 +01:00
Jeremiah Orians 4def464475
Merge remote-tracking branch 'yt/array' 2021-01-10 20:07:38 -05:00
Jeremiah Orians 768f229c1d
Updated M2libc 2021-01-10 18:29:28 -05:00
Sanne Wouda 0e3d5b609a Add support for global char foo[12]; definitions
- only enabled in --bootstrap-mode

- allocates space for both the char array and the pointer to the start of
  the array
2021-01-10 23:01:08 +00:00
Sanne Wouda b83086642e Use M2libc in nearly all AArch64 tests
- 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
2021-01-10 22:02:29 +00:00
Sanne Wouda dd1f5db9f1 Port AArch64 test0008 to M2libc 2021-01-10 17:50:04 +00:00
Sanne Wouda c4d329b6cc Fixup libc-core -> libc-full
Causes a segfault due to uninitialised pointer in the FILE struct
2021-01-10 17:00:12 +00:00
Sanne Wouda 45685d0c30 Update first few tests to use M2libc 2021-01-10 16:47:13 +00:00
Sanne Wouda 09acd6253d Implement simple macro expansion
- 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.
2021-01-09 17:39:48 +00:00
Sanne Wouda a8551f2fcd Implement --bootstrap-mode for preprocessor
- // 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
2021-01-09 17:38:50 +00:00
Sanne Wouda 6f2cebc4ca Add a test for supported preprocessor features 2021-01-08 21:32:03 +00:00
Sanne Wouda 4550eec19e Extend macro #define support
- now supports #if defined(FOO)
- translation of #define FOO 1 to CONSTANT FOO 1 is still supported
2021-01-08 21:31:43 +00:00
Jeremiah Orians 3c4c09b95e
Added hacky version of #define support 2021-01-06 19:24:16 -05:00
Jeremiah Orians 25fd5e66c9
Another set of segfaults cleared out 2021-01-05 23:22:26 -05:00
Jeremiah Orians bdd4e65580
Catch some basic segfaults 2021-01-05 23:00:58 -05:00
Sanne Wouda 63bb59404d Improve error reporting for unexpected non-newline 2021-01-05 22:56:30 +00:00
Sanne Wouda 49fbe8942f Add error checking for unexpected #endif 2021-01-05 22:56:30 +00:00
Sanne Wouda 89c6513cd8 Add support for conditional inclusion
- 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
2021-01-05 22:54:30 +00:00
Sanne Wouda cd96f65a23 Add macro directives to token_list
- 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)
2021-01-05 22:53:39 +00:00
Sanne Wouda 7b8a99db3c Add a preprocessor-only mode
- Very useful for testing and debugging
- Add preprocess() stub and skip compilation in preprocessor mode
2021-01-05 22:53:04 +00:00
Sanne Wouda a18e0c1782 Add newline tokens to parse stream
- 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
2021-01-05 22:23:15 +00:00
Jeremiah Orians 921cc86ce6
First generation implemention of typedef 2021-01-02 22:00:02 -05:00
Jeremiah Orians 358b6cfb96
Fix modulus behavior that is wrong.
Thank you janneke
2021-01-01 16:39:27 -05:00
Jeremiah Orians e451abd667
Fix e25c1995aa SCM MES regression 2021-01-01 15:55:34 -05:00
Jeremiah Orians cc1a17a040
Revert "file.c: introduce output buffering for x86"
This reverts commit 5afeb0743e.
2021-01-01 15:28:30 -05:00
Jeremiah Orians 07baf02efe
Looks like I got x86/AMD64 signed and unsigned division backwards.
Thanks for finding that janneke
2021-01-01 10:52:23 -05:00
Jeremiah Orians c220d14928
Catching some segfaults 2020-12-31 09:53:05 -05:00
Jeremiah Orians e25c1995aa
Make types more proper 2020-12-27 21:51:46 -05:00
Jeremiah Orians 0ed81de9e1
Merge remote-tracking branch 'mihi/io-buffering-x86' 2020-12-22 22:19:44 -05:00
Jeremiah Orians 4de11b1bc6
Update checksums to reflect new fclose 2020-12-21 22:26:22 -05:00
Michael Schierl 5afeb0743e file.c: introduce output buffering for x86
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.
2020-12-21 16:57:17 +01:00
Michael Schierl 91bab2ef98 Close files that were fopen:ed 2020-12-21 16:57:17 +01:00
Jeremiah Orians 6fe6f44a29
Make type information localized to the inside of statements 2020-12-19 16:35:33 -05:00
Jeremiah Orians e7a0ecd244
Cleared out non-essential string primitives and added support for --max-string 2020-12-19 09:46:22 -05:00