Commit Graph

11 Commits

Author SHA1 Message Date
a3f64d280a stage0: remove GNU C extensions for strict C11 compliance
Replace GNU statement expressions ({...}) in common.h with a static
inline function and do...while(0) macros. Expand case range expressions
(case 'a' ... 'z') in tokenizer.c to individual case labels. Replace
empty initializer braces {} with {0} in parser.c. Add a dummy member
to the empty struct in ast.h. Add -pedantic to zig0_cflags in build.zig
to prevent future regressions.

zig0 now compiles with any C11-conforming compiler, not just those
supporting GNU extensions. This enables bootstrapping with MSVC,
cproc, and other strict C11 compilers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-25 22:32:10 +00:00
9d438d5674 cppcheck: remove all suppressions, fix all warnings
Split cppcheck into per-file checks (warning,style,performance,portability)
and a combined unusedFunction check across all C files. Remove dead code
(addExtraU32, rvalueDiscard, wipMembersNextDecl, wipMembersBodiesAppend,
findNextContainerMember, NodeContainerField). Wire up zig0Run to actually
call astParse/astGen and print stats, eliminating unusedFunction warnings
for the public API.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 18:13:52 +00:00
0ac1c87225 unify error handling: SET_ERROR(ctx, msg) for both parser and astgen
Replace parser's fail() and astgen's flag-only SET_ERROR(ag) with a
single SET_ERROR(ctx, msg) macro in common.h that stores the error
message in ctx->err_buf and sets ctx->has_compile_errors.  Both Parser
and AstGenCtx now carry the same err_buf[ERR_BUF_SIZE] field.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 17:02:00 +00:00
759bdcde24 parser: add warn, assign destructure, fix statement bodies; enable CodeGen.zig
- Add warn() for non-fatal parse errors (like Zig's Parse.warn)
- Implement finishAssignDestructureExpr for destructuring assignments
- Use parseBlockExpr instead of parseBlock in for/while statement bodies
- Use parseSingleAssignExpr in switch prongs
- Enable x86_64/CodeGen.zig corpus entry

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 12:17:18 +00:00
7d52ad5e97 parser: fix extra_data write ordering in parseSwitchProng for multi-item switch cases
Enables 39 files from compiler/aro/.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 22:36:07 +00:00
1377fae4cd astgen: fix InternPool.zig — parser fallthrough for struct/enum/union, add @compileLog, fix @"..." escape scanning
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 16:18:20 +00:00
010a7109ca fix labeled switch: parser passes is_labeled flag, init GenZir continue_block/label_token to UINT32_MAX
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 14:01:25 +00:00
8095b097d2 parser: add anyframe, labeled switch, fix inline fallthrough
- Implement anyframe and anyframe->T parsing in parseTypeExpr and
  parsePrimaryTypeExpr (was failing with unsupported error).
- Add labeled switch support: identifier:switch in parsePrimaryExpr
  and parsePrimaryTypeExpr, with main_token = switch_token - 2.
- Fix TOKEN_KEYWORD_INLINE fallthrough into TOKEN_PERIOD case in
  parsePrimaryTypeExpr; handle it separately expecting for/while.

Reduces corpus test failures from 20 to 7.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 20:31:22 +00:00
cb09cd5dfa astgen: add inline switch prong parsing and float literal support
- parser.c: Handle TOKEN_KEYWORD_INLINE in parseSwitchProng, producing
  AST_NODE_SWITCH_CASE_INLINE_ONE / AST_NODE_SWITCH_CASE_INLINE nodes.
  This fixes parsing of multi_array_list.zig which uses `inline else`.
- astgen.c: Implement float literal parsing in numberLiteral using
  strtold with f64 round-trip check. Add addFloat helper and addPlNodeQuad
  for float128 emission. Extend token scanning to include exponent markers.
- multi_array_list.zig still skipped: remaining diffs in bool_not,
  bool_br_and, ret_is_non_err.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 19:55:52 +00:00
53790d5aeb Merge commit '0b12e027a3628e26a765126d9937a2366b638ff3' into zig0-0.15.1 2026-02-14 00:07:36 +02:00
0782a5a952 Add 'stage0/' from commit 'b3d106ec971300a9c745f4681fab3df7518c4346'
git-subtree-dir: stage0
git-subtree-mainline: 3db960767d
git-subtree-split: b3d106ec97
2026-02-13 23:32:08 +02:00