diff --git a/build.zig b/build.zig index a63512cb20..e19d3a2a90 100644 --- 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 index e85d73f758..593f8a447d 100644 --- a/stage0/dump.h +++ b/stage0/dump.h @@ -6,14 +6,14 @@ #include 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 index 2d920bb655..0d8bfbf3d7 100644 --- 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 index 9cc60fc7b2..30571eef79 100644 --- 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;