diff options
author | Jeffrey Walton <noloader@gmail.com> | 2015-07-23 12:30:13 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2015-07-23 12:30:13 -0400 |
commit | b2d9be1b80a66b939af3921f52a760c28859df8f (patch) | |
tree | 993081893c6445f6bed38e960d5944949743946a /misc.h | |
parent | 929967a042217629c4f38a98486fa9afed69f343 (diff) | |
download | cryptopp-git-b2d9be1b80a66b939af3921f52a760c28859df8f.tar.gz |
Cleared "unused variable" warning when using CRYPTOPP_STATIC_ASSERT under GCC. The "__attribute__ ((unused)" was present in GCC 2.95, so it will be available for the GCC's we support. Non-GCC's will get the non-decorated assert
Diffstat (limited to 'misc.h')
-rw-r--r-- | misc.h | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -71,11 +71,22 @@ struct CompileAssert static char dummy[2*b-1]; }; +// __attribute__ ((unused)) will help silence the "unused variable warnings. Its available +// at least as early as GCC 2.9.3 (https://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_4.html#SEC84) +// This also works into our -Wall -Wextra strategy for warnings. #define CRYPTOPP_COMPILE_ASSERT(assertion) CRYPTOPP_COMPILE_ASSERT_INSTANCE(assertion, __LINE__) #if defined(CRYPTOPP_EXPORTS) || defined(CRYPTOPP_IMPORTS) #define CRYPTOPP_COMPILE_ASSERT_INSTANCE(assertion, instance) #else -#define CRYPTOPP_COMPILE_ASSERT_INSTANCE(assertion, instance) static CompileAssert<(assertion)> CRYPTOPP_ASSERT_JOIN(cryptopp_assert_, instance) +# if defined(__GNUC__) +# define CRYPTOPP_COMPILE_ASSERT_INSTANCE(assertion, instance) \ + static CompileAssert<(assertion)> \ + CRYPTOPP_ASSERT_JOIN(cryptopp_assert_, instance) __attribute__ ((unused)) +# else +# define CRYPTOPP_COMPILE_ASSERT_INSTANCE(assertion, instance) \ + static CompileAssert<(assertion)> \ + CRYPTOPP_ASSERT_JOIN(cryptopp_assert_, instance) +# endif // __GNUC__ #endif #define CRYPTOPP_ASSERT_JOIN(X, Y) CRYPTOPP_DO_ASSERT_JOIN(X, Y) #define CRYPTOPP_DO_ASSERT_JOIN(X, Y) X##Y |