PcapPlusPlus  24.09
DeprecationUtils.h
Go to the documentation of this file.
1 #pragma once
2 
4 
5 #ifndef PCPP_DEPRECATED
6 # if defined(__GNUC__) || defined(__clang__)
7 # define PCPP_DEPRECATED(msg) __attribute__((deprecated(msg)))
8 # elif defined(_MSC_VER)
9 # define PCPP_DEPRECATED(msg) __declspec(deprecated(msg))
10 # else
11 # pragma message("WARNING: DEPRECATED feature is not implemented for this compiler")
12 # define PCPP_DEPRECATED(msg)
13 # endif
14 #endif
15 
16 #if !defined(DISABLE_WARNING_PUSH) || !defined(DISABLE_WARNING_POP)
17 # if defined(_MSC_VER)
18 # define DISABLE_WARNING_PUSH __pragma(warning(push))
19 # define DISABLE_WARNING_POP __pragma(warning(pop))
20 # define DISABLE_WARNING(warningNumber) __pragma(warning(disable : warningNumber))
21 
22 # define DISABLE_WARNING_DEPRECATED DISABLE_WARNING(4996)
23 # elif defined(__GNUC__) || defined(__clang__)
24 # define DO_PRAGMA(X) _Pragma(#X)
25 # define DISABLE_WARNING_PUSH DO_PRAGMA(GCC diagnostic push)
26 # define DISABLE_WARNING_POP DO_PRAGMA(GCC diagnostic pop)
27 # define DISABLE_WARNING(warningName) DO_PRAGMA(GCC diagnostic ignored #warningName)
28 
29 // clang-format off
30 # define DISABLE_WARNING_DEPRECATED DISABLE_WARNING(-Wdeprecated-declarations)
31 // clang-format on
32 # else
33 # pragma message("WARNING: Disabling of warnings is not implemented for this compiler")
34 # define DISABLE_WARNING_PUSH
35 # define DISABLE_WARNING_POP
36 
37 # define DISABLE_WARNING_DEPRECATED
38 # endif
39 #endif