Jan Nieuwenhuizen
2db5ec2f55
signal: Use SA_RESTORER on x86-64.
...
* lib/linux/signal.c (signal)[x86_64]: Avoid segfault by setting
SA_RESTORER flag.
2019-09-09 16:04:15 +02:00
Danny Milosavljevic
23d857c834
signal: Add comment on why we don't use the restorer.
...
* lib/linux/signal.c: Add comment on why we don't use the restorer.
2019-09-09 16:04:15 +02:00
Danny Milosavljevic
4a183fa1cf
signal: Remove SA_SIGINFO.
...
* lib/linux/signal.c (signal): Remove SA_SIGINFO.
2019-09-09 16:04:15 +02:00
Danny Milosavljevic
3e6306a5ce
signal: Don't use custom restorer.
...
* lib/linux/signal.c (signal): Don't use custom restorer.
2019-09-09 16:04:14 +02:00
Danny Milosavljevic
02fdead244
signal: Use SA_SIGINFO (like glibc).
...
* lib/linux/signal.c (_restorer): Rename to...
(_restorer_for_siginfo): ...this.
(signal): Use it. Use SA_SIGINFO.
2019-09-09 16:04:14 +02:00
Danny Milosavljevic
e8bbe21499
signal: Make sure that the signal mask is actually unsigned long.
...
* lib/linux/signal.c (signal): Make sure that the signal mask is actually
unsigned long.
2019-09-09 16:04:14 +02:00
Danny Milosavljevic
5754e379af
Delete "__sigmask".
...
Follow-up to 6d95b89759d3c598fc84194429ae8c57249daa1a
* lib/linux/signal.c (__sigmask): Delete definition.
2019-09-09 16:04:14 +02:00
Danny Milosavljevic
3f1ba73fc7
Fix "struct sigaction" structure for rt_sigaction.
...
* include/signal.h (sigset_t): Increase size.
* lib/linux/signal.c (signal): Use new sigset_t.
2019-09-09 16:04:14 +02:00
Danny Milosavljevic
181d1e11ea
Inherit CFLAGS for mes.
...
* build-aux/check.sh.in: Inherit CFLAGS for mes.
2019-09-09 16:04:14 +02:00
Danny Milosavljevic
dadf07a484
Fix typo.
...
* build-aux/build.sh.in: Fix typo in "CFLAGS".
2019-09-09 16:04:14 +02:00
Danny Milosavljevic
c7d050c0cd
tests: Fail early on nonexistent file.
...
* lib/tests/io/90-stat.c (main): Fail early on nonexistent file.
2019-09-09 16:04:13 +02:00
Danny Milosavljevic
5a2a00f4e8
open: Check flags, and use _open2 if applicable.
...
* lib/linux/open.c (open): Check flags; use _open2.
2019-09-09 16:04:13 +02:00
Danny Milosavljevic
3943155a64
ldiv: Make rem < 0 if a < 0.
...
* lib/mes/div.c (ldiv): Make rem < 0 if a < 0.
2019-09-09 16:04:13 +02:00
Danny Milosavljevic
21bd2c1e90
ldiv: Handle a == LONG_MIN.
...
* lib/mes/div.c (ldiv): Handle a == LONG_MIN.
2019-09-09 16:04:13 +02:00
Jan Nieuwenhuizen
49aff4ec1c
ntoab: Use __mesabi_uldiv only for arm.
...
* lib/mes/ntoab.c (ntoab)[__MESC__ && __arm__]: Use __mesabi_uldiv.
* build-aux/check-mescc.sh (XFAIL_TESTS): 70-printf-simple.c and
70-printf.c now pass for x86_64 mescc.
2019-09-09 16:04:13 +02:00
Danny Milosavljevic
08774a9c74
Fix ntoab.
...
Follow-up to b5b19304b59fefbed923b146ec8c8d495556fa76.
* lib/mes/ntoab.c (ntoab): Fix non-MESC case.
2019-07-01 20:04:26 +02:00
Danny Milosavljevic
b0466331a7
signal: Define "_restorer" everywhere except on i386.
...
* lib/linux/signal.c: Define "_restorer" everywhere except on i386.
2019-06-18 19:26:45 +02:00
Danny Milosavljevic
9799e4df2d
Clarify our data type choices in "struct stat".
...
* include/sys/stat.h: Clarify our data type choices in "struct stat".
2019-06-18 17:37:10 +02:00
Jan Nieuwenhuizen
39498d9233
test: Bump timeout.
...
* build-aux/test-c.sh: Bump timeout to 10s, __mesabi_uldiv can be slow.
2019-09-07 19:55:12 +02:00
Danny Milosavljevic
9b0efad295
ntoab: Use __mesabi_uldiv only on __MESC__.
...
* lib/mes/ntoab.c (ntoab): Use __mesabi_uldiv only on __MESC__.
2019-06-14 17:45:32 +02:00
Jan Nieuwenhuizen
b8dace81c6
mescc: Mes C Library: Include mes/div.c for mescc builds.
...
* build-aux/configure-lib.sh (libmes_SOURCES): Add mes/div.c.
* simple.sh: Likewise.
2019-06-14 10:02:49 +02:00
Danny Milosavljevic
a63b0bae44
ntoab: Include "assert.h".
...
* lib/mes/ntoab.c: #include "assert.h".
2019-06-14 01:27:15 +02:00
Danny Milosavljevic
c35124ab54
mescc: Mes C Library: Use __mesabi_uldiv.
...
* lib/mes/ntoab.c (ntoab): Use __mesabi_uldiv.
2019-06-14 01:02:40 +02:00
Danny Milosavljevic
cc870b4adc
mescc: Mes C Library: Add integer division algorithm.
...
* lib/mes/div.c: New file.
2019-06-14 00:57:43 +02:00
Jan Nieuwenhuizen
1bb64ec48f
mescc: Mes C Library: Have write behave well with buffered reads.
...
* lib/mes/write.c: New file.
* build-aux/configure-lib.sh (libc_mini_SOURCES): Add it.
(libc_mini_shared_SOURCES): New variable.
(libc_mini_SOURCES, libmes_SOURCES): Use it.
(libmes_SOURCES): Add lib/linux/lseek.c, lib/posix/write.c.
(libc_tcc_SOURCES): Remove lib/linux/lseek.c.
* lib/posix/write.c (write): Correct for read buffer.
* lib/stdio/fwrite.c (fwrite): Remove read buffer correction.
* simple.sh: Update.
2019-07-28 13:01:37 +02:00
Jan Nieuwenhuizen
ef29ade04b
mescc: Mes C Library: Add buffered read.
...
* lib/mes/__buffered_read.c: New file.
* build-aux/configure-lib.sh (libc_SOURCES): Add it. Also add memmove.c.
(libc_tcc_SOURCES): Remove memmove.c
* lib/linux/close.c (close): Clear read buffer.
* lib/linux/_open3.c (_open3): Likewise.
* lib/linux/lseek.c (lseek): Correct for read buffer.
* lib/stdio/fwrite.c (fwrite): Likewise.
* lib/posix/read.c (read): Call __buffered_read.
* lib/posix/write.c (write): Add FIXME note about buffered reads.
* simple.sh: Update.
2019-07-27 22:58:49 +02:00
Jan Nieuwenhuizen
c7d86eb955
tests: Disable 70-extern.c for x86_64-gcc.
...
* build-aux/check-mescc.sh (XFAIL_TESTS)[x86_64-gcc]: Add
70-extern.c.
2019-06-10 23:13:50 +02:00
Danny Milosavljevic
a5f16861ab
mescc: Put char's ASCII code into register, not char.
...
* module/mescc/compile.scm (expr-register): Put char's ASCII code into
register, not char.
2019-05-30 22:11:37 +02:00
Jan Nieuwenhuizen
7670d6be38
mes: Update to Nyacc 0.93.
...
* mes/module/nyacc/lang/c99/util.mes: New file.
* mes/module/nyacc/lang/c99/parser.mes: Use it.
* module/mescc/compile.scm (ast->info): Update for Nyacc 0.93.0.
* module/mescc/preprocess.scm (need-progress): Likewise.
(ast-strip-comment): Likewise.
2019-06-09 19:42:42 +02:00
Jan Nieuwenhuizen
dd34569751
mes: string->number: Support #x-prefixed hex numbers.
...
* mes/module/mes/scm.mes (string->number): Support "#x"-prefix.
* tests/math.test ("string->number #hex"): Test it.
2019-08-02 22:52:46 +02:00
Jan Nieuwenhuizen
26891251a6
mescc: Do not dump variables with extern storage.
...
* lib/tests/scaffold/70-extern.stdout: New file.
* lib/tests/scaffold/70-extern.c: New file.
* build-aux/check-mescc.sh (TESTS): Add it..
* module/mescc/M1.scm (global-string?, global-extern?): New function.
(info->M1): Dump strings first. Skip extern symbols.
* module/mescc/info.scm (<global>): Add storage field.
(make-global): Add storage parameter. Pass it.
* module/mescc/compile.scm (make-global-entry): Likewise.
(global->info): Likewise.
(init-declr->info): Likewise.
(decl->info): Pass storage.
2019-07-27 17:22:00 +02:00
Jan Nieuwenhuizen
e8626841f3
build: ./pre-inst-env MES_PREFIX fixup.
...
* build-aux/pre-inst-env.in: Set MES_PREFIX to abs_top_srcdir.
* src/mes.c (open_boot): Cater for MES_PREFIX/mes and ${srcdest}.
2019-07-27 09:19:53 +02:00
Jan Nieuwenhuizen
c03807b78f
mescc: Be silent.
...
* module/mescc/M1.scm (infos->M1, info->M1): Add verbose?. Move
debugging into verbose? > 1.
* module/mescc/compile.scm (c99-input->info, c99-ast->info): Likewise.
(mescc:trace-verbose): Rename from mescc:trace.
(mescc:trace): New function.
* module/mescc.scm (mescc:main): Likewise.
* module/mescc/mescc.scm (mescc:preprocess, c->ast mescc:compile,
c->info, E->info): Likewise.
* module/mescc/preprocess.scm (c99-input->full-ast, c99-input->ast):
Likewise.
2019-07-27 09:51:21 +02:00
Jan Nieuwenhuizen
af1cc3ce81
mescc: Add <include>/<kernel>/<arch> to include path.
...
* module/mescc/preprocess.scm (c99-input->full-ast): Add
<include>/<kernel>/<arch> to include path.
* module/mescc/compile.scm (c99-input->info): Pass arch.
* module/mescc/mescc.scm (mescc:preprocess): Likewise.
(c->info): Likewise.
(c->ast): Likewise.
2019-07-26 22:44:04 +02:00
Jan Nieuwenhuizen
2197252482
mescc: Add 70-function-destruct-declare.c test.
...
* module/mescc/compile.scm (init-declr->info): Do not attempt to
re-calculate function type.
(ftn-declr:get-type): Remove.
* lib/tests/scaffold/70-function-destruct-declare.c: New file.
* build-aux/check-mescc.sh (TESTS): Add it.
2019-07-26 19:09:12 +02:00
Jan Nieuwenhuizen
d5a0ecb3d5
mescc: Resurrect --write.
...
* module/mescc/mescc.scm (mescc:preprocess): Pass pretty-print/write
to c->ast.
2019-07-26 18:57:45 +02:00
Jan Nieuwenhuizen
72e3582322
build: Distribute crt*.c, libc+gnu.c for tcc, gcc bootstrap build.
...
* build-aux/build-lib.sh (libc_gnu_SOURCES): Build libc+gnu.c. Copy
crt*.c, libc+gnu.c for distribution.
2019-07-26 18:36:07 +02:00
Jan Nieuwenhuizen
9628f38be3
build: Uniquify config macros.
...
* configure (main): Rename VERSION to MES_VERSION, pkgdatadir to
MES_PKGDATADIR. Update users.
* configure.sh (mes_system): Likewise.
* src/mes.c (mes_symbols): Update.
(open_boot): Update.
* scaffold/cons-mes.c (main): Update.
* simple.sh: Update.
2019-07-26 18:20:32 +02:00
Jan Nieuwenhuizen
2e98d03699
build: Resurrect --with-cheating.
...
* build-aux/config.sh.in (SCHEME): New substitute.
* build-aux/config.make.in: Likewise.
* configure: Substitute them.
2019-07-20 18:56:58 +02:00
Jan Nieuwenhuizen
3970a8797b
mescc: Support tcc: libtcc1 build fixes.
...
* lib/libtcc1.c: Support building without long long, float support.
2019-07-23 20:38:29 +02:00
Jan Nieuwenhuizen
bf4af81664
mescc: Mes C Library: Avoid type/size_t conflicts.
...
* include/alloca.h: Remove typedefs, include sys/types.h.
* include/stdint.h: Likewise.
* include/string.h: Likewise.
2019-06-01 08:44:18 +02:00
Jan Nieuwenhuizen
0904a288c7
mescc: Support tcc: Add intptr_t, uintptr_t.
...
* include/sys/types.h (intptr_t, uintptr_t): Add typedef.
2019-07-17 22:54:13 +02:00
Jan Nieuwenhuizen
2611a64b2e
mescc: Add 70-struct-post.c test with fix.
...
* lib/tests/scaffold/70-struct-post.c: New file.
* build-aux/check-mescc.sh (TESTS): Add it.
* module/mescc/compile.scm (expr->register): Use type size for rank
0 (WAS: 1).
2019-07-21 22:40:42 +02:00
Jan Nieuwenhuizen
2f77f506b1
mescc: Add 70-struct-short-enum-init.c test with fix.
...
* module/mescc/compile.scm (init->data): Respect type of size.
* lib/tests/scaffold/70-struct-short-enum-init.c: New file.
* lib/tests/scaffold/70-struct-short-enum-init.stdout: New file.
* build-aux/check-mescc.sh (TESTS): Add test.
2019-07-21 16:48:26 +02:00
Jan Nieuwenhuizen
8e01a68357
mescc: Add 70-array-in-struct-init.c test with fix.
...
* lib/tests/scaffold/70-array-in-struct-init.c: New file.
* lib/tests/scaffold/70-array-in-struct-init.stdout: New file.
* build-aux/check-mescc.sh (TESTS): Add test.
* module/mescc/compile.scm (array-init-element->data): Recurse for
elements instead of using init->data. Support array fields.
2019-07-20 17:14:55 +02:00
Jan Nieuwenhuizen
81849edb86
mes: Remove broken copy of simple-format.
...
* mes/module/mes/simple-format.mes: New file.
* mes/module/mes/guile.mes: Use it.
(with-output-to-string, simple-format): Remove broken copies.
* mes/module/mes/display.mes (with-output-to-string, simple-format,
format): Remove.
2019-07-19 15:36:36 +02:00
Danny Milosavljevic
4b5d5017c4
Fix remainder handling.
...
* mes/module/mes/scm.mes (number->string): Fix remainder handling.
* build-aux/check-mescc.sh (XFAIL_TESTS): Remove
lib/tests/scaffold/60-math.c.
2019-07-05 15:52:04 +02:00
Jan Nieuwenhuizen
5d1a3e9eda
Revert "test: Disable 60-math.c test."
...
This reverts commit bbe6576a66a520d429bb3ec84120ffcce88480bf.
2019-07-09 22:01:24 +02:00
Jan Nieuwenhuizen
0e7ff7e82a
test: Disable 60-math.c test.
...
* build-aux/check-mescc.sh (TESTS): Remove
lib/tests/scaffold/60-math.c.
(BROKEN_TESTS): Add it.
2019-07-09 21:57:00 +02:00
Jan Nieuwenhuizen
9ac6528348
build: Resurrect bootstrap.sh.
...
* build-aux/connfigure-lib.sh: Split from build-lib.sh
* build-aux/build-lib.sh: Include it.
* build-aux/bootstrap.sh.in: New file.
* configure.sh: Substitute it.
2019-07-07 12:17:03 +02:00