This commit is contained in:
2026-02-20 10:30:47 +02:00
parent a787650d54
commit b359a8d5f8
4 changed files with 21 additions and 10 deletions

View File

@@ -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",

View File

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

View File

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

View File

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