Commit graph

7234 commits

Author SHA1 Message Date
George Koehler ba2a03705e Use prototypes in mach/proto/as/comm5.c
Order the function prototypes in comm1.h to match the order of the
function definitions in *.c files.
2017-01-17 16:41:29 -05:00
George Koehler 916d270534 Delay inclusion of <stdint.h> when compiling comm2.y
See issue #1 (https://github.com/davidgiven/ack/issues/1).  The file
mach/proto/as/comm2.y goes through cpp twice.  The _include macro,
defined in comm2.y and used in comm0.h, delays the inclusion of system
header files.  The inclusion of <stdint.h> wasn't delayed.  This
caused multiple inclusions of <sys/_types.h> in FreeBSD and
<machine/_types.h> in OpenBSD.

Use _include to delay <stdint.h>.  Also use _include for "arch.h" and
"out.h", because h/out.h includes <stdint.h> and h/arch.h might
include it in the future.

Sort the system includes in comm0.h by moving them up to be with
<stdint.h>.  Must include <stdint.h> before "mach0.c", because
mach/powerpc/as/mach0.c needs it.  Must include "mach0.c" before
checking ASLD.
2017-01-16 22:39:44 -05:00
George Koehler e97116c037 Remove some obsolete code that causes a gcc warning.
In my OpenBSD/amd64 system, the code becomes

    if (0)
        outname.on_valu &= ~(((0xFFFFFFFF)<<32)<<32);

The 0xFFFFFFFF is a 32-bit int, so the left shift by 32 is out of
range and causes the gcc warning.

The intent might be to clear any sign-extended bits, if the assignment
outname.on_valu = valu did sign extension.  Old C had no unsigned
long, so .on_valu would have been long.  The code is obsolete because
h/out.h now declares .on_valu as uint32_t.
2017-01-16 18:09:55 -05:00
David Given c471f617b7 Ensure that memory is zero-initialised. 2017-01-16 22:45:03 +01:00
David Given 2cdcc16bc2 Fix a buffer overrun that was manifesting on OpenBSD; also fix a bounds check and some uninitialised variable problems. 2017-01-16 22:44:37 +01:00
David Given fa5675d439 Run through clang-format. 2017-01-16 21:16:33 +01:00
David Given 09c79b7dba Fix cosmetic warning when compiling B. 2017-01-15 23:00:17 +01:00
David Given c4ad07fdfc Merge pull request #40 from davidgiven/dtrg-pas
Make Pascal sets work on PowerPC (both ncg and mcg); make Pascal know about 8-bit bytes.
2017-01-15 22:56:06 +01:00
David Given b32be06881 Allow the full 8-bit byte range when reading program source. 2017-01-15 22:41:11 +01:00
David Given 5fd1634830 Rename the test to something more sensible. 2017-01-15 22:33:41 +01:00
David Given 5ff983ad9b Increase the number of items in a char set from 128 to 256, to cover all
possible bytes (7-bit bytes are so 70s).
2017-01-15 22:30:25 +01:00
David Given e7e29d34ff Add a test (currently failing) to check that Pascal char sets can store all 256
possible values. Add the PowerPC ncg and mcg backend support to let the test
actually run, including modifying a bunch of PowrePC libem functions so that
they can be called from both ncg and mcg.
2017-01-15 22:28:14 +01:00
David Given 1ea46f6afe Actually tell the user which tests failed. 2017-01-15 22:26:09 +01:00
David Given fd83b09c58 Fix typo. 2017-01-08 18:53:59 +01:00
David Given 612e14b4b4 Improve confusing error message when calling function procedures from a
top-level statement.

Fixes: #30
2017-01-08 11:25:57 +01:00
David Given ee5ef73dfb Run through clang-format. 2017-01-08 11:23:56 +01:00
David Given 62022c6f6b Don't print source file names during compilation (gcc stopped doing it years
ago).
2017-01-08 00:16:35 +01:00
David Given 4b7fc5e233 Run through clang-format. 2017-01-08 00:15:23 +01:00
David Given 11ea3a2fe1 Don't sort inludes any more (breaks too many ACK files). 2017-01-08 00:15:10 +01:00
David Given 51862cff82 Merge pull request #32 from dram/add-execve
Add execve() system call for Linux
2017-01-07 23:23:00 +01:00
David Given 893471a42e No longer truncate module names at 10 characters when constructing paths;
rename some library modules to their full names.
2017-01-07 23:00:52 +01:00
David Given d50a6f99de Run through clang-format. 2017-01-07 22:56:00 +01:00
David Given cca6171e55 Properly install man pages. 2017-01-07 22:38:30 +01:00
David Given 9945b019d2 Add a B man page. 2017-01-07 22:35:02 +01:00
David Given a7fa54e4e0 Update the README. 2017-01-07 20:11:01 +01:00
David Given 837b9622fb Make sure that constant folding doesn't render our tests trivial. 2017-01-07 19:53:57 +01:00
David Given abbead482a Sections are now aligned (required by the EM spec). 2017-01-07 18:47:46 +01:00
David Given efab08178b Fix a bunch of issues with pushing and popping mismatched sizes, which the B
compiler does a lot; dup 8 for pairs of words is now optimised.
2017-01-07 18:47:00 +01:00
David Given 5a38ce2a69 Pre-and-post-modification operators now work substantially better (i.e.,
working).
2017-01-07 18:46:03 +01:00
David Given 39215c131e Moved the inc/dec operator tests into their own source file; more exhaustive
testing.
2017-01-07 18:38:43 +01:00
David Given 6b4f8d72b8 ine and ste are now declared to modify memory (preventing cached values being
propagated across the modification).
2017-01-07 13:25:09 +01:00
David Given 7710c76d56 Introduce sequence points before store instructions to prevent loads from the
same address being delayed until after the store (at which point they'll return
the wrong value).
2017-01-07 13:17:39 +01:00
David Given 0da248dced Use a better NOT; and after remembering that PowerPC bit numbers are all
backwards in the documentation, rewrote IFEQ/IFLT/IFLE to actually work.
Probably. Thanks to the B test suite for spotting this.
2017-01-07 01:03:15 +01:00
David Given 77fc62285d Extern variables can now be written to. 2017-01-06 23:24:05 +01:00
David Given 73922f1d16 Ensure that procedure labels are word-aligned. 2017-01-06 22:29:52 +01:00
Xin Wang 24d26b2826 Add execve() system call for Linux 2017-01-06 18:33:52 +08:00
David Given 72766a02de Fix typo in the descr file which was stopping -B from working. Add B
documentation to the ack man page.
2017-01-04 13:28:40 +00:00
David Given aeb9d4952d Added an abmodules tool which detects B modules and generates an initialiser
function for them (in C, unfortunately).
2017-01-03 18:54:13 +00:00
David Given e2751f76b5 Add a control flow test. 2017-01-01 23:51:48 +00:00
David Given 62bc2ab97a Jump tables for switch now go in ROM (required by the EM spec). Forward gotos
now work.
2017-01-01 23:28:41 +00:00
David Given 8b8910595a Add proper support for negative constants in external initialisers. 2017-01-01 17:56:53 +00:00
David Given 049aff9f33 Remove the negative-constant code from the compiler; I think it's going to
break a=-1 (with no spaces). Backed out changeset dead3363ac7d.
2017-01-01 17:44:55 +00:00
David Given be909fe045 Add tests for more operators. 2017-01-01 17:44:03 +00:00
David Given 374e7a1c57 Add support for the ~ operator. 2017-01-01 17:40:06 +00:00
David Given b1576e2c77 Add support for negative constants in external initialisers. 2016-12-31 19:43:03 +00:00
David Given a01523a893 Allow programs to override binit() (so they can register their own modules). 2016-12-31 17:39:51 +00:00
David Given 1beedca590 Add support for B tests; add a test for the B operators (finding several
compiler bugs in the process).
2016-12-31 17:38:52 +00:00
David Given 803b81e3f4 Add support for the xor operator. 2016-12-31 17:36:12 +00:00
David Given c3e1ef1064 B patch table names shouldn't be in the B symbol namespace. 2016-12-31 00:14:28 +00:00
David Given fa02a855e8 Fix issue where !x was actually calculating !!x. 2016-12-31 00:14:04 +00:00