Silence array-bounds warnings when with gcc 4.9.1

Yaron Keren yaron.keren at gmail.com
Mon Apr 27 23:14:27 PDT 2015


http://llvm.org/pr23335

When building clang with gcc 4.9.1, there are many 'array subscript is
above array bounds' warnings from clang/Basic/Diagnostic.h. This patch
silences these warnings.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150428/9f84ee09/attachment.html>
-------------- next part --------------
Index: cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- cmake/modules/HandleLLVMOptions.cmake	(revision 235720)
+++ cmake/modules/HandleLLVMOptions.cmake	(working copy)
@@ -346,6 +346,9 @@
   if (LLVM_ENABLE_WARNINGS)
     append("-Wall -W -Wno-unused-parameter -Wwrite-strings" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
     append("-Wcast-qual" CMAKE_CXX_FLAGS)
+    if (CMAKE_COMPILER_IS_GNUCXX)
+      append(" -Wno-array-bounds" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+    endif()
 
     # Turn off missing field initializer warnings for gcc to avoid noise from
     # false positives with empty {}. Turn them on otherwise (they're off by


More information about the llvm-commits mailing list