Silence array-bounds warnings when with gcc 4.9.1

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

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: <>
-------------- next part --------------
Index: cmake/modules/HandleLLVMOptions.cmake
--- cmake/modules/HandleLLVMOptions.cmake	(revision 235720)
+++ cmake/modules/HandleLLVMOptions.cmake	(working copy)
@@ -346,6 +346,9 @@
     append("-Wall -W -Wno-unused-parameter -Wwrite-strings" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
     append("-Wcast-qual" CMAKE_CXX_FLAGS)
+      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 cfe-commits mailing list