diff options
author | Martin Kaiser <wireshark@kaiser.cx> | 2013-02-21 18:40:48 +0000 |
---|---|---|
committer | Martin Kaiser <wireshark@kaiser.cx> | 2013-02-21 18:40:48 +0000 |
commit | b057717767c516123dbefb07ed5c736462a9d99d (patch) | |
tree | 4fb384ba95f2a5d9d693e45b4dedde91d97cb685 /wsutil | |
parent | 38a73a32f3890dbbe03bca23f31c3b29e59c0803 (diff) |
use pragma GCC diagnostic to work around gcrypt.h warnings
distinguish between different gcc versions
this should allow a clean build with libgcrypt 1.5.0
svn path=/trunk/; revision=47803
Diffstat (limited to 'wsutil')
-rw-r--r-- | wsutil/wsgcrypt.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/wsutil/wsgcrypt.h b/wsutil/wsgcrypt.h index a92b5c977c..714ad78962 100644 --- a/wsutil/wsgcrypt.h +++ b/wsutil/wsgcrypt.h @@ -1,6 +1,9 @@ /* wsgcrypt.h * * Wrapper around libgcrypt's include file gcrypt.h. + * For libgcrypt 1.5.0, including gcrypt.h directly brings up lots of + * compiler warnings about deprecated definitions. + * Try to work around these warnings to ensure a clean build with -Werror. * * $Id$ * @@ -28,7 +31,38 @@ #ifdef HAVE_LIBGCRYPT +#if defined(__GNUC__) && defined(__GNUC_MINOR__) +#define _GCC_VERSION (__GNUC__*100 + __GNUC_MINOR__*10) +#else +#define _GCC_VERSION 0 +#endif + +/* check the gcc version + pragma GCC diagnostic error/warning was introduced in gcc 4.2.0 + pragma GCC diagnostic push/pop was introduced in gcc 4.6.0 */ + +#if _GCC_VERSION<420 + +/* no gcc or gcc version<4.2.0: we can't do anything */ +#include <gcrypt.h> + +#elif _GCC_VERSION<460 + +/* gcc version is between 4.2.0 and 4.6.0: + diagnostic warning/error is supported, diagnostic push/pop is not supported */ +#pragma GCC diagnostic warning "-Wdeprecated-declarations" #include <gcrypt.h> +#pragma GCC diagnostic error "-Wdeprecated-declarations" + +#else + +/* gcc version is >= 4.6.0: we can use push/pop */ +#pragma GCC diagnostic push +#pragma GCC diagnostic warning "-Wdeprecated-declarations" +#include <gcrypt.h> +#pragma GCC diagnostic pop + +#endif /* _GCC_VERSION */ #endif /* HAVE_LIBGRYPT */ |