gfx/skia/patches/0023-Bug-890539-Fix-SK_COMPILE_ASSERT-build-warning.patch

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:e04df1fe61e5
1 # HG changeset patch
2 # Parent e378875000890099fffcdb4cbc4ab12828ac34ee
3 # User Daniel Holbert <dholbert@cs.stanford.edu>
4 Bug 890539: Annotate SK_COMPILE_ASSERT's typedef as permissibly unused, to fix GCC 4.8 build warning. r=gw280
5
6 diff --git a/gfx/skia/include/core/SkTypes.h b/gfx/skia/include/core/SkTypes.h
7 --- a/gfx/skia/include/core/SkTypes.h
8 +++ b/gfx/skia/include/core/SkTypes.h
9 @@ -121,18 +121,29 @@ inline void operator delete(void* p) {
10 #define SkDEVCODE(code)
11 #define SK_DEVELOPER_TO_STRING()
12 #endif
13
14 template <bool>
15 struct SkCompileAssert {
16 };
17
18 +/*
19 + * The SK_COMPILE_ASSERT definition creates an otherwise-unused typedef. This
20 + * triggers compiler warnings with some versions of gcc, so mark the typedef
21 + * as permissibly-unused to disable the warnings.
22 + */
23 +# if defined(__GNUC__)
24 +# define SK_COMPILE_ASSERT_UNUSED_ATTRIBUTE __attribute__((unused))
25 +# else
26 +# define SK_COMPILE_ASSERT_UNUSED_ATTRIBUTE /* nothing */
27 +# endif
28 +
29 #define SK_COMPILE_ASSERT(expr, msg) \
30 - typedef SkCompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
31 + typedef SkCompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] SK_COMPILE_ASSERT_UNUSED_ATTRIBUTE
32
33 /*
34 * Usage: SK_MACRO_CONCAT(a, b) to construct the symbol ab
35 *
36 * SK_MACRO_CONCAT_IMPL_PRIV just exists to make this work. Do not use directly
37 *
38 */
39 #define SK_MACRO_CONCAT(X, Y) SK_MACRO_CONCAT_IMPL_PRIV(X, Y)

mercurial