From 71f570ee3d398546b10bf384da42f3cce03fc85d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Thu, 12 Feb 2026 13:51:53 +0200 Subject: [PATCH] lint per file gives paralellism --- build.zig | 76 +++++++++++++++++++++++++++++-------------------------- parser.c | 1 + 2 files changed, 41 insertions(+), 36 deletions(-) diff --git a/build.zig b/build.zig index 936d7b9746..3cf20fc3af 100644 --- a/build.zig +++ b/build.zig @@ -71,44 +71,48 @@ pub fn build(b: *std.Build) !void { const lint_step = b.step("lint", "Run linters"); - const clang_analyze = b.addSystemCommand(&.{ - "clang", - "--analyze", - "--analyzer-output", - "text", - "-Wno-unused-command-line-argument", - "-Werror", - }); - for (all_c_files) |cfile| clang_analyze.addFileArg(b.path(cfile)); - clang_analyze.expectExitCode(0); - lint_step.dependOn(&clang_analyze.step); + for (all_c_files) |cfile| { + const clang_analyze = b.addSystemCommand(&.{ + "clang", + "--analyze", + "--analyzer-output", + "text", + "-Wno-unused-command-line-argument", + "-Werror", + }); + clang_analyze.addFileArg(b.path(cfile)); + clang_analyze.expectExitCode(0); + lint_step.dependOn(&clang_analyze.step); - const gcc_analyze = b.addSystemCommand(&.{ - "gcc", - "--analyzer", - "-Werror", - "-o", - "/dev/null", - }); - for (all_c_files) |cfile| gcc_analyze.addFileArg(b.path(cfile)); - gcc_analyze.expectExitCode(0); - lint_step.dependOn(&gcc_analyze.step); + const gcc_analyze = b.addSystemCommand(&.{ + "gcc", + "-c", + "--analyzer", + "-Werror", + "-o", + "/dev/null", + }); + gcc_analyze.addFileArg(b.path(cfile)); + gcc_analyze.expectExitCode(0); + lint_step.dependOn(&gcc_analyze.step); - const cppcheck = b.addSystemCommand(&.{ - "cppcheck", - "--quiet", - "--error-exitcode=1", - "--check-level=exhaustive", - "--enable=all", - "--inline-suppr", - "--suppress=missingIncludeSystem", - "--suppress=checkersReport", - "--suppress=unusedFunction", // TODO remove after plumbing is done - "--suppress=unusedStructMember", // TODO remove after plumbing is done - }); - for (all_c_files) |cfile| cppcheck.addFileArg(b.path(cfile)); - cppcheck.expectExitCode(0); - lint_step.dependOn(&cppcheck.step); + const cppcheck = b.addSystemCommand(&.{ + "cppcheck", + "--quiet", + "--error-exitcode=1", + "--check-level=exhaustive", + "--enable=all", + "--inline-suppr", + "--suppress=missingIncludeSystem", + "--suppress=checkersReport", + "--suppress=unusedFunction", // TODO remove after plumbing is done + "--suppress=unusedStructMember", // TODO remove after plumbing is done + "--suppress=unmatchedSuppression", + }); + cppcheck.addFileArg(b.path(cfile)); + cppcheck.expectExitCode(0); + lint_step.dependOn(&cppcheck.step); + } const all_step = b.step("all", "Run fmt check, lint, and tests with all compilers"); all_step.dependOn(lint_step); diff --git a/parser.c b/parser.c index b664957a90..bb602cf0e2 100644 --- a/parser.c +++ b/parser.c @@ -1,3 +1,4 @@ + #include "common.h" #include