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>
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>
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>
- 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>
- 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>
- 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>