From d5872dfe71b0633877e8dccc74ac1941bd4039a1 Mon Sep 17 00:00:00 2001 From: Henner Zeller Date: Tue, 11 Mar 2025 17:13:56 -0700 Subject: [PATCH 1/2] Prepare `.clang-tidy` to be used with clang-tidy 19 Disable some rules we're not interested in. --- .clang-tidy | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.clang-tidy b/.clang-tidy index 5378d1d..1a65418 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -15,6 +15,7 @@ Checks: > -readability-identifier-length, -readability-implicit-bool-conversion, -readability-magic-numbers, + -readability-math-missing-parentheses, -readability-named-parameter, -readability-static-definition-in-anonymous-namespace, -readability-uppercase-literal-suffix, @@ -30,12 +31,14 @@ Checks: > -bugprone-narrowing-conversions, modernize-*, -modernize-avoid-c-arrays, + -modernize-concat-nested-namespaces, -modernize-make-unique, -modernize-use-auto, + -modernize-use-designated-initializers, -modernize-use-nodiscard, + -modernize-use-std-format, -modernize-use-std-print, -modernize-use-trailing-return-type, - -modernize-concat-nested-namespaces, misc-*, -misc-no-recursion, -misc-unused-parameters, From 1471ade12938016f60a57a0f1d348bfd2e83b42b Mon Sep 17 00:00:00 2001 From: Henner Zeller Date: Tue, 11 Mar 2025 17:14:48 -0700 Subject: [PATCH 2/2] shell.nix: allow to use different clang-format and clang-tidy versions. For `clang-format`, we'd like to be a bit more conservative and use a mature version that does not flip-flop on llvm versions. For `clang-tidy` we generally want to be at the latest version. For now, keep it at the same version as before (18) as we first need to address the new findings. --- shell.nix | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/shell.nix b/shell.nix index a7204ee..b6022a4 100644 --- a/shell.nix +++ b/shell.nix @@ -1,23 +1,30 @@ { pkgs ? import {} }: let bazel = pkgs.bazel_7; - clangTools = pkgs.clang-tools_18; + + # There is too much volatility between even micro-versions of + # newer clang-format. Use slightly older version for now. + clang_for_formatting = pkgs.llvmPackages_18.clang-tools; + + # clang tidy: use latest. + clang_for_tidy = pkgs.llvmPackages_18.clang-tools; in pkgs.mkShell { - name = "prjxtream"; + name = "fpga-assembler"; packages = with pkgs; [ git bazel jdk bash - bant gdb # For clang-tidy and clang-format. - clangTools + clang_for_formatting + clang_for_tidy # For buildifier, buildozer. bazel-buildtools + bant # Profiling and sanitizers. linuxPackages_latest.perf @@ -26,10 +33,6 @@ pkgs.mkShell { valgrind ]; - # Expose as env variables the path to clang tools. - CLANG_TIDY = "${clangTools}/bin/clang-tidy"; - CLANG_FORMAT = "${clangTools}/bin/clang-format"; - - # Override .bazelversion. We only care to have bazel 7. - USE_BAZEL_VERSION = "${bazel.version}"; + CLANG_TIDY="${clang_for_tidy}/bin/clang-tidy"; + CLANG_FORMAT="${clang_for_formatting}/bin/clang-format"; }