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
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)