aboutsummaryrefslogtreecommitdiff
path: root/llvm/cmake
diff options
context:
space:
mode:
authorFarid Zakaria <fmzakari@google.com>2023-07-23 20:19:42 -0700
committerFangrui Song <i@maskray.me>2023-07-23 20:19:42 -0700
commit1f8f8760b586320be094daa872b298eeeedf582d (patch)
treec054cf06ca9a621da2c8e1d0bf2653e245870c10 /llvm/cmake
parentfd0aa70528e425fe192d3eb0c5c1e32b4b1ccbf5 (diff)
downloadllvm-1f8f8760b586320be094daa872b298eeeedf582d.zip
llvm-1f8f8760b586320be094daa872b298eeeedf582d.tar.gz
llvm-1f8f8760b586320be094daa872b298eeeedf582d.tar.bz2
[CMake] Disable GCC -Wnonnull
I noticed during the build that GCC would emit a ton of nonnull warnings. Example: ``` /usr/local/google/home/fmzakari/code/github.com/llvm/llvm-project/clang/include/clang/AST/ExternalASTSource.h:378:54: warning: ‘this’ pointer is null [-Wnonnull]   378 |       Ptr = reinterpret_cast<uint64_t>((Source->*Get)(Ptr >> 1));       |                                        ~~~~~~~~~~~~~~^~~~~~~~~~ ``` Reviewed By: MaskRay, rsmith Differential Revision: https://reviews.llvm.org/D155857
Diffstat (limited to 'llvm/cmake')
-rw-r--r--llvm/cmake/modules/HandleLLVMOptions.cmake5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index 8692af9..19d6c58 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -770,6 +770,11 @@ if (LLVM_ENABLE_WARNINGS AND (LLVM_COMPILER_IS_GCC_COMPATIBLE OR CLANG_CL))
append_if(USE_NO_UNINITIALIZED "-Wno-uninitialized" CMAKE_CXX_FLAGS)
append_if(USE_NO_MAYBE_UNINITIALIZED "-Wno-maybe-uninitialized" CMAKE_CXX_FLAGS)
+ # Disable -Wnonnull for GCC warning as it is emitting a lot of false positives.
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ append("-Wno-nonnull" CMAKE_CXX_FLAGS)
+ endif()
+
# Disable -Wclass-memaccess, a C++-only warning from GCC 8 that fires on
# LLVM's ADT classes.
check_cxx_compiler_flag("-Wclass-memaccess" CXX_SUPPORTS_CLASS_MEMACCESS_FLAG)