Commit graph

851 commits

Author SHA1 Message Date
Jan Nieuwenhuizen eff1e97cdf mescc: Tinycc support: ~, ^=.
* module/mes/as-i386.mes (i386:accu-not): New function.
  (i386:accu-negate): Rename from i386:accu-not.
* module/mes/as-i386.scm (mes): Export them.
* module/language/c99/compiler.mes (expr->accu): Support ~, ^=.
* scaffold/tests/60-math.c (test): Test it.
* stage0/x86.M1 (not____%eax): New define.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen cccbfe4c61 mescc: Tinycc support: struct.struct.
* module/language/c99/compiler.mes (expr->accu): Support &*,
  bar.foo.i, p->foo.i, p->pf->i (*pp)->foo.i, [slightly modified] offsetof.
* scaffold/tests/72-typedef-struct-def.c (test): Test them.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen b87cd56376 mescc: Tinycc support: ***parameter.
* module/language/c99/compiler.mes (.name): Support ***parameter.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen 11fb4e03dc mescc: Tinycc support: bitwise-or initializer.
* module/language/c99/compiler.mes (initzer->value): New function.
  (initzer->data): Use it to support bitwise-or initializer.
* scaffold/tests/74-multi-line-string.c (test): Test it.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen 3687740b64 mescc: Tinycc support: char*[] in function.
* module/language/c99/compiler.mes (c99-input->full-ast): Add NULL.
  (decl->info): Support char* [] in function scope.
* scaffold/tests/71-struct-array.c (test) Test it.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen e8023cd2ef mescc: Tinycc support: more list initializers.
* module/language/c99/compiler.mes (init-declr->name): Handle array,
  pointer array.
  (init-declr->pointer): Likewise.
  (decl->info): Generalize list initializers, add pointer variant.
  FIXME: AST-rewriting?
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen 16b9a21712 mescc: Tinycc support: headers.
* mlibc/include/string.h (ssize_t): New type.
* mlibc/include/unistd.h (ssize_t): New type.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen 8ec7e1225b mescc: Tinycc support: sizeof struct field.
* module/language/c99/compiler.mes (expr->accu): Sizeof struct field.
* scaffold/tests/72-typedef-struct-def.c (test): Test it.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen d393785381 mescc: Tinycc support: sizeof typename.
* module/language/c99/compiler.mes (expr->accu): Sizeof typename.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen 0fa425ed5e mescc: Tinycc support: pre/post-inc/dec more.
* module/language/c99/compiler.mes (expr-add): New function.
  (expr->pointer): New function.
  (expr->accu): Use it to support broader pre/post-inc/dec..
* scaffold/tests/72-typedef-struct-def.c (test): Test it.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen 59e663021a mescc: Tinycc support: comma operator.
* module/language/c99/compiler.mes (expr->accu): Handle comma operator.
* scaffold/tests/74-multi-line-string.c (test): Test it.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen 3cdfdd7407 mescc: Tinycc support: assign pointer to struct field.
* module/language/c99/compiler.mes (expr->accu, expr->accu*): Support
  pointer field selection.
* scaffold/tests/72-typedef-struct-def.c (test): Test it.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen 9b66421ce8 mescc: Tinycc support: multi-line strings.
* module/language/c99/compiler.mes (initzer->data, expr->global):
  Handle multi-line strings.
* scaffold/tests/74-multi-line-string.c: New file.
* make.scm (add-scaffold-test): Build it.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen 3ae27f52e4 mescc: Tinycc support: union.
* scaffold/tests/73-union.c: New file.
* module/language/c99/compiler.mes (union->type-entry): New
  function.
  (decl->info): Support unions.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen 07ee1fbf4f mescc: Tinycc support: struct.
* scaffold/tests/72-typedef-struct-def.c: New file.
* module/language/c99/compiler.mes (decl->info): Struct support for tinycc.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen 94b3c828d3 mescc: Refactor decl.
* module/mes/as-i386.mes (i386:mem->base, i386:nop): New functions.
* module/mes/as-i386.scm: Export them.
* module/language/c99/compiler.mes:
* stage0/x86.M1 (nop,mov____(%edx),%edx,movzbl_(%edx),%edx): New defines.
* scaffold/tests/23-pointer.c: New file.
* scaffold/tests/t.c: New file.
* make.scm: Build them.
* module/language/c99/compiler.mes (init-declr->name): Handle array.
  (init-declr->pointer): Likewise.
  (ident->accu): Simplify.
  (ident->base): Simplify.
  (ident-address->base): Typo.
  (expr->accu): Simplify.
  (decl->info): Simplify.
* mlibc/libc-mes.c (getenv): Remove superfluous statement.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen 69e997047a mescc: Use records for Guile: <local>.
* module/language/c99/info.scm (<local>): New record.
* module/language/c99/compiler.mes (make-local-entry): Rename from
  make-local.  Update callers.
  (local-var?): Rename from local?. Update callers.
* module/language/c99/info.mes (make-local, local:type, local:pointer,
  local:id): Move from compiler.mes.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen d2650c8ebf mescc: Use records for Guile: <global>.
* module/language/c99/info.scm (<global>): New record.
* module/language/c99/compiler.mes (make-global-entry): Rename from
  make-global.  Update callers.
* module/language/c99/info.mes (make-global, global:type,
  global:pointer, global:value): Move from compiler.mes.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen c0fb6d247d mescc: Use records for Guile: <type>.
* module/language/c99/info.scm (<type>): New record.
* module/language/c99/compiler.mes (make-type-entry): Rename from
  make-type.  Update-callers.
* module/language/c99/info.mes (make-type, type:type, type:size,
  type:pointer, type:description): Move from compiler.mes.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen 5d54461f67 mescc: Use records for Guile: <info>.
* module/language/c99/info.scm (<info>): Make immutable record.
  Update users.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen 52b09c5f17 mescc: Use records for Guile: preparation.
* module/language/c99/info.mes: New file.
* module/mes/M1.mes: Use it.
* scripts/mescc.mes: Use it.
* module/language/c99/compiler.mes: Use it.  (<info>, <types>,
  <constants>, <functions>, <globals>, <locals>, <function>, <text>,
  <break>, <continue>, make, info?, .info, .types, .constants,
  .functions, .globals, .locals, .function, .text, .break, .continue):
  Remove.
* module/language/c99/info.scm: New file.
* module/language/c99/compiler.scm: Use it.
* guile/mescc.scm: Use it.
* module/mes/M1.scm: Use it.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen 81f3fb0ecf mescc: Refactor decl.
* module/language/c99/compiler.mes (decl->info, ptr-declr->pointer):
  New function.
  (ast->info): Use decl->info.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen 11b0ecc139 guix: Update build.
* guix.scm (mes): Do not strip.  Fixes mes binary.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen d4294c0088 build: support Guix.
* guile/guix/make.scm (link-or-cp): New function.
  (assert-link, store): Use it.
2017-07-26 11:36:08 +02:00
Jan Nieuwenhuizen 2de207076b build: Add make install.
* guile/guix/make.scm (method-cp, install, install-target?): New functions.
* make.scm: Use them.
2017-07-26 11:36:07 +02:00
Jan Nieuwenhuizen a7b7297ee2 build: Add target list.
* GNUmakefile (%): Handle all targets.
* make.scm (main): Show and implement target list.
2017-07-26 11:36:07 +02:00
Jan Nieuwenhuizen 89a9decfff build: Ignore some files.
.gitignore: Update for make.scm.
2017-07-26 11:36:07 +02:00
Jan Nieuwenhuizen 37ed2c15bf build: Bugfix for store.
* guile/guix/make.scm (store): Add each store file only once.
2017-07-26 11:36:07 +02:00
Jan Nieuwenhuizen 1bddb52c75 build: Resurrect guile-2.0. Thanks rain1!
* module/mes/guile.scm: New file.
* module/mes/elf.scm: Include it.
* module/mes/bytevectors.scm: : Include it.
* module/mes/as.scm: Include it.
* module/mes/as-i386.scm: Include it.
* module/mes/M1.scm: Include it.
* module/language/c99/compiler.scm: Include it.
* make.scm: Update.
2017-07-26 11:36:07 +02:00
Jan Nieuwenhuizen 822d0df889 build: Non-Guix build robustifications. Thanks, rain1!
Fix typo in configure, gracefully switch between M0 vs M1, skip
CC32/i686-unknown-linux-gnu-gcc targets if not available, esp. for
non-Guix usage.

* configure (M1): Declare missing variable.
* make.scm (main): all-go, clean-go: New targets.
* GNUmakefile (PHONY_TARGETS): Add them.
  (.config.make): New target.
* guile/guix/make.scm (%CC32): Set to #f if not found.
  (bin.gcc): Skip if CC not set.
  (check-target?, add-target): Skip if target is not set.
2017-07-26 11:36:07 +02:00
Jan Nieuwenhuizen b708c5de8b build: Fix snarf dependencies.
* guile/guix/make.scm (compile.gcc compile.mescc bin.mescc m1-asm):
  Accept and forward dependencies.
* make.scm (gcc-snarf-targets): Remove explicit defaults.
2017-07-26 11:36:07 +02:00
Jan Nieuwenhuizen aef03ebd39 build: Use released M0 intead of M1. 2017-07-26 11:36:07 +02:00
Jan Nieuwenhuizen 6a391df5e0 mescc: Import tinycc test suite.
* make.scm (check-scaffold-tinycc): New target.
* guile/guix/make.scm (<target>): Add baseline field.
  (method-check): Handle baseline.
* scaffold/tinycc/00_assignment.c: New file.
* scaffold/tinycc/00_assignment.expect: New file.
* scaffold/tinycc/01_comment.c: New file.
* scaffold/tinycc/01_comment.expect: New file.
* scaffold/tinycc/02_printf.c: New file.
* scaffold/tinycc/02_printf.expect: New file.
* scaffold/tinycc/03_struct.c: New file.
* scaffold/tinycc/03_struct.expect: New file.
* scaffold/tinycc/04_for.c: New file.
* scaffold/tinycc/04_for.expect: New file.
* scaffold/tinycc/05_array.c: New file.
* scaffold/tinycc/05_array.expect: New file.
* scaffold/tinycc/06_case.c: New file.
* scaffold/tinycc/06_case.expect: New file.
* scaffold/tinycc/07_function.c: New file.
* scaffold/tinycc/07_function.expect: New file.
* scaffold/tinycc/08_while.c: New file.
* scaffold/tinycc/08_while.expect: New file.
* scaffold/tinycc/09_do_while.c: New file.
* scaffold/tinycc/09_do_while.expect: New file.
* scaffold/tinycc/10_pointer.c: New file.
* scaffold/tinycc/10_pointer.expect: New file.
* scaffold/tinycc/11_precedence.c: New file.
* scaffold/tinycc/11_precedence.expect: New file.
* scaffold/tinycc/12_hashdefine.c: New file.
* scaffold/tinycc/12_hashdefine.expect: New file.
* scaffold/tinycc/13_integer_literals.c: New file.
* scaffold/tinycc/13_integer_literals.expect: New file.
* scaffold/tinycc/14_if.c: New file.
* scaffold/tinycc/14_if.expect: New file.
* scaffold/tinycc/15_recursion.c: New file.
* scaffold/tinycc/15_recursion.expect: New file.
* scaffold/tinycc/16_nesting.c: New file.
* scaffold/tinycc/16_nesting.expect: New file.
* scaffold/tinycc/17_enum.c: New file.
* scaffold/tinycc/17_enum.expect: New file.
* scaffold/tinycc/18_include.h: New file.
* scaffold/tinycc/18_include.c: New file.
* scaffold/tinycc/18_include.expect: New file.
* scaffold/tinycc/19_pointer_arithmetic.c: New file.
* scaffold/tinycc/19_pointer_arithmetic.expect: New file.
* scaffold/tinycc/20_pointer_comparison.c: New file.
* scaffold/tinycc/20_pointer_comparison.expect: New file.
* scaffold/tinycc/21_char_array.c: New file.
* scaffold/tinycc/21_char_array.expect: New file.
* scaffold/tinycc/22_floating_point.c: New file.
* scaffold/tinycc/22_floating_point.expect: New file.
* scaffold/tinycc/23_type_coercion.c: New file.
* scaffold/tinycc/23_type_coercion.expect: New file.
* scaffold/tinycc/24_math_library.c: New file.
* scaffold/tinycc/24_math_library.expect: New file.
* scaffold/tinycc/25_quicksort.c: New file.
* scaffold/tinycc/25_quicksort.expect: New file.
* scaffold/tinycc/26_character_constants.c: New file.
* scaffold/tinycc/26_character_constants.expect: New file.
* scaffold/tinycc/27_sizeof.c: New file.
* scaffold/tinycc/27_sizeof.expect: New file.
* scaffold/tinycc/28_strings.c: New file.
* scaffold/tinycc/28_strings.expect: New file.
* scaffold/tinycc/29_array_address.c: New file.
* scaffold/tinycc/29_array_address.expect: New file.
* scaffold/tinycc/30_hanoi.c: New file.
* scaffold/tinycc/30_hanoi.expect: New file.
* scaffold/tinycc/31_args.c: New file.
* scaffold/tinycc/31_args.expect: New file.
* scaffold/tinycc/32_led.c: New file.
* scaffold/tinycc/32_led.expect: New file.
* scaffold/tinycc/33_ternary_op.c: New file.
* scaffold/tinycc/33_ternary_op.expect: New file.
* scaffold/tinycc/34_array_assignment.c: New file.
* scaffold/tinycc/34_array_assignment.expect: New file.
* scaffold/tinycc/35_sizeof.c: New file.
* scaffold/tinycc/35_sizeof.expect: New file.
* scaffold/tinycc/36_array_initialisers.c: New file.
* scaffold/tinycc/36_array_initialisers.expect: New file.
* scaffold/tinycc/37_sprintf.c: New file.
* scaffold/tinycc/37_sprintf.expect: New file.
* scaffold/tinycc/38_multiple_array_index.c: New file.
* scaffold/tinycc/38_multiple_array_index.expect: New file.
* scaffold/tinycc/39_typedef.c: New file.
* scaffold/tinycc/39_typedef.expect: New file.
* scaffold/tinycc/40_stdio.c: New file.
* scaffold/tinycc/40_stdio.expect: New file.
* scaffold/tinycc/41_hashif.c: New file.
* scaffold/tinycc/41_hashif.expect: New file.
* scaffold/tinycc/42_function_pointer.c: New file.
* scaffold/tinycc/42_function_pointer.expect: New file.
* scaffold/tinycc/43_void_param.c: New file.
* scaffold/tinycc/43_void_param.expect: New file.
* scaffold/tinycc/44_scoped_declarations.c: New file.
* scaffold/tinycc/44_scoped_declarations.expect: New file.
* scaffold/tinycc/45_empty_for.c: New file.
* scaffold/tinycc/45_empty_for.expect: New file.
* scaffold/tinycc/46_grep.c: New file.
* scaffold/tinycc/46_grep.expect: New file.
* scaffold/tinycc/47_switch_return.c: New file.
* scaffold/tinycc/47_switch_return.expect: New file.
* scaffold/tinycc/48_nested_break.c: New file.
* scaffold/tinycc/48_nested_break.expect: New file.
* scaffold/tinycc/49_bracket_evaluation.c: New file.
* scaffold/tinycc/49_bracket_evaluation.expect: New file.
* scaffold/tinycc/50_logical_second_arg.c: New file.
* scaffold/tinycc/50_logical_second_arg.expect: New file.
* scaffold/tinycc/51_static.c: New file.
* scaffold/tinycc/51_static.expect: New file.
* scaffold/tinycc/52_unnamed_enum.c: New file.
* scaffold/tinycc/52_unnamed_enum.expect: New file.
* scaffold/tinycc/54_goto.c: New file.
* scaffold/tinycc/54_goto.expect: New file.
* scaffold/tinycc/55_lshift_type.c: New file.
* scaffold/tinycc/55_lshift_type.expect: New file.
* scaffold/tinycc/56_btype_excess-1.c: New file.
* scaffold/tinycc/56_btype_excess-1.expect: New file.
* scaffold/tinycc/57_btype_excess-2.c: New file.
* scaffold/tinycc/57_btype_excess-2.expect: New file.
* scaffold/tinycc/58_function_redefinition.c: New file.
* scaffold/tinycc/58_function_redefinition.expect: New file.
* scaffold/tinycc/59_function_array.c: New file.
* scaffold/tinycc/59_function_array.expect: New file.
* scaffold/tinycc/60_enum_redefinition.c: New file.
* scaffold/tinycc/60_enum_redefinition.expect: New file.
* scaffold/tinycc/61_undefined_enum.c: New file.
* scaffold/tinycc/61_undefined_enum.expect: New file.
* scaffold/tinycc/62_enumerator_redefinition.c: New file.
* scaffold/tinycc/62_enumerator_redefinition.expect: New file.
* scaffold/tinycc/63_local_enumerator_redefinition.c: New file.
* scaffold/tinycc/63_local_enumerator_redefinition.expect: New file.
* scaffold/tinycc/64_macro_nesting.c: New file.
* scaffold/tinycc/64_macro_nesting.expect: New file.
* scaffold/tinycc/67_macro_concat.c: New file.
* scaffold/tinycc/67_macro_concat.expect: New file.
* scaffold/tinycc/70_floating_point_literals.c: New file.
* scaffold/tinycc/70_floating_point_literals.expect: New file.
* scaffold/tinycc/71_macro_empty_arg.c: New file.
* scaffold/tinycc/71_macro_empty_arg.expect: New file.
* scaffold/tinycc/72_long_long_constant.c: New file.
* scaffold/tinycc/72_long_long_constant.expect: New file.
* scaffold/tinycc/73_arm64.c: New file.
* scaffold/tinycc/73_arm64.expect: New file.
* scaffold/tinycc/74_nocode_wanted.c: New file.
* scaffold/tinycc/74_nocode_wanted.expect: New file.
* scaffold/tinycc/75_array_in_struct_init.c: New file.
* scaffold/tinycc/75_array_in_struct_init.expect: New file.
* scaffold/tinycc/76_dollars_in_identifiers.c: New file.
* scaffold/tinycc/76_dollars_in_identifiers.expect: New file.
* scaffold/tinycc/77_push_pop_macro.c: New file.
* scaffold/tinycc/77_push_pop_macro.expect: New file.
* scaffold/tinycc/78_vla_label.c: New file.
* scaffold/tinycc/78_vla_label.expect: New file.
* scaffold/tinycc/79_vla_continue.c: New file.
* scaffold/tinycc/79_vla_continue.expect: New file.
* scaffold/tinycc/80_flexarray.c: New file.
* scaffold/tinycc/80_flexarray.expect: New file.
* scaffold/tinycc/81_types.c: New file.
* scaffold/tinycc/81_types.expect: New file.
* scaffold/tinycc/82_attribs_position.c: New file.
* scaffold/tinycc/82_attribs_position.expect: New file.
* scaffold/tinycc/83_utf8_in_identifiers.c: New file.
* scaffold/tinycc/83_utf8_in_identifiers.expect: New file.
* scaffold/tinycc/84_hex-float.c: New file.
* scaffold/tinycc/84_hex-float.expect: New file.
* scaffold/tinycc/85_asm-outside-function.c: New file.
* scaffold/tinycc/85_asm-outside-function.expect: New file.
* scaffold/tinycc/86_memory-model.c: New file.
* scaffold/tinycc/86_memory-model.expect: New file.
* scaffold/tinycc/87_dead_code.c: New file.
* scaffold/tinycc/87_dead_code.expect: New file.
* scaffold/tinycc/88_codeopt.c: New file.
* scaffold/tinycc/88_codeopt.expect: New file.
* scaffold/tinycc/89_nocode_wanted.c: New file.
* scaffold/tinycc/89_nocode_wanted.expect: New file.
* scaffold/tinycc/90_struct-init.c: New file.
* scaffold/tinycc/90_struct-init.expect: New file.
* scaffold/tinycc/91_ptr_longlong_arith32.c: New file.
* scaffold/tinycc/91_ptr_longlong_arith32.expect: New file.
* scaffold/tinycc/92_enum_bitfield.c: New file.
* scaffold/tinycc/92_enum_bitfield.expect: New file.
* scaffold/tinycc/93_integer_promotion.c: New file.
* scaffold/tinycc/93_integer_promotion.expect: New file.
* scaffold/tinycc/COPYING: New file.
* scaffold/tinycc/LICENSE: New file.

include
2017-07-26 11:36:07 +02:00
Jan Nieuwenhuizen 64db2eaf7d test: Split-up Mescc scaffold test.
* make.scm (check-scaffold, check-scaffold-tests): New targets.
* mlibc/include/00-test.i: New file.
* mlibc/include/30-test.i: New file.
* mlibc/mini-libc-mes.c (puts): New function.
* scaffold/tests/00-exit-0.c: : New file.
* scaffold/tests/01-return-0.c: : New file.
* scaffold/tests/02-return-1.c: : New file.
* scaffold/tests/03-call.c: : New file.
* scaffold/tests/04-call-0.c: : New file.
* scaffold/tests/05-call-1.c: : New file.
* scaffold/tests/06-call-!1.c: : New file.
* scaffold/tests/10-if-0.c: : New file.
* scaffold/tests/11-if-1.c: : New file.
* scaffold/tests/12-if-==.c: : New file.
* scaffold/tests/13-if-!=.c: : New file.
* scaffold/tests/14-if-goto.c: : New file.
* scaffold/tests/15-if-!f.c: : New file.
* scaffold/tests/16-if-t.c: : New file.
* scaffold/tests/20-while.c: : New file.
* scaffold/tests/21-char[].c: : New file.
* scaffold/tests/22-while-char[].c: : New file.
* scaffold/tests/30-strlen.c: : New file.
* scaffold/tests/31-eputs.c: : New file.
* scaffold/tests/32-compare.c: : New file.
* scaffold/tests/33-and-or.c: : New file.
* scaffold/tests/34-pre-post.c: : New file.
* scaffold/tests/35-compare-char.c: : New file.
* scaffold/tests/36-compare-arithmetic.c: : New file.
* scaffold/tests/37-compare-assign.c: : New file.
* scaffold/tests/38-compare-call.c: : New file.
* scaffold/tests/40-if-else.c: : New file.
* scaffold/tests/41-?.c: : New file.
* scaffold/tests/42-goto-label.c: : New file.
* scaffold/tests/43-for-do-while.c: : New file.
* scaffold/tests/44-switch.c: : New file.
* scaffold/tests/45-void-call.c: : New file.
* scaffold/tests/50-assert.c: : New file.
* scaffold/tests/51-strcmp.c: : New file.
* scaffold/tests/52-itoa.c: : New file.
* scaffold/tests/53-strcpy.c: : New file.
* scaffold/tests/54-argv.c: : New file.
* scaffold/tests/60-math.c: : New file.
* scaffold/tests/61-array.c: : New file.
* scaffold/tests/63-struct-cell.c: : New file.
* scaffold/tests/64-make-cell.c: : New file.
* scaffold/tests/65-read.c: : New file.
* scaffold/tests/66-struct-array.c: : New file.
* scaffold/t.c: Remove.
* scaffold/t-tcc.c: Remove.
2017-07-09 09:24:07 +02:00
Jan Nieuwenhuizen 637c40aeb9 mescc: Avoid warnings in recursve functions.
* module/language/c99/compiler.mes (expr->accu): Avoid warnings in recursve functions.
2017-07-09 11:01:30 +02:00
Jan Nieuwenhuizen f8865ab276 mescc: undefine __GNUC__.
* module/language/c99/compiler.mes (c99-input->full-ast): Remove
  __GNUC__=0.  Should help compiling pcc, libguile/eval.c.
2017-07-09 09:26:04 +02:00
Jan Nieuwenhuizen ebb15c72a3 mescc: Support stdarg.
* mlibc/include/stdarg.h (va_list): New type.
  (va_start, va_arg, va_end, va_copy): New macro.
  (vprintf): New declaration.
* mlibc/libc-mes.c (vprintf): New function.
  (printf): Rewrite using vprintf.
* module/language/c99/compiler.mes (expr->accu, expr->accu*): Handle
  any array.  Limitation: element size must be 4/sizeof (expression).
  (make-type): Add value pointer to type.
  (type:type, type:size, type:pointer, type:description): New functions.
  (ast->info): Handle typedef with pointer.
2017-07-05 18:48:08 +02:00
Jan Nieuwenhuizen fa4fdad623 build: Remove make.
* GNUmakefile: trivial convenience-frontend to ./make.scm
* make/*.make: Remove.
* */*.make: Remove.
2017-07-02 12:03:29 +02:00
Jan Nieuwenhuizen 83a43b81b3 mescc: Produce M1 output instead of hex2.
Use: ./make.scm [TARGET]
     ./make.scm check

* stage0/x86.M1: New file.
* mlibc/mini-libc-mes.c (exit, write): Use M1 instead of .byte.
* mlibc/libc-mes.c (_start, exit, read, write, open, access, brk,
  fsync, printf): Use M1 instead of .byte.
* module/mes/as-i386.mes: Use M1.
* module/mes/make.scm: New file.
* make.scm: New file.
* guile/guix/records.scm: New File.
* guile/guix/shell-utils.scm: New file.
* module/mes/M1.mes: Rename from hex2.mes.
* module/mes/M1.scm: Rename from hex2.scm.
* scripts/mescc.mes: Update callers.
* guile/mescc.scm: Update callers.
2017-07-02 16:25:14 +02:00
Jan Nieuwenhuizen 03ecebd594 mescc: Add headers for guile:eval.c.
* mlibc/include/alloca.h: New file.
* mlibc/include/stdint.h: New file.
* mlibc/include/inttypes.h: Remove definitionss, include stdint.h.
2017-06-18 17:54:33 +02:00
Jan Nieuwenhuizen cf7211e8a7 mescc: Add headers for 8cc.
* mlibc/include/libgen.h: New file.
* mlibc/include/locale.hh: New file.
* mlibc/include/stdbool.h: New file.
* mlibc/include/stdnoreturn.h: New file.
* mlibc/include/time.h: Add time_t.
2017-06-18 16:12:15 +02:00
Jan Nieuwenhuizen e2fef673a2 guix: Add missing module.
* guix.scm: Use (guix download).  Fixes compilation with mescc-tools included.
2017-06-27 07:53:29 +02:00
Jan Nieuwenhuizen e4d188907d guix: Add mescc-tools.
* guix.scm (mescc-tools): New variable.  Fixes using guix.scm.  Thanks paroneayea!
2017-06-26 20:29:49 +02:00
Jan Nieuwenhuizen f92470a1f0 Release 0.8.
* configure (VERSION): Bump.
2017-06-25 18:36:25 +02:00
Jan Nieuwenhuizen bf4608ff94 build: Release update.
* configure (main): Make hex2 required.
* guix.scm (mes): Add mescc-tools to propagated-inputs.  Update commit, hash.
2017-06-25 17:40:38 +02:00
Jan Nieuwenhuizen 97951fd47e doc: Release update.
* NEWS: Update.
* INSTALL: Update.
* HACKING: Update.
* doc/ANNOUNCE-0.8: New file.
2017-06-08 20:39:24 +02:00
Jan Nieuwenhuizen c44df4ed8a mescc: Remove ELF creation, handled by hex2 now.
* module/language/c99/compiler.scm (make-global, global:type,
  global:pointer, global:value): Move from elf-util.mes
* module/mes/as.mes: New file.
* module/mes/as-i386.mes: Use it.
* module/mes/as-i386.scm: Use it.
* module/mes/elf-util.mes: Remove.
* module/mes/elf.mes (elf32-addr, elf32-half, elf32-off, elf32-word,
  make-elf, write-any, object->elf): Remove
  (hex2->elf): New function with dummy implementation.
* module/mes/elf.scm: Update exports.
* module/mes/hex2.mes (object->elf): New function.
* module/mes/hex2.scm: Export it.
2017-06-25 09:26:25 +02:00
Jan Nieuwenhuizen 1de0f33020 mescc: Produce object files in hex2 format, remove hex3.
* GNUmakefile (HEX2_FLAGS): New variable.
* make/mescc-guile.make ($(OUT)/$(TARGET)): Use HEX2 for linking.
* make/mescc-mes.make ($(OUT)/$(TARGET)): Likewise.
* guile/mescc.scm (main): Remove hex3 support.
* scripts/mescc.mes (main): Likewise.
* stage0/elf32-0header.hex2: New file, merging of elf32.hex and elf32-header.hex2.
* stage0/elf-0footer.hex2: New file.
* stage0/elf32-header.hex2: Rename from elf32-header-exit-42.hex2,
  repurpose as generic debug heder.
* stage0/elf32-footer-single-main.hex2: Rename from elf32-footer-exit-42.hex2,
  repurpose as generic debug footer for single-main source.
* stage0/exit-42.c: New file.
* stage0/stage0.make ($(OUT)/0exit-42): Test 0header, 0footer.
  ($(OUT)/exit-42.guile): Test generic debug header, footer.
* stage0/elf32.hex2: Remove.
2017-06-25 09:33:55 +02:00
Jan Nieuwenhuizen bb0f82d5aa build: Add stage0 hex2 test.
* configure (HEX2): Check for hex2 from MESCC_tools.
* INSTALL: Mention it.
* GNUmakefile (SUBDIRS): Add stage0.
* make/check-cc.make: New file.
* make/check.make: Remove CC-not-empty guard.
* scaffold/scaffold.make: Update CC check targets.
2017-06-23 20:18:09 +02:00
Jan Nieuwenhuizen afb5c207a9 stage0: Move to-be-generated part of body to footer.
* stage0/elf32-footer-exit-42.hex2: Add ELF_str, ELF_sym from body.
* stage0/elf32-body-exit-42.hex2: Remove ELF_str, ELF_sym.
2017-06-21 07:05:26 +02:00