WIP: fsctl_pipe_wait
[metze/wireshark/wip.git] / wsutil / wsgcrypt.h
1 /* wsgcrypt.h
2  *
3  * Wrapper around libgcrypt's include file gcrypt.h.
4  * For libgcrypt 1.5.0, including gcrypt.h directly brings up lots of
5  * compiler warnings about deprecated definitions.
6  * Try to work around these warnings to ensure a clean build with -Werror.
7  *
8  * $Id$
9  *
10  * Wireshark - Network traffic analyzer
11  * By Gerald Combs <gerald@wireshark.org>
12  * Copyright 2007 Gerald Combs
13  * 
14  * This program is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU General Public License
16  * as published by the Free Software Foundation; either version 2
17  * of the License, or (at your option) any later version.
18  * 
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU General Public License for more details.
23  * 
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, write to the Free Software
26  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27  */
28
29 #ifndef __WSGCRYPT_H__
30 #define __WSGCRYPT_H__
31
32 #ifdef HAVE_LIBGCRYPT
33
34 #ifdef __CLANG__
35
36 #pragma clang diagnostic push
37 #pragma clang diagnostic warning "-Wdeprecated-declarations"
38 #include <gcrypt.h>
39 #pragma clang diagnostic pop
40
41 #else
42
43 #if defined(__GNUC__) && defined(__GNUC_MINOR__)
44 #define _GCC_VERSION (__GNUC__*100 + __GNUC_MINOR__*10)
45 #else
46 #define _GCC_VERSION 0
47 #endif
48
49 /* check the gcc version
50    pragma GCC diagnostic error/warning was introduced in gcc 4.2.0
51    pragma GCC diagnostic push/pop was introduced in gcc 4.6.0 */
52
53 #if _GCC_VERSION<420
54
55 /* no gcc or gcc version<4.2.0: we can't do anything */
56 #include <gcrypt.h>
57
58 #elif _GCC_VERSION<460
59
60 /* gcc version is between 4.2.0 and 4.6.0:
61    diagnostic warning/error is supported, diagnostic push/pop is not supported */
62 #pragma GCC diagnostic warning "-Wdeprecated-declarations"
63 #include <gcrypt.h>
64 #pragma GCC diagnostic error "-Wdeprecated-declarations"
65
66 #else
67
68 /* gcc version is >= 4.6.0: we can use push/pop */
69 #pragma GCC diagnostic push
70 #pragma GCC diagnostic warning "-Wdeprecated-declarations"
71 #include <gcrypt.h>
72 #pragma GCC diagnostic pop
73
74 #endif /* _GCC_VERSION */
75
76 #endif /* __CLANG__ */
77
78 #endif /* HAVE_LIBGRYPT */
79
80 #endif /* __WSGCRYPT_H__ */