Aikido
deprecated.hpp
Go to the documentation of this file.
1 #ifndef AIKIDO_COMMON_DEPRECATED_HPP_
2 #define AIKIDO_COMMON_DEPRECATED_HPP_
3 
4 #include <dart/config.hpp>
5 
6 // NOTE: Deprecated macros are used for backward compatibility between different
7 // minor versions of AIKIDO. Deprecated API can be removed in every major
8 // version up.
9 
10 #if defined(__GNUC__) || defined(__clang__)
11 #define AIKIDO_DEPRECATED(version) __attribute__((deprecated))
12 #elif defined(_MSC_VER)
13 #define AIKIDO_DEPRECATED(version) __declspec(deprecated)
14 #else
15 #define AIKIDO_DEPRECATED(version) ()
16 #endif
17 
18 // We define two convenient macros that can be used to suppress
19 // deprecated-warnings for a specific code block rather than a whole project.
20 // This macros would be useful when you need to call deprecated function for
21 // some reasons (e.g., for backward compatibility) but don't want warnings.
22 //
23 // Example code:
24 //
25 // deprecated_function() // warning
26 //
27 // AIKIDO_SUPPRESS_DEPRECATED_BEGIN
28 // deprecated_function() // okay, no warning
29 // AIKIDO_SUPPRESS_DEPRECATED_END
30 //
31 #if defined(__GNUC__) || defined(__GNUG__)
32 
33 #define AIKIDO_SUPPRESS_DEPRECATED_BEGIN \
34  _Pragma("GCC diagnostic push") \
35  _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
36 
37 #define AIKIDO_SUPPRESS_DEPRECATED_END _Pragma("GCC diagnostic pop")
38 
39 #elif defined(__clang__)
40 
41 #define AIKIDO_SUPPRESS_DEPRECATED_BEGIN \
42  _Pragma("clang diagnostic push") \
43  _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
44 
45 #define AIKIDO_SUPPRESS_DEPRECATED_END _Pragma("clang diagnostic pop")
46 
47 #else
48 
49 #warning "AIKIDO is being built by unsupported compiler."
50 
51 #define AIKIDO_SUPPRESS_DEPRECATED_BEGIN
52 #define AIKIDO_SUPPRESS_DEPRECATED_END
53 
54 #endif
55 
56 #endif // AIKIDO_COMMON_DEPRECATED_HPP_