From 47638706a37534ae9bc7ac4c57ddb9fb2b44fef0 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sun, 12 Feb 2023 17:41:54 +0100 Subject: build: treat clang-tidy warnings as errors (#22238) --- .clang-tidy | 1 + 1 file changed, 1 insertion(+) (limited to '.clang-tidy') diff --git a/.clang-tidy b/.clang-tidy index 1fe87ba501..1c7d13e2b0 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,3 +1,4 @@ +WarningsAsErrors: '*' Checks: > -*, -- cgit From b04286a187d57c50f01cd36cd4668b7a69026579 Mon Sep 17 00:00:00 2001 From: bfredl Date: Sun, 22 Nov 2020 10:10:37 +0100 Subject: feat(extmark): support proper multiline ranges The removes the previous restriction that nvim_buf_set_extmark() could not be used to highlight arbitrary multi-line regions The problem can be summarized as follows: let's assume an extmark with a hl_group is placed covering the region (5,0) to (50,0) Now, consider what happens if nvim needs to redraw a window covering the lines 20-30. It needs to be able to ask the marktree what extmarks cover this region, even if they don't begin or end here. Therefore the marktree needs to be augmented with the information covers a point, not just what marks begin or end there. To do this, we augment each node with a field "intersect" which is a set the ids of the marks which overlap this node, but only if it is not part of the set of any parent. This ensures the number of nodes that need to be explicitly marked grows only logarithmically with the total number of explicitly nodes (and thus the number of of overlapping marks). Thus we can quickly iterate all marks which overlaps any query position by looking up what leaf node contains that position. Then we only need to consider all "start" marks within that leaf node, and the "intersect" set of that node and all its parents. Now, and the major source of complexity is that the tree restructuring operations (to ensure that each node has T-1 <= size <= 2*T-1) also need to update these sets. If a full inner node is split in two, one of the new parents might start to completely overlap some ranges and its ids will need to be moved from its children's sets to its own set. Similarly, if two undersized nodes gets joined into one, it might no longer completely overlap some ranges, and now the children which do needs to have the have the ids in its set instead. And then there are the pivots! Yes the pivot operations when a child gets moved from one parent to another. --- .clang-tidy | 1 + 1 file changed, 1 insertion(+) (limited to '.clang-tidy') diff --git a/.clang-tidy b/.clang-tidy index 1c7d13e2b0..e85ebb6758 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -41,3 +41,4 @@ Checks: > -readability-redundant-declaration, -readability-redundant-function-ptr-dereference, -readability-suspicious-call-argument, + -readability-non-const-parameter, -- cgit From 9f58867935362375101a52d6039d27c2ce4dce75 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sat, 23 Sep 2023 15:24:28 +0200 Subject: refactor(clang-tidy): ignore warnings from clang-tidy 17 --- .clang-tidy | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to '.clang-tidy') diff --git a/.clang-tidy b/.clang-tidy index e85ebb6758..3e931149d6 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -21,15 +21,21 @@ Checks: > -bugprone-sizeof-expression, -bugprone-suspicious-include, -bugprone-suspicious-memory-comparison, + -bugprone-swapped-arguments, + -bugprone-switch-missing-default-case, + -bugprone-unsafe-functions, -bugprone-unused-return-value, -google-readability-braces-around-statements, -google-readability-function-size, + -misc-header-include-cycle, + -misc-include-cleaner, -misc-misplaced-const, -misc-no-recursion, -misc-unused-parameters, -modernize-macro-to-enum, -performance-no-int-to-ptr, -readability-avoid-const-params-in-decls, + -readability-avoid-unconditional-preprocessor-if, -readability-braces-around-statements, -readability-else-after-return, -readability-function-cognitive-complexity, @@ -38,7 +44,7 @@ Checks: > -readability-isolate-declaration, -readability-magic-numbers, -readability-misleading-indentation, + -readability-non-const-parameter, -readability-redundant-declaration, -readability-redundant-function-ptr-dereference, -readability-suspicious-call-argument, - -readability-non-const-parameter, -- cgit From 4d757bbfbb6c0e5280563779c4b4ee1ce9142cf0 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sat, 4 Nov 2023 12:25:50 +0100 Subject: refactor: combine regexp files regext_bt.c and regexp_nfa.c are inlined into regexp.c instead of included as a header. This makes developer tools like clang-tidy and clangd be able to understand the code better. --- .clang-tidy | 1 - 1 file changed, 1 deletion(-) (limited to '.clang-tidy') diff --git a/.clang-tidy b/.clang-tidy index 3e931149d6..237c7b71b8 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -19,7 +19,6 @@ Checks: > -bugprone-not-null-terminated-result, -bugprone-reserved-identifier, -bugprone-sizeof-expression, - -bugprone-suspicious-include, -bugprone-suspicious-memory-comparison, -bugprone-swapped-arguments, -bugprone-switch-missing-default-case, -- cgit From 488038580934f301c1528a14548ec0cabd16c2cd Mon Sep 17 00:00:00 2001 From: dundargoc Date: Fri, 10 Nov 2023 14:06:04 +0100 Subject: build: adjust clang-tidy warning exclusion logic Enable all clang-tidy warnings by default instead of disabling them. This ensures that we don't miss useful warnings on each clang-tidy version upgrade. A drawback of this is that it will force us to either fix or adjust the warnings as soon as possible. --- .clang-tidy | 90 ++++++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 56 insertions(+), 34 deletions(-) (limited to '.clang-tidy') diff --git a/.clang-tidy b/.clang-tidy index 237c7b71b8..927909cf8d 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,49 +1,71 @@ -WarningsAsErrors: '*' +WarningsAsErrors: '*,-clang-diagnostic-unused-function' Checks: > - -*, + Enable all warnings by default. This ensures we don't miss new and useful + warnings when a new version of clang-tidy is dropped. - bugprone-*, - google-*, - misc-*, - modernize-*, - performance-*, - portability-*, - readability-*, + IMPORTANT + clang-tidy doesn't support comments but we can simulate comments by just + writing text directly here. These are then interpreted as warnings and will + be dropped. As long as you start every sentence with a capital letter and + don't use commas in your "comments" you should be fine, + *, + Untriaged warnings. Please categorize them accordingly if you find a relevant + section for it, -bugprone-assignment-in-if-condition, - -bugprone-branch-clone, - -bugprone-easily-swappable-parameters, -bugprone-implicit-widening-of-multiplication-result, - -bugprone-macro-parentheses, - -bugprone-narrowing-conversions, -bugprone-not-null-terminated-result, - -bugprone-reserved-identifier, - -bugprone-sizeof-expression, -bugprone-suspicious-memory-comparison, - -bugprone-swapped-arguments, -bugprone-switch-missing-default-case, - -bugprone-unsafe-functions, - -bugprone-unused-return-value, - -google-readability-braces-around-statements, - -google-readability-function-size, - -misc-header-include-cycle, - -misc-include-cleaner, - -misc-misplaced-const, - -misc-no-recursion, + -cert-env33-c, + -cert-err33-c, + -cert-err34-c, + -concurrency-mt-unsafe, + -cppcoreguidelines-narrowing-conversions, + + Warnings that may be useful, but are too inconsistent to enable by default + May yield useful results with some manual triaging, + -bugprone-branch-clone, + -bugprone-macro-parentheses, + -bugprone-sizeof-expression, + -hicpp-multiway-paths-covered, + -hicpp-signed-bitwise, -misc-unused-parameters, -modernize-macro-to-enum, - -performance-no-int-to-ptr, - -readability-avoid-const-params-in-decls, - -readability-avoid-unconditional-preprocessor-if, - -readability-braces-around-statements, -readability-else-after-return, - -readability-function-cognitive-complexity, -readability-function-size, - -readability-identifier-length, -readability-isolate-declaration, + + Warnings that are rarely useful, + -altera-*, Checks related to OpenCL programming for FPGAs. Not relevant, + -android-*, + -bugprone-easily-swappable-parameters, + -bugprone-swapped-arguments, + -clang-analyzer-*, Already covered by the cmake target "clang-analyzer", + -cppcoreguidelines-avoid-non-const-global-variables, + -cppcoreguidelines-init-variables, + -llvm-header-guard, We use #pragma once, + -llvmlibc-restrict-system-libc-headers, We want to use glibc, + -misc-header-include-cycle, Looks useful but redundant with IWYU. We may replace IWYU with this one day, + -misc-include-cleaner, Looks useful but redundant with IWYU. We may replace IWYU with this one day, + -misc-misplaced-const, + -misc-no-recursion, + -performance-no-int-to-ptr, + -readability-function-cognitive-complexity, + -readability-identifier-length, -readability-magic-numbers, - -readability-misleading-indentation, - -readability-non-const-parameter, - -readability-redundant-declaration, - -readability-redundant-function-ptr-dereference, + -readability-redundant-declaration, Conflicts with our header generation scripts, -readability-suspicious-call-argument, + + Aliases. These are just duplicates of other warnings and should always be ignored, + -bugprone-narrowing-conversions, + -cert-dcl37-c, + -cert-dcl51-cpp, + -cert-exp42-c, + -cert-flp37-c, + -cert-msc24-c, + -cert-msc33-c, + -cppcoreguidelines-avoid-magic-numbers, + -google-readability-function-size, + -hicpp-function-size, + -llvm-else-after-return, -- cgit