DO NOT MERGE Add workaround for incorrect array-bounds warning in glsDrawTest.cpp
authorPyry Haulos <phaulos@google.com>
Mon, 10 Nov 2014 18:10:39 +0000 (10:10 -0800)
committerPyry Haulos <phaulos@google.com>
Tue, 18 Nov 2014 17:18:05 +0000 (17:18 +0000)
Bug: 18329517
Change-Id: I07e4139429301ee306f9a79833da23df143ecafe
(cherry picked from commit 161a3f7331372887eee58a5f2c6dd1265861e1bd)

modules/glshared/glsDrawTest.cpp

index 69e4f22..b82f261 100644 (file)
@@ -60,7 +60,6 @@
 #include "glwDefs.hpp"
 #include "glwEnums.hpp"
 
-
 namespace deqp
 {
 namespace gls
@@ -1652,6 +1651,16 @@ char* RandomArrayGenerator::generateBasicArray (int seed, int elementCount, int
        return DE_NULL;
 }
 
+#if (DE_COMPILER == DE_COMPILER_GCC) && (__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)
+       // GCC 4.8/4.9 incorrectly emits array-bounds warning from createBasicArray()
+#      define GCC_ARRAY_BOUNDS_FALSE_NEGATIVE 1
+#endif
+
+#if defined(GCC_ARRAY_BOUNDS_FALSE_NEGATIVE)
+#      pragma GCC diagnostic push
+#      pragma GCC diagnostic ignored "-Warray-bounds"
+#endif
+
 template<typename T, typename GLType>
 char* RandomArrayGenerator::createBasicArray (int seed, int elementCount, int componentCount, int offset, int stride)
 {
@@ -1700,6 +1709,10 @@ char* RandomArrayGenerator::createBasicArray (int seed, int elementCount, int co
        return data;
 }
 
+#if defined(GCC_ARRAY_BOUNDS_FALSE_NEGATIVE)
+#      pragma GCC diagnostic pop
+#endif
+
 char* RandomArrayGenerator::generatePackedArray (int seed, int elementCount, int componentCount, int offset, int stride)
 {
        DE_ASSERT(componentCount == 4);