This is an automated email from the ASF dual-hosted git repository.

joemcdonnell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git


The following commit(s) were added to refs/heads/master by this push:
     new befa93ffa IMPALA-12730: Don't use -Weverything for clang-tidy
befa93ffa is described below

commit befa93ffa6b0fa50c614b6e24faf25443ec50d90
Author: Joe McDonnell <joemcdonn...@cloudera.com>
AuthorDate: Mon Mar 4 13:31:04 2024 -0800

    IMPALA-12730: Don't use -Weverything for clang-tidy
    
    For current clang-tidy builds, we enable -Weverything and then
    explicitly disable a couple verbose warnings. Clang-tidy uses
    these warnings to produce its clang-diagnostic-* issues.
    This gives clang-tidy the maximum flexibility to enforce any
    warning the Clang can produce, but in practice, we disable
    them via the .clang-tidy file's Checks: section.
    
    The output from a -Weverything build is enormous and hard to
    navigate. When there is a compilation issue, digging through
    the logs is arduous. Clang discourages the use of -Weverything,
    as it contains many noisy warnings.
    
    This changes the clang-tidy build to use -Wextra instead and
    shrinks the list of disabled clang-diagnostic-* issues
    accordingly.
    
    Testing:
     - Verified that bin/run_clang_tidy.sh passes
    
    Change-Id: Ib4f4cc9a6d040b90495496b2396a26f3c5189231
    Reviewed-on: http://gerrit.cloudera.org:8080/21112
    Reviewed-by: Michael Smith <michael.sm...@cloudera.com>
    Tested-by: Impala Public Jenkins <impala-public-jenk...@cloudera.com>
---
 .clang-tidy       | 41 +----------------------------------------
 be/CMakeLists.txt | 16 ++++++++--------
 2 files changed, 9 insertions(+), 48 deletions(-)

diff --git a/.clang-tidy b/.clang-tidy
index c4499f953..ea308e3b0 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -30,49 +30,10 @@ Checks: "-*,clang*,\
 -clang-analyzer-optin.performance.Padding,\
 -clang-analyzer-unix.Malloc,\
 -clang-analyzer-unix.MallocSizeof,\
--clang-diagnostic-c++1z-extensions,\
--clang-diagnostic-c++98*,\
--clang-diagnostic-cast-align,\
--clang-diagnostic-class-varargs,\
--clang-diagnostic-conversion,\
--clang-diagnostic-covered-switch-default,\
--clang-diagnostic-deprecated,\
--clang-diagnostic-disabled-macro-expansion,\
--clang-diagnostic-documentation-html,\
--clang-diagnostic-documentation-unknown-command,\
--clang-diagnostic-double-promotion,\
--clang-diagnostic-exit-time-destructors,\
--clang-diagnostic-float-conversion,\
--clang-diagnostic-float-equal,\
--clang-diagnostic-global-constructors,\
--clang-diagnostic-gnu-anonymous-struct,\
--clang-diagnostic-gnu-zero-variadic-macro-arguments,\
--clang-diagnostic-header-hygiene,\
--clang-diagnostic-missing-prototypes,\
--clang-diagnostic-missing-variable-declarations,\
--clang-diagnostic-nested-anon-types,\
--clang-diagnostic-old-style-cast,\
--clang-diagnostic-overlength-strings,\
--clang-diagnostic-packed,\
--clang-diagnostic-padded,\
--clang-diagnostic-return-type-c-linkage,\
--clang-diagnostic-shadow,\
--clang-diagnostic-shadow-field-in-constructor,\
--clang-diagnostic-shorten-64-to-32,\
 -clang-diagnostic-sign-compare,\
--clang-diagnostic-sign-conversion,\
--clang-diagnostic-switch-enum,\
--clang-diagnostic-undefined-func-template,\
--clang-diagnostic-undefined-reinterpret-cast,\
--clang-diagnostic-unreachable-code,\
--clang-diagnostic-unreachable-code-return,\
--clang-diagnostic-unused-command-line-argument,\
+-clang-diagnostic-return-type-c-linkage,\
 -clang-diagnostic-unused-local-typedef,\
 -clang-diagnostic-unused-parameter,\
--clang-diagnostic-used-but-marked-unused,\
--clang-diagnostic-vla-extension,\
--clang-diagnostic-weak-template-vtables,\
--clang-diagnostic-weak-vtables,\
 performance-*,\
 -performance-unnecessary-value-param"
 
diff --git a/be/CMakeLists.txt b/be/CMakeLists.txt
index 4532eb9e9..9accfa8b1 100644
--- a/be/CMakeLists.txt
+++ b/be/CMakeLists.txt
@@ -178,14 +178,14 @@ SET(CXX_FLAGS_TIDY "${CXX_FLAGS_TIDY} -O1")
 # Ignore assert() and DCHECK() to avoid dead code errors on "DCHECK(false); 
return
 # nullptr" in impossible default switch/case statements.
 SET(CXX_FLAGS_TIDY "${CXX_FLAGS_TIDY} -DNDEBUG")
-# Turn all warnings back on. Some will be ignored via .clang-tidy's "Checks" 
value, but
-# this allows different "Checks" settings to be used in different clang-tidy 
runs without
-# recompiling. There are two exceptions: C++98 compatibility and padding are 
not interesting
-# and excluding them dramatically reduces the output.
-SET(CXX_FLAGS_TIDY "${CXX_FLAGS_TIDY} -Wall -W -Weverything -Wno-c++98-compat 
-Wno-padded")
-# The Tidy build is so verbose (becasue of -Weverything) that it is unlikely 
to be viewed
-# in a terminal and most likely will be redirecto to less, a log file, or 
/dev/null. In
-# those places color codes just make the output harder to read.
+# Clang-tidy's clang-diagnostic issues are sourced from Clang warnings, so 
there can
+# only be clang-diagnostic issues for warnings that are enabled. Warnings 
change across
+# Clang releases and most are disabled via the .clang-tidy's "Checks" value. 
To avoid
+# enormous output, this only enables -Wall and -Wextra.
+SET(CXX_FLAGS_TIDY "${CXX_FLAGS_TIDY} -Wall -Wextra")
+# The Tidy build output can be verbose and it is unlikely to be viewed in a 
terminal.
+# It usually is redirected to less, a log file, or /dev/null. In those places 
color
+# codes just make the output harder to read.
 SET(CXX_FLAGS_TIDY "${CXX_FLAGS_TIDY} -fno-color-diagnostics")
 
 # Set compile flags based on the build type.

Reply via email to