# HG changeset patch # Parent 9dfb537207e5e0f280d5b4b7a2cadde3eebcada2 # User Jeff Walden Bug 851237 - Mark the static-assert typedef with an unused attribute so it doesn't trigger compiler warnings. NOT REVIEWED YET diff --git a/mfbt/Assertions.h b/mfbt/Assertions.h --- a/mfbt/Assertions.h +++ b/mfbt/Assertions.h @@ -76,6 +76,11 @@ # endif #endif #ifndef MOZ_STATIC_ASSERT +# if defined(__GNUC__) +# define MOZ_STATIC_ASSERT_UNUSED_ATTRIBUTE __attribute__((unused)) +# else +# define MOZ_STATIC_ASSERT_UNUSED_ATTRIBUTE /* nothing */ +# endif # define MOZ_STATIC_ASSERT_GLUE1(x, y) x##y # define MOZ_STATIC_ASSERT_GLUE(x, y) MOZ_STATIC_ASSERT_GLUE1(x, y) # if defined(__SUNPRO_CC) @@ -108,10 +113,10 @@ * code. */ # define MOZ_STATIC_ASSERT(cond, reason) \ - typedef int MOZ_STATIC_ASSERT_GLUE(moz_static_assert, __COUNTER__)[(cond) ? 1 : -1] + typedef int MOZ_STATIC_ASSERT_GLUE(moz_static_assert, __COUNTER__)[(cond) ? 1 : -1] MOZ_STATIC_ASSERT_UNUSED_ATTRIBUTE # else # define MOZ_STATIC_ASSERT(cond, reason) \ - extern void MOZ_STATIC_ASSERT_GLUE(moz_static_assert, __LINE__)(int arg[(cond) ? 1 : -1]) + extern void MOZ_STATIC_ASSERT_GLUE(moz_static_assert, __LINE__)(int arg[(cond) ? 1 : -1]) MOZ_STATIC_ASSERT_UNUSED_ATTRIBUTE # endif #endif