From 4e2112e165fdd94dee58378e3ea32892f3710cd7 Mon Sep 17 00:00:00 2001 From: Kacper Date: Tue, 9 Dec 2025 22:00:45 +0100 Subject: Make better diagnostics for clangd --- .clang-tidy | 13 +++++++++---- .clangd | 15 +++++++++++++++ makefile | 12 +++--------- 3 files changed, 27 insertions(+), 13 deletions(-) create mode 100644 .clangd diff --git a/.clang-tidy b/.clang-tidy index a06e38d7..40ceb20b 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,12 +1,17 @@ --- -Checks: "clang-diagnostic-*,clang-analyzer-*,-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling" +Checks: > + clang-analyzer-*, + bugprone-*, + llvm-*, + performance-*, + concurrency-*, + -bugprone-reserved-identifier, + -llvm-header-guard + WarningsAsErrors: "" HeaderFileExtensions: - h ImplementationFileExtensions: - c SystemHeaders: false -CheckOptions: - - key: clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling - value: "0" ... diff --git a/.clangd b/.clangd new file mode 100644 index 00000000..551d2c03 --- /dev/null +++ b/.clangd @@ -0,0 +1,15 @@ +CompileFlags: + Add: [-xc] + +Diagnostics: + ClangTidy: + FastCheckFilter: Strict + Add: + - clang-analyzer-* + - bugprone-* + - llvm-* + - performance-* + - concurrency-* + Remove: + - bugprone-reserved-identifier + - llvm-header-guard diff --git a/makefile b/makefile index 8c85fae1..ed552e29 100644 --- a/makefile +++ b/makefile @@ -144,7 +144,7 @@ defconfig: $(Q)$(MAKE) -f scripts/kconfig/makefile defconfig include-what-you-use: compile_commands.json - $(Q)iwyu_tool.py -p. -j$(nproc) -- -Xiwyu --update_comments -Xiwyu --transitive_includes_only -Xiwyu --no_internal_mappings | \ + $(Q)iwyu_tool.py -p. -j4 -- -Xiwyu --update_comments -Xiwyu --transitive_includes_only -Xiwyu --no_internal_mappings | \ fix_includes.py --comments \ --quoted_includes_first \ --nosafe_headers \ @@ -152,14 +152,8 @@ include-what-you-use: compile_commands.json --reorder clang-tidy: compile_commands.json - $(Q)run-clang-tidy.py \ - -p . \ - -fix \ - -fix-errors \ - -header-filter='.*' \ - -source-filter='.*\.(c|h)$$' \ - -exclude-header-filter='(scripts/|dtoa|linux|arch|bits)' \ - -j $(shell nproc) + $(Q)clang-tidy -header-filter=.* -p=. -fix -fix-errors $(shell find . -name '*.c' -o -name '*.h' | grep -v './scripts/\|dtoa\|linux\|arch\|bits') \ + --export-fixes=clang-tidy-fixes.yaml clang-format: $(Q)clang-format -i $(shell find . -name '*.c' -o -name '*.h' | grep -v './scripts/') -- cgit v1.2.3