more parser

This commit is contained in:
2024-12-31 19:14:12 +02:00
parent 3264d1747e
commit 85dfbe9d09
4 changed files with 136 additions and 126 deletions

View File

@@ -77,14 +77,15 @@ pub fn build(b: *std.Build) !void {
test_exe.addIncludePath(b.path("."));
test_step.dependOn(&b.addRunArtifact(test_exe).step);
const lint_step = b.step("lint", "Run linters");
const clang_format = b.addSystemCommand(&.{"clang-format"});
clang_format.addArgs(&.{ "-Werror", "-i" });
const fmt_step = b.step("fmt", "clang-format");
const clang_format = b.addSystemCommand(&.{ "clang-format", "-Werror", "-i" });
for (all_c_files ++ headers) |f| clang_format.addFileArg(b.path(f));
lint_step.dependOn(&clang_format.step);
fmt_step.dependOn(&clang_format.step);
const clang_analyze = b.addSystemCommand(&.{"clang"});
clang_analyze.addArgs(&.{
const lint_step = b.step("lint", "Run linters");
const clang_analyze = b.addSystemCommand(&.{
"clang",
"--analyze",
"--analyzer-output",
"text",
@@ -94,13 +95,19 @@ pub fn build(b: *std.Build) !void {
for (all_c_files) |cfile| clang_analyze.addFileArg(b.path(cfile));
lint_step.dependOn(&clang_analyze.step);
const gcc_analyze = b.addSystemCommand(&.{"gcc"});
gcc_analyze.addArgs(&.{ "--analyzer", "-Werror", "-o", "/dev/null" });
const gcc_analyze = b.addSystemCommand(&.{
"gcc",
"--analyzer",
"-Wno-analyzer-malloc-leak", // TODO remove when wiring is complete and everything's free()d
"-Werror",
"-o",
"/dev/null",
});
for (all_c_files) |cfile| gcc_analyze.addFileArg(b.path(cfile));
lint_step.dependOn(&gcc_analyze.step);
const cppcheck = b.addSystemCommand(&.{"cppcheck"});
cppcheck.addArgs(&.{
const cppcheck = b.addSystemCommand(&.{
"cppcheck",
"--quiet",
"--error-exitcode=1",
"--check-level=exhaustive",