Danny Milosavljevic
dc69243eb7
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-07 19:57:10 +02:00
Danny Milosavljevic
f33f0cb3f6
Inherit CFLAGS for mes.
...
* build-aux/check.sh.in: Inherit CFLAGS for mes.
2019-09-07 19:57:10 +02:00
Danny Milosavljevic
d6ac93695c
Fix typo.
...
* build-aux/build.sh.in: Fix typo in "CFLAGS".
2019-09-07 19:57:10 +02:00
Danny Milosavljevic
b47f25547d
tests: Fail early on nonexistent file.
...
* lib/tests/io/90-stat.c (main): Fail early on nonexistent file.
2019-09-07 19:57:10 +02:00
Danny Milosavljevic
f018be6750
open: Check flags, and use _open2 if applicable.
...
* lib/linux/open.c (open): Check flags; use _open2.
2019-09-07 19:57:09 +02:00
Danny Milosavljevic
554da18fac
ldiv: Make rem < 0 if a < 0.
...
* lib/mes/div.c (ldiv): Make rem < 0 if a < 0.
2019-09-07 19:57:09 +02:00
Danny Milosavljevic
b1090422c3
ldiv: Handle a == LONG_MIN.
...
* lib/mes/div.c (ldiv): Handle a == LONG_MIN.
2019-09-07 19:57:09 +02:00
Danny Milosavljevic
fba1e15f02
Fix ntoab.
...
Follow-up to b5b19304b59fefbed923b146ec8c8d495556fa76.
* lib/mes/ntoab.c (ntoab): Fix non-MESC case.
2019-09-07 19:57:09 +02:00
Danny Milosavljevic
914f4d40a7
signal: Define "_restorer" everywhere except on i386.
...
* lib/linux/signal.c: Define "_restorer" everywhere except on i386.
2019-09-07 19:57:09 +02:00
Danny Milosavljevic
d79091ce4e
Clarify our data type choices in "struct stat".
...
* include/sys/stat.h: Clarify our data type choices in "struct stat".
2019-09-07 19:57:09 +02:00
Jan Nieuwenhuizen
b5523ad09e
test: Bump timeout.
...
* build-aux/test-c.sh: Bump timeout to 10s, __mesabi_uldiv can be slow.
2019-09-07 19:57:06 +02:00
Danny Milosavljevic
e6400e78d3
ntoab: Use __mesabi_uldiv only on __MESC__.
...
* lib/mes/ntoab.c (ntoab): Use __mesabi_uldiv only on __MESC__.
2019-09-07 16:31:46 +02:00
Jan Nieuwenhuizen
7eca5208b7
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-09-07 16:31:46 +02:00
Danny Milosavljevic
7cb40dd5a4
ntoab: Include "assert.h".
...
* lib/mes/ntoab.c: #include "assert.h".
2019-09-07 16:31:46 +02:00
Danny Milosavljevic
88db18509c
mescc: Mes C Library: Use __mesabi_uldiv.
...
* lib/mes/ntoab.c (ntoab): Use __mesabi_uldiv.
2019-09-07 16:31:46 +02:00
Danny Milosavljevic
947b916769
mescc: Mes C Library: Add integer division algorithm.
...
* lib/mes/div.c: New file.
2019-09-07 16:31:46 +02:00
Jan Nieuwenhuizen
4d23ca40d8
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-09-07 16:31:46 +02:00
Jan Nieuwenhuizen
59c66e67e2
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-09-07 16:31:46 +02:00
Jan Nieuwenhuizen
7520d0842a
tests: Disable 70-extern.c for x86_64-gcc.
...
* build-aux/check-mescc.sh (XFAIL_TESTS)[x86_64-gcc]: Add
70-extern.c.
2019-09-07 16:31:45 +02:00
Danny Milosavljevic
62c7a7c37a
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-09-07 16:31:45 +02:00
Jan Nieuwenhuizen
bf6c85a652
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-09-07 16:31:45 +02:00
Jan Nieuwenhuizen
f356867bea
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-09-07 16:31:45 +02:00
Jan Nieuwenhuizen
a9a0d142b6
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-09-07 16:31:45 +02:00
Jan Nieuwenhuizen
910408996a
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-09-07 16:31:45 +02:00
Jan Nieuwenhuizen
37996c845b
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-09-07 16:31:45 +02:00
Jan Nieuwenhuizen
28166e32bb
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-09-07 16:31:44 +02:00
Jan Nieuwenhuizen
8ad984fa69
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-09-07 16:31:44 +02:00
Jan Nieuwenhuizen
637d77e2b0
mescc: Resurrect --write.
...
* module/mescc/mescc.scm (mescc:preprocess): Pass pretty-print/write
to c->ast.
2019-09-07 16:31:44 +02:00
Jan Nieuwenhuizen
5c633eca0f
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-09-07 16:31:44 +02:00
Jan Nieuwenhuizen
2a6015eece
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-09-07 16:31:44 +02:00
Jan Nieuwenhuizen
fe1e2a622e
build: Resurrect --with-cheating.
...
* build-aux/config.sh.in (SCHEME): New substitute.
* build-aux/config.make.in: Likewise.
* configure: Substitute them.
2019-09-07 16:31:44 +02:00
Jan Nieuwenhuizen
3ae11a0c11
mescc: Support tcc: libtcc1 build fixes.
...
* lib/libtcc1.c: Support building without long long, float support.
2019-09-07 16:31:44 +02:00
Jan Nieuwenhuizen
e2a1ebe109
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-09-07 16:31:43 +02:00
Jan Nieuwenhuizen
c065e4a2fd
mescc: Support tcc: Add intptr_t, uintptr_t.
...
* include/sys/types.h (intptr_t, uintptr_t): Add typedef.
2019-09-07 16:31:43 +02:00
Jan Nieuwenhuizen
0cfdb5e9d8
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-09-07 16:31:43 +02:00
Jan Nieuwenhuizen
46f3112956
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-09-07 16:31:43 +02:00
Jan Nieuwenhuizen
77f9e60b47
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-09-07 16:31:43 +02:00
Jan Nieuwenhuizen
7ad9aa0202
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-09-07 16:31:43 +02:00
Danny Milosavljevic
8582816658
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-09-07 16:31:43 +02:00
Jan Nieuwenhuizen
1aaf3a55c7
Revert "test: Disable 60-math.c test."
...
This reverts commit bbe6576a66a520d429bb3ec84120ffcce88480bf.
2019-09-07 16:31:42 +02:00
Jan Nieuwenhuizen
62309eb908
test: Disable 60-math.c test.
...
* build-aux/check-mescc.sh (TESTS): Remove
lib/tests/scaffold/60-math.c.
(BROKEN_TESTS): Add it.
2019-09-07 16:31:42 +02:00
Jan Nieuwenhuizen
75f631fc5b
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-09-07 16:31:42 +02:00
Jan Nieuwenhuizen
c146c86cad
mescc: Use basename of input as default output name.
...
* module/mescc/mescc.scm (mescc:preprocess, mescc:compile,
mescc:assemble, M1->hex2): Use basename of input as default output name.
2019-09-07 16:31:42 +02:00
Jan Nieuwenhuizen
33b02642b3
build: Handle gcc with --pie-by-default.
...
This fixes upgrading to debian-hurd-20190220.img.
* build-aux/build.sh.in (CFLAGS): Add -static. Fixes using gcc
compiled with --pie-by-default
* build-aux/check.sh.in (CFLAGS): Likewise.
* module/mescc.scm (parse-opts): Ignore -no-pie, -static.
2019-09-07 16:31:42 +02:00
Jan Nieuwenhuizen
690cb5a11f
test: Split-off broken 72-typedef-struct-def-local.
...
* lib/tests/scaffold/72-typedef-struct-def-local.c: New file.
* lib/tests/scaffold/72-typedef-struct-def.c: Remove local bit.
* build-aux/check-mescc.sh (TESTS): Add it.
(XFAIL_TESTS)[mescc]: Add lib/tests/scaffold/72-typedef-struct-def.c.
2019-09-07 16:31:42 +02:00
Jan Nieuwenhuizen
eac39ab402
test: Fix open-read test.
...
* build-aux/pre-inst-env.in (srcdir): Remove.
(abs_top_srcdir, abs_top_builddir): Export.
* lib/tests/posix/50-open-read.c (main): Use abs_top_srcdir.
2019-09-07 16:31:42 +02:00
Jan Nieuwenhuizen
770f381f1f
test: Add open-read test.
...
* build-aux/test-c.sh: Support running by hand.
* lib/tests/posix/50-open-read.c: New test.
* lib/tests/posix/data/open-read: New file.
* build-aux/check-mescc.sh (TESTS): Add it.
2019-09-07 16:31:41 +02:00
Jan Nieuwenhuizen
0535eeda50
test: Enable argv test, run tests with arguments.
...
* build-aux/check-mescc.sh (TESTS): Enable 54-argv.c
(XFAIL_TESTS): Remove it.
* build-aux/test-c.sh: Invoke test with options.
* lib/tests/scaffold/54-argc.c: Update.
2019-09-07 16:31:41 +02:00
Jan Nieuwenhuizen
5d079c1866
mescc: Mes C library: Move common getcwd, open bits to posix.
...
* lib/linux/_getcwd.c: Rename from getcwd.c.
* lib/linux/_open3.c: Rename from open.c.
* lib/posix/getcwd.c: New file with bits from ../linux/getcwd.c.
* lib/posix/open.c: New file with bits ../linux/getcwd.c.
* build-aux/build-lib.sh (libc_SOURCES): Update.
2019-09-07 16:31:41 +02:00
Jan Nieuwenhuizen
20f03c57e7
mescc: Mes C Library: Move posix bits to read.
...
* lib/linux/_read.c: Rename from read.
* lib/posix/read.c: New file.
* build-aux/build-lib.sh (libc_SOURCES): Update.
* include/mes/lib.h (_read): Declare.
2019-09-07 16:31:41 +02:00