Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Unified Diff: include/core/SkTypes.h

Issue 1468483002: Add SK_BEGIN_REQUIRE_DENSE / SK_END_REQUIRE_DENSE. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: SkStrokeRec Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkStrokeRec.h ('k') | src/core/SkGlyph.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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))
« no previous file with comments | « include/core/SkStrokeRec.h ('k') | src/core/SkGlyph.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698