All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Kernel.h
Go to the documentation of this file.
1 // $Header: /tmp/svngaudi/tmp.jEpFh25751/Gaudi/GaudiKernel/GaudiKernel/Kernel.h,v 1.15 2006/05/02 13:03:03 hmd Exp $
2 #ifndef GAUDIKERNEL_KERNEL_H
3 #define GAUDIKERNEL_KERNEL_H
4 
5 // Some pragmas to avoid warnings in VisualC
6 #ifdef _WIN32
7  // Disable warning C4786: identifier was truncated to '255' characters in the debug information
8  #pragma warning ( disable : 4786 )
9  // Disable warning C4291: no matching operator delete found; memory will not be freed if initialization throws an exception
10  #pragma warning ( disable : 4291 )
11  // Disable warning C4250: inheritance via dominance
12  #pragma warning ( disable : 4250 )
13 #endif
14 
15 
16 // Large integer definition depends of the platform
17 #ifdef _WIN32
18 #ifndef NO_LONGLONG_TYPEDEF
19  typedef __int64 longlong;
20  typedef unsigned __int64 ulonglong;
21 #endif
22 
23  #ifndef LONGLONG_MAX
24  #define LONGLONG_MAX 0x7FFFFFFFFFFFFFFFLL
25  #endif
26  #ifndef LONGLONG_MIN
27  #define LONGLONG_MIN 0x8000000000000000LL
28  #endif
29 
30  #ifndef ULONGLONG_MAX
31  #define ULONGLONG_MAX 0xFFFFFFFFFFFFFFFFLL
32  #endif
33  #ifndef ULONGLONG_MIN
34  #define ULONGLONG_MIN 0x0000000000000000LL
35  #endif
36 #elif defined(__linux) || defined(__APPLE__)
37 #ifndef NO_LONGLONG_TYPEDEF
38  typedef long long int longlong;
39  typedef unsigned long long int ulonglong;
40 #endif
41 
42  #ifndef LONGLONG_MAX
43  #define LONGLONG_MAX 0x7FFFFFFFFFFFFFFFLL
44  #endif
45  #ifndef LONGLONG_MIN
46  #define LONGLONG_MIN 0x8000000000000000LL
47  #endif
48 
49  #ifndef ULONGLONG_MAX
50  #define ULONGLONG_MAX 0xfFFFFFFFFFFFFFFFLL
51  #endif
52  #ifndef ULONGLONG_MIN
53  #define ULONGLONG_MIN 0x0000000000000000LL
54  #endif
55 #else
56  // This will not really work !!
57  struct __longlong { public: long __data[2]; };
60  static const __longlong LONGLONG_MAX = {0x7FFFFFFF, 0xFFFFFFFF};
61  static const __longlong LONGLONG_MIN = {0x80000000, 0x00000000};
62  static const __ulonglong ULONGLONG_MAX = {0xFFFFFFFF, 0xFFFFFFFF};
63  static const __ulonglong ULONGLONG_MIN = {0x00000000, 0x00000000};
64 #endif // linux
65 
66 #ifdef _WIN32
67  #define TEMPLATE_SPECIALIZATION template <>
68 #elif defined(__linux) || defined(__APPLE__)
69  #define TEMPLATE_SPECIALIZATION
70 #endif
71 
72 // ---------------------------------- Symbol visibility macros (begin)
73 // Enabled on in Gaudi v21 mode
74 #if !defined(GAUDI_V20_COMPAT) || defined(G21_HIDE_SYMBOLS)
75 // These macros will allow selection on exported symbols
76 // taken from http://gcc.gnu.org/wiki/Visibility
77 #if __GNUC__ >= 4 && ! defined(__CINT__)
78 # define GAUDI_HASCLASSVISIBILITY
79 #endif
80 
81 #ifdef _WIN32
82 /*
83 # define GAUDI_IMPORT __declspec(dllimport)
84 # define GAUDI_EXPORT __declspec(dllexport)
85 # define GAUDI_LOCAL
86 */
87 // The symbol visibility is disabled on Win32 because it is not possible to
88 // make coexists the gcc and VC ways.
89 # define GAUDI_IMPORT
90 # define GAUDI_EXPORT
91 # define GAUDI_LOCAL
92 #else
93 # if defined(GAUDI_HASCLASSVISIBILITY)
94 # define GAUDI_IMPORT __attribute__((visibility("default")))
95 # define GAUDI_EXPORT __attribute__((visibility("default")))
96 # define GAUDI_LOCAL __attribute__((visibility("hidden")))
97 # else
98 # define GAUDI_IMPORT
99 # define GAUDI_EXPORT
100 # define GAUDI_LOCAL
101 # endif
102 #endif
103 
104 // Define GAUDI_API for DLL builds
105 #ifdef GAUDI_LINKER_LIBRARY
106 #define GAUDI_API GAUDI_EXPORT
107 #else
108 #define GAUDI_API GAUDI_IMPORT
109 #endif
110 #else
111 // Dummy definitions for the backward compatibility mode.
112 #define GAUDI_API
113 #define GAUDI_IMPORT
114 #define GAUDI_EXPORT
115 #define GAUDI_LOCAL
116 #endif // GAUDI_V20_COMPAT
117 // ---------------------------------- Symbol visibility macros (end)
118 
119 
120 // -------------- LIKELY/UNLIKELY macros (begin)
121 // Use compiler hinting to improve branch prediction for linux
122 #ifdef __GNUC__
123 # define LIKELY(x) __builtin_expect((x),1)
124 # define UNLIKELY(x) __builtin_expect((x),0)
125 #else
126 # define LIKELY(x) x
127 # define UNLIKELY(x) x
128 #endif
129 // -------------- LIKELY/UNLIKELY macros (end)
130 
131 #endif // GAUDIKERNEL_KERNEL_H
__longlong ulonglong
Definition: Kernel.h:59
long __data[2]
Definition: Kernel.h:57
__longlong longlong
Definition: Kernel.h:58