commit 689b6b901dedd560122d12d951f92e711a68c679 (tree)
parent e07d3e41d48654838826850cad1b9f624b9c3d59
Author: Motiejus Jakštys <motiejus@jakstys.lt>
Date: Fri, 20 Feb 2026 10:30:47 +0200
fmt
Diffstat:
4 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/build.zig b/build.zig
@@ -736,6 +736,19 @@ pub fn build(b: *std.Build) !void {
clang_analyze.expectExitCode(0);
lint_zig0.dependOn(&clang_analyze.step);
+ // Uses >20GiB of memory, disabled for now.
+ // const gcc_analyze = b.addSystemCommand(&.{
+ // "gcc",
+ // "-c",
+ // "--analyzer",
+ // "-Werror",
+ // "-o",
+ // "/dev/null",
+ // });
+ // gcc_analyze.addFileArg(b.path(b.fmt("stage0/{s}", .{cfile})));
+ // gcc_analyze.expectExitCode(0);
+ // lint_zig0.dependOn(&gcc_analyze.step);
+
const cppcheck = b.addSystemCommand(&.{
"cppcheck",
"--quiet",
diff --git a/stage0/dump.h b/stage0/dump.h
@@ -6,14 +6,14 @@
#include <stdint.h>
typedef struct {
- void* items; // SemaFuncAir* (from sema.h), owned by Zig allocator
+ void* items; // SemaFuncAir* (from sema.h), owned by Zig allocator
uint32_t len;
} ZigCompileAirResult;
#define ZIG_COMPILE_ERR_BUF_SIZE 256
-extern ZigCompileAirResult zig_compile_air(const char* src_path, const char* module_root,
- char err_buf[ZIG_COMPILE_ERR_BUF_SIZE]);
+extern ZigCompileAirResult zig_compile_air(const char* src_path,
+ const char* module_root, char err_buf[ZIG_COMPILE_ERR_BUF_SIZE]);
extern void zig_compile_air_free(ZigCompileAirResult* result);
#endif
diff --git a/stage0/sema.c b/stage0/sema.c
@@ -608,10 +608,8 @@ static bool analyzeBodyInner(
// Inside a function body: emit ret instruction.
AirInstData ret_data;
memset(&ret_data, 0, sizeof(ret_data));
- ret_data.un_op.operand
- = AIR_REF_FROM_IP(IP_INDEX_VOID_VALUE);
- (void)blockAddInst(
- block, AIR_INST_RET, ret_data);
+ ret_data.un_op.operand = AIR_REF_FROM_IP(IP_INDEX_VOID_VALUE);
+ (void)blockAddInst(block, AIR_INST_RET, ret_data);
}
return false;
@@ -620,8 +618,8 @@ static bool analyzeBodyInner(
case ZIR_INST_FUNC:
case ZIR_INST_FUNC_INFERRED:
zirFunc(sema, block, inst);
- instMapPut(&sema->inst_map, inst,
- AIR_REF_FROM_IP(IP_INDEX_VOID_TYPE));
+ instMapPut(
+ &sema->inst_map, inst, AIR_REF_FROM_IP(IP_INDEX_VOID_TYPE));
i++;
continue;
diff --git a/stage0/sema.h b/stage0/sema.h
@@ -148,7 +148,7 @@ typedef struct Sema {
SemaFuncAirList* func_air_list;
// Current declaration name (NullTerminatedString index) and linkage,
// set by zirStructDecl while iterating declarations.
- uint32_t cur_decl_name; // index into code.string_bytes; 0 = none
+ uint32_t cur_decl_name; // index into code.string_bytes; 0 = none
bool cur_decl_is_export;
} Sema;