[llvm] cfa65f7 - [cmake] Enable Clang warnings about redundant semicolons
Martin Storsjö via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 19 09:49:14 PDT 2021
Author: Martin Storsjö
Date: 2021-03-19T18:49:05+02:00
New Revision: cfa65f77cbcd1185bdd3860ff326db37066a519a
URL: https://github.com/llvm/llvm-project/commit/cfa65f77cbcd1185bdd3860ff326db37066a519a
DIFF: https://github.com/llvm/llvm-project/commit/cfa65f77cbcd1185bdd3860ff326db37066a519a.diff
LOG: [cmake] Enable Clang warnings about redundant semicolons
This matches what GCC warns about when -pedantic is enabled.
This should avoid such redundant semicolons creeping into the codebase.
Differential Revision: https://reviews.llvm.org/D98941
Added:
Modified:
llvm/cmake/modules/HandleLLVMOptions.cmake
Removed:
################################################################################
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index d85fe137c191..c250a776517d 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -668,6 +668,11 @@ if (LLVM_ENABLE_WARNINGS AND (LLVM_COMPILER_IS_GCC_COMPATIBLE OR CLANG_CL))
if (LLVM_ENABLE_PEDANTIC AND LLVM_COMPILER_IS_GCC_COMPATIBLE)
append("-pedantic" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
append("-Wno-long-long" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+
+ # GCC warns about redundant toplevel semicolons (enabled by -pedantic
+ # above), while Clang doesn't. Enable the corresponding Clang option to
+ # pick up on these even in builds with Clang.
+ add_flag_if_supported("-Wc++98-compat-extra-semi" CXX98_COMPAT_EXTRA_SEMI_FLAG)
endif()
add_flag_if_supported("-Wimplicit-fallthrough" IMPLICIT_FALLTHROUGH_FLAG)
More information about the llvm-commits
mailing list