AWS SDK for C++  1.8.24
AWS SDK for C++
Core_EXPORTS.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <aws/core/SDKConfig.h>
9 
10 #if defined (USE_WINDOWS_DLL_SEMANTICS) || defined (_WIN32)
11  #ifdef _MSC_VER
12  #pragma warning(disable : 4251)
13  #endif // _MSC_VER
14 
15  #ifdef USE_IMPORT_EXPORT
16  #ifdef AWS_CORE_EXPORTS
17  #define AWS_CORE_API __declspec(dllexport)
18  #else // AWS_CORE_EXPORTS
19  #define AWS_CORE_API __declspec(dllimport)
20  #endif // AWS_CORE_EXPORTS
21  #else // USE_IMPORT_EXPORT
22  #define AWS_CORE_API
23  #endif // USE_IMPORT_EXPORT
24 #else // defined (USE_WINDOWS_DLL_SEMANTICS) || defined (_WIN32)
25  #define AWS_CORE_API
26 #endif // defined (USE_WINDOWS_DLL_SEMANTICS) || defined (_WIN32)
27 
28 #ifdef _MSC_VER
29  #define AWS_SUPPRESS_WARNING_PUSH(W) \
30  __pragma(warning(push)) \
31  __pragma(warning(disable:W))
32 
33  #define AWS_SUPPRESS_WARNING_POP __pragma(warning(pop))
34 
35  #define AWS_SUPPRESS_WARNING(W, ...) \
36  AWS_SUPPRESS_WARNING_PUSH(W) \
37  __VA_ARGS__; \
38  AWS_SUPPRESS_WARNING_POP
39 
40  #define AWS_SUPPRESS_DEPRECATION(...) AWS_SUPPRESS_WARNING(4996, __VA_ARGS__)
41 
42 #elif defined (__clang__)
43  #define DO_PRAGMA(x) _Pragma(#x)
44 
45  #define AWS_SUPPRESS_WARNING_PUSH(W) \
46  DO_PRAGMA(clang diagnostic push) \
47  DO_PRAGMA(clang diagnostic ignored W)
48 
49  #define AWS_SUPPRESS_WARNING_POP DO_PRAGMA(clang diagnostic pop)
50 
51  #define AWS_SUPPRESS_WARNING(W, ...) \
52  AWS_SUPPRESS_WARNING_PUSH(W) \
53  __VA_ARGS__; \
54  AWS_SUPPRESS_WARNING_POP
55 
56  #define AWS_SUPPRESS_DEPRECATION(...) AWS_SUPPRESS_WARNING("-Wdeprecated-declarations", __VA_ARGS__)
57 
58 #elif defined (__GNUC__)
59  #define DO_PRAGMA(x) _Pragma(#x)
60 
61  #define AWS_SUPPRESS_WARNING_PUSH(W) \
62  DO_PRAGMA(GCC diagnostic push) \
63  DO_PRAGMA(GCC diagnostic ignored W)
64 
65  #define AWS_SUPPRESS_WARNING_POP DO_PRAGMA(GCC diagnostic pop)
66 
71  #define WRAP_(W, ...) \
72  W \
73  __VA_ARGS__ \
74  AWS_SUPPRESS_WARNING_POP
75 
76  #define AWS_SUPPRESS_WARNING(W, ...) WRAP_(AWS_SUPPRESS_WARNING_PUSH(W), __VA_ARGS__)
77 
78  #define AWS_SUPPRESS_DEPRECATION(...) AWS_SUPPRESS_WARNING("-Wdeprecated-declarations", __VA_ARGS__)
79 
80 #else
81  #define AWS_SUPPRESS_WARNING(W, ...) __VAR_ARGS__
82  #define AWS_SUPPRESS_WARNING_PUSH(W)
83  #define AWS_SUPPRESS_WARNING_POP
84  #define AWS_SUPPRESS_DEPRECATION(...) __VA_ARGS__
85 #endif
86 
87 // Due to MSVC can't recognize base class deprecated function in derived class.
88 // We need AWS_DISABLE_DEPRECATION to make AWS_DEPRECATED useless only on MSVC
89 // Update: When deprecating a function/components, we won't remove the existing tests
90 // immediately, so we need AWS_DISABLE_DEPRECATION as well.
91 #if defined(AWS_DISABLE_DEPRECATION)
92  #define AWS_DEPRECATED(msg)
93 #elif defined (__cplusplus) && __cplusplus > 201103L // standard attributes are available since C++14
94  #define AWS_DEPRECATED(msg) [[deprecated(msg)]]
95 #else
96  #ifdef _MSC_VER
97  #define AWS_DEPRECATED(msg) __declspec(deprecated(msg))
98  #elif defined (__clang__) || defined (__GNUC__)
99  #define AWS_DEPRECATED(msg) __attribute__((deprecated(msg)))
100  #else
101  #define AWS_DEPRECATED(msg)
102  #endif
103 #endif