[PATCH] D108864: [CMake] Disable -Wmisleading-indentation when using gcc

Vince Bridgers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 28 03:56:40 PDT 2021


vabridgers created this revision.
vabridgers added a reviewer: MaskRay.
Herald added a subscriber: mgorny.
vabridgers requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

gcc doesn't handle -Wmisleading-indentation correctly, leading to
warnings when using gcc. See
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81334 for details. This
change disables -Wmisleading-indentation to avoid warnings when using
gcc, and leaves it enabled for other compilers. This can be re-enabled
when gcc behaves as expected.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108864

Files:
  llvm/cmake/modules/HandleLLVMOptions.cmake


Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -789,7 +789,11 @@
   add_flag_if_supported("-Wstring-conversion" STRING_CONVERSION_FLAG)
 
   # Prevent bugs that can happen with llvm's brace style.
-  add_flag_if_supported("-Wmisleading-indentation" MISLEADING_INDENTATION_FLAG)
+  if (CMAKE_COMPILER_IS_GNUCXX)
+    add_flag_if_supported("-Wno-misleading-indentation" MISLEADING_INDENTATION_FLAG)
+  else()
+    add_flag_if_supported("-Wmisleading-indentation" MISLEADING_INDENTATION_FLAG)
+  endif()
 endif (LLVM_ENABLE_WARNINGS AND (LLVM_COMPILER_IS_GCC_COMPATIBLE OR CLANG_CL))
 
 if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND NOT LLVM_ENABLE_WARNINGS)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108864.369247.patch
Type: text/x-patch
Size: 818 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210828/8b36896d/attachment.bin>


More information about the llvm-commits mailing list