Commit Graph

366 Commits

Author SHA1 Message Date
Jeremiah Orians 0ab7cb78eb
Adjusted cc_macro.c formatting with astyle -A1tSxejz2fpUxV 2021-01-05 22:22:33 -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
Sanne Wouda fa0f135ebb Fix typo 2021-01-03 13:16:55 +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 6a3d3e78e0
expand the known issues list 2020-12-24 14:41:14 -05:00
Jeremiah Orians 44e14bb662
Make known issues public 2020-12-24 12:12:52 -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 608fba306f Fix x86 close syscall and test 0104
The close syscall was missing an indirection and therefore closed random
file descriptors (very visible in strace output).

Test 0104 did not properly null terminate the envp, resulting in -EFAULT
on execve syscall in case the next value in memory does not happen to be
0 (which it seems to be right now).
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
Jeremiah Orians d9504e3872
Allow M2-Planet to support larger outputs without hitting a segfault 2020-12-19 06:50:11 -05:00
Sanne Wouda 968fdfea65 AArch64 support for unsigned comparison 2020-12-17 00:01:17 +00:00
Jeremiah Orians e5befc4fee
armv7l support for unsigned comparisons 2020-12-15 21:09:26 -05:00
Jeremiah Orians f2cae3d501
AMD64 support for unsigned comparisons 2020-12-15 20:28:04 -05:00
Jeremiah Orians eaf3861954
Fix failing tests on x86 2020-12-15 19:02:32 -05:00
Jeremiah Orians 132e685f97
Fix x86 behavior on unsigned compares 2020-12-15 17:46:45 -05:00
Jeremiah Orians 9da48c5ece
match gcc behavior in regards to if(-1 > 0) 2020-12-15 07:24:07 -05:00
Jeremiah Orians 5c22aac02d
Change knight-posix HEAP behavior and leverage better relational choices for knight-posix 2020-12-15 06:02:38 -05:00
Jeremiah 196c66d19e
Merge pull request #7 from snnw/aarch64-fix
[AArch64] Use arithmetic right shift for signed
2020-12-05 10:09:50 -05:00
Sanne Wouda a63b8837c0 [AArch64] Use arithmetic right shift for signed
- as discussed with deesix, this is the proper fix
- the test1000 checksum changes as it uses the M2-Planet source as input
2020-12-05 14:59:16 +00:00
Jeremiah d34ea502cc
Merge pull request #6 from snnw/aarch64-fix
[AArch64] Fix LSEEK syscall number
2020-12-04 21:29:02 -05:00
Sanne Wouda 58b563435b [AArch64] Use arithmetic right shift
- fixes a test failure if hex2 was compiled with M2-Planet
2020-12-04 19:37:29 +00:00
Sanne Wouda 624a5ac92d [AArch64] Fix LSEEK syscall number 2020-12-04 15:45:06 +00:00
Jeremiah Orians 0615223052
Broke tests into processor specific sets and updated the M1 test 2020-12-01 22:24:36 -05:00
Jeremiah Orians 93e8b0c0a4
Removed obsolete reference to bootstrap directory 2020-11-20 05:34:11 -05:00
Jeremiah Orians e3ca15c731
Preparing for next release 2020-11-15 20:46:26 -05:00
Jeremiah Orians a5bc08b23f
Release 1.7.0 2020-11-15 20:43:58 -05:00
Jeremiah Orians 1975d88581
Fix GCC 10 compatibility issue 2020-11-15 20:28:33 -05:00
Jeremiah Orians 67dbbbdcfc
Enable support for C multi-strings 2020-11-15 18:58:25 -05:00
Jeremiah Orians 57264eb157
Catch potential segfaulting behavior in generated binaries 2020-11-08 21:13:12 -05:00
Jeremiah Orians 39915de931
harmonize integer behavior when reading strings 2020-10-17 13:50:25 -04:00
Jeremiah Orians c4a636c99d
Fix shift behavior to better match C standard 2020-10-16 22:07:06 -04:00
Jeremiah Orians e9da9c802e
make cc_* compatible 2020-10-16 19:29:38 -04:00
nimaje 52114585bf
fix malloc to accept FreeBSD's behavior and fix failing binaries 2020-10-16 17:26:39 -04:00
nimaje 028bdaf951
Update ELF headers and sha256 function to better support FreeBSD 2020-10-16 12:00:42 -04:00
Jeremiah Orians 87672ddfdb
Release 1.6.0 2020-04-30 22:35:22 -04:00