comparison OrthancFramework/Sources/Compatibility.h @ 4328:ce9284aebd40

new macro ORTHANC_DEPRECATED
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 25 Nov 2020 13:34:58 +0100
parents 2007ab69ac16
children e457c30970cf
comparison
equal deleted inserted replaced
4327:9684a690ca63 4328:ce9284aebd40
31 #else 31 #else
32 # error Please support your compiler here 32 # error Please support your compiler here
33 #endif 33 #endif
34 34
35 35
36 // Macro "ORTHANC_DEPRECATED" tags a function as having been deprecated
37 #if __cplusplus >= 201402L // C++14
38 # define ORTHANC_DEPRECATED [[deprecated]]
39 #elif defined(__GNUC__) || defined(__clang__)
40 # define ORTHANC_DEPRECATED __attribute__((deprecated))
41 #elif defined(_MSC_VER)
42 # define ORTHANC_DEPRECATED __declspec(deprecated)
43 #else
44 # define ORTHANC_DEPRECATED
45 #endif
46
47
36 // Macros "ORTHANC_OVERRIDE" and "ORTHANC_FINAL" wrap the "override" 48 // Macros "ORTHANC_OVERRIDE" and "ORTHANC_FINAL" wrap the "override"
37 // and "final" keywords introduced in C++11, to do compile-time 49 // and "final" keywords introduced in C++11, to do compile-time
38 // checking of virtual methods 50 // checking of virtual methods
39 // The __cplusplus macro is broken in Visual Studio up to 15.6 and, in 51 // The __cplusplus macro is broken in Visual Studio up to 15.6 and, in
40 // later versions, require the usage of the /Zc:__cplusplus flag 52 // later versions, require the usage of the /Zc:__cplusplus flag
41 // We thus use an alternate way of checking for 'override' support 53 // We thus use an alternate way of checking for 'override' support
42 #ifdef ORTHANC_OVERRIDE_SUPPORTED 54 #ifdef ORTHANC_OVERRIDE_SUPPORTED
43 # error ORTHANC_OVERRIDE_SUPPORTED cannot be defined at this point 55 # error ORTHANC_OVERRIDE_SUPPORTED cannot be defined at this point
44 #endif 56 #endif
45 57
46 #if __cplusplus >= 201103L 58 #if __cplusplus >= 201103L // C++11
47 # define ORTHANC_OVERRIDE_SUPPORTED 1 59 # define ORTHANC_OVERRIDE_SUPPORTED 1
48 #else 60 #else
49 # ifdef _MSC_VER 61 # ifdef _MSC_VER
50 # if _MSC_VER >= 1600 62 # if _MSC_VER >= 1600 // Visual Studio 2010 (10.0)
51 # define ORTHANC_OVERRIDE_SUPPORTED 1 63 # define ORTHANC_OVERRIDE_SUPPORTED 1
52 # endif 64 # endif
53 # endif 65 # endif
54 #endif 66 #endif
55 67
82 94
83 // please note that not all C++11 features are supported when _MSC_VER == 1600 95 // please note that not all C++11 features are supported when _MSC_VER == 1600
84 // (or higher). This header file can be made for fine-grained, if required, 96 // (or higher). This header file can be made for fine-grained, if required,
85 // based on specific _MSC_VER values 97 // based on specific _MSC_VER values
86 98
87 # if _MSC_VER >= 1600 99 # if _MSC_VER >= 1600 // Visual Studio 2010 (10.0)
88 # define ORTHANC_Cxx03_DETECTED 0 100 # define ORTHANC_Cxx03_DETECTED 0
89 # else 101 # else
90 # define ORTHANC_Cxx03_DETECTED 1 102 # define ORTHANC_Cxx03_DETECTED 1
91 # endif 103 # endif
92 104
93 #else 105 #else
94 // of _MSC_VER is not defined, we assume __cplusplus is correctly defined 106 // of _MSC_VER is not defined, we assume __cplusplus is correctly defined
95 // if __cplusplus is not defined (very old compilers??), then the following 107 // if __cplusplus is not defined (very old compilers??), then the following
96 // test will compare 0 < 201103L and will be true --> safe. 108 // test will compare 0 < 201103L and will be true --> safe.
97 # if __cplusplus < 201103L 109 # if __cplusplus < 201103L // C++11
98 # define ORTHANC_Cxx03_DETECTED 1 110 # define ORTHANC_Cxx03_DETECTED 1
99 # else 111 # else
100 # define ORTHANC_Cxx03_DETECTED 0 112 # define ORTHANC_Cxx03_DETECTED 0
101 # endif 113 # endif
102 #endif 114 #endif