michael@0: # HG changeset patch michael@0: # Parent e378875000890099fffcdb4cbc4ab12828ac34ee michael@0: # User Daniel Holbert michael@0: Bug 890539: Annotate SK_COMPILE_ASSERT's typedef as permissibly unused, to fix GCC 4.8 build warning. r=gw280 michael@0: michael@0: diff --git a/gfx/skia/include/core/SkTypes.h b/gfx/skia/include/core/SkTypes.h michael@0: --- a/gfx/skia/include/core/SkTypes.h michael@0: +++ b/gfx/skia/include/core/SkTypes.h michael@0: @@ -121,18 +121,29 @@ inline void operator delete(void* p) { michael@0: #define SkDEVCODE(code) michael@0: #define SK_DEVELOPER_TO_STRING() michael@0: #endif michael@0: michael@0: template michael@0: struct SkCompileAssert { michael@0: }; michael@0: michael@0: +/* michael@0: + * The SK_COMPILE_ASSERT definition creates an otherwise-unused typedef. This michael@0: + * triggers compiler warnings with some versions of gcc, so mark the typedef michael@0: + * as permissibly-unused to disable the warnings. michael@0: + */ michael@0: +# if defined(__GNUC__) michael@0: +# define SK_COMPILE_ASSERT_UNUSED_ATTRIBUTE __attribute__((unused)) michael@0: +# else michael@0: +# define SK_COMPILE_ASSERT_UNUSED_ATTRIBUTE /* nothing */ michael@0: +# endif michael@0: + michael@0: #define SK_COMPILE_ASSERT(expr, msg) \ michael@0: - typedef SkCompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] michael@0: + typedef SkCompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] SK_COMPILE_ASSERT_UNUSED_ATTRIBUTE michael@0: michael@0: /* michael@0: * Usage: SK_MACRO_CONCAT(a, b) to construct the symbol ab michael@0: * michael@0: * SK_MACRO_CONCAT_IMPL_PRIV just exists to make this work. Do not use directly michael@0: * michael@0: */ michael@0: #define SK_MACRO_CONCAT(X, Y) SK_MACRO_CONCAT_IMPL_PRIV(X, Y)