comparison OrthancFramework/Sources/Compatibility.h @ 4202:2007ab69ac16

moving ORTHANC_FORCE_INLINE and ORTHANC_OVERRIDE from Enumerations.h to Compatibility.h
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 17 Sep 2020 08:35:11 +0200
parents bf7b9edf6b81
children ce9284aebd40
comparison
equal deleted inserted replaced
4201:2d5209153b32 4202:2007ab69ac16
19 * <http://www.gnu.org/licenses/>. 19 * <http://www.gnu.org/licenses/>.
20 **/ 20 **/
21 21
22 22
23 #pragma once 23 #pragma once
24
25
26 // Macro "ORTHANC_FORCE_INLINE" forces a function/method to be inlined
27 #if defined(_MSC_VER)
28 # define ORTHANC_FORCE_INLINE __forceinline
29 #elif defined(__GNUC__) || defined(__clang__) || defined(__EMSCRIPTEN__)
30 # define ORTHANC_FORCE_INLINE inline __attribute((always_inline))
31 #else
32 # error Please support your compiler here
33 #endif
34
35
36 // Macros "ORTHANC_OVERRIDE" and "ORTHANC_FINAL" wrap the "override"
37 // and "final" keywords introduced in C++11, to do compile-time
38 // checking of virtual methods
39 // 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
41 // We thus use an alternate way of checking for 'override' support
42 #ifdef ORTHANC_OVERRIDE_SUPPORTED
43 # error ORTHANC_OVERRIDE_SUPPORTED cannot be defined at this point
44 #endif
45
46 #if __cplusplus >= 201103L
47 # define ORTHANC_OVERRIDE_SUPPORTED 1
48 #else
49 # ifdef _MSC_VER
50 # if _MSC_VER >= 1600
51 # define ORTHANC_OVERRIDE_SUPPORTED 1
52 # endif
53 # endif
54 #endif
55
56
57 #if ORTHANC_OVERRIDE_SUPPORTED
58 // The override keyword (C++11) is enabled
59 # define ORTHANC_OVERRIDE override
60 # define ORTHANC_FINAL final
61 #else
62 // The override keyword (C++11) is not available
63 # define ORTHANC_OVERRIDE
64 # define ORTHANC_FINAL
65 #endif
66
67
24 68
25 //#define Orthanc_Compatibility_h_STR2(x) #x 69 //#define Orthanc_Compatibility_h_STR2(x) #x
26 //#define Orthanc_Compatibility_h_STR1(x) Orthanc_Compatibility_h_STR2(x) 70 //#define Orthanc_Compatibility_h_STR1(x) Orthanc_Compatibility_h_STR2(x)
27 71
28 //#pragma message("__cplusplus = " Orthanc_Compatibility_h_STR1(__cplusplus)) 72 //#pragma message("__cplusplus = " Orthanc_Compatibility_h_STR1(__cplusplus))