Index: include/core/SkTypes.h |
diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h |
index d9254acf5f776d8abda7b8d3486d834fcaa6e200..5720c30970e5d2ce1ad9f69922caa6a32eeb1163 100644 |
--- a/include/core/SkTypes.h |
+++ b/include/core/SkTypes.h |
@@ -287,6 +287,16 @@ static inline bool SkIsU16(long x) { |
template <typename T, size_t N> char (&SkArrayCountHelper(T (&array)[N]))[N]; |
#define SK_ARRAY_COUNT(array) (sizeof(SkArrayCountHelper(array))) |
+// Can be used to bracket data types that must be dense, e.g. hash keys. |
+#if defined(__clang__) // This should work on GCC too, but GCC diagnostic pop didn't seem to work! |
+ #define SK_BEGIN_REQUIRE_DENSE _Pragma("GCC diagnostic push") \ |
+ _Pragma("GCC diagnostic error \"-Wpadded\"") |
+ #define SK_END_REQUIRE_DENSE _Pragma("GCC diagnostic pop") |
+#else |
+ #define SK_BEGIN_REQUIRE_DENSE |
+ #define SK_END_REQUIRE_DENSE |
+#endif |
+ |
#define SkAlign2(x) (((x) + 1) >> 1 << 1) |
#define SkIsAlign2(x) (0 == ((x) & 1)) |