Guard colorNames variable under SK_SUPPORT_UNITTEST.
That way clang does not complain with unneeded-internal-declaration warning,
because otherwise to clang this variable is unused and thus it won't
emit code for it.
The warning is:
../../src/utils/SkParseColor.cpp:35:3: error: variable 'colorNames' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
} colorNames[] = {
R=bsalomon@google.com, robertphillips@google.com
Author: tfarina@chromium.org
Review URL: https://codereview.chromium.org/27229004
git-svn-id: http://skia.googlecode.com/svn/trunk/src@11798 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/utils/SkParseColor.cpp b/utils/SkParseColor.cpp
index becad2c..37f1308 100644
--- a/utils/SkParseColor.cpp
+++ b/utils/SkParseColor.cpp
@@ -12,6 +12,7 @@
#ifdef SK_DEBUG
#include "SkString.h"
+#ifdef SK_SUPPORT_UNITTEST
// compress names 6 chars per long (packed 5 bits/char )
// note: little advantage to splitting chars across longs, since 3 longs at 2 unused bits each
// allow for one additional split char (vs. the 18 unsplit chars in the three longs)
@@ -175,9 +176,8 @@
{ "yellowgreen", 0x9ACD32 }
};
-int colorNamesSize = sizeof(colorNames) / sizeof(colorNames[0]);
+int colorNamesSize = SK_ARRAY_COUNT(colorNames);
-#ifdef SK_SUPPORT_UNITTEST
static void CreateTable() {
SkString comment;
size_t originalSize = 0;