[PATCH] D98941: [cmake] Enable Clang warnings about redundant semicolons

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 19 04:51:28 PDT 2021


mstorsjo created this revision.
mstorsjo added reviewers: labath, tbaeder, craig.topper.
Herald added a subscriber: mgorny.
mstorsjo requested review of this revision.
Herald added a project: LLVM.

This matches what GCC warns about when -pedantic is enabled.

This should avoid such redundant semicolons creeping into the codebase.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98941

Files:
  llvm/cmake/modules/HandleLLVMOptions.cmake


Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -668,6 +668,11 @@
   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" C98_COMPAT_EXTRA_SEMI_FLAG)
   endif()
 
   add_flag_if_supported("-Wimplicit-fallthrough" IMPLICIT_FALLTHROUGH_FLAG)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98941.331828.patch
Type: text/x-patch
Size: 791 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210319/76073f29/attachment.bin>


More information about the llvm-commits mailing list