|
12 | 12 | // Options / configuration based on O.S. / compiler
|
13 | 13 | //
|
14 | 14 |
|
| 15 | +// automated formatting does not handle the cmake tags well |
| 16 | +// clang-format off |
| 17 | + |
15 | 18 | //
|
16 | 19 | // Define whether the half-to-float conversion should use the lookup
|
17 | 20 | // table method. Note that this is overriden by F16C compiler
|
|
51 | 54 | #define IMATH_VERSION_PATCH @Imath_VERSION_PATCH@
|
52 | 55 | #define IMATH_VERSION_RELEASE_TYPE "@IMATH_VERSION_RELEASE_TYPE@"
|
53 | 56 |
|
54 |
| -#define IMATH_VERSION_HEX ((uint32_t(IMATH_VERSION_MAJOR) << 24) | \ |
55 |
| - (uint32_t(IMATH_VERSION_MINOR) << 16) | \ |
56 |
| - (uint32_t(IMATH_VERSION_PATCH) << 8)) |
| 57 | +#define IMATH_VERSION_HEX \ |
| 58 | + ((uint32_t (IMATH_VERSION_MAJOR) << 24) | \ |
| 59 | + (uint32_t (IMATH_VERSION_MINOR) << 16) | \ |
| 60 | + (uint32_t (IMATH_VERSION_PATCH) << 8)) |
57 | 61 |
|
58 | 62 | // IMATH_LIB_VERSION is the library API version: SOCURRENT.SOAGE.SOREVISION
|
59 | 63 | #define IMATH_LIB_VERSION_STRING "@IMATH_LIB_VERSION@"
|
60 | 64 |
|
| 65 | +// clang-format on |
| 66 | + |
61 | 67 | //
|
62 | 68 | // Code that depends on the v2 ExcMath mechanism of signal handlers
|
63 | 69 | // that throw exceptions is incompatible with noexcept, since
|
|
69 | 75 |
|
70 | 76 | #cmakedefine01 IMATH_USE_NOEXCEPT
|
71 | 77 | #if IMATH_USE_NOEXCEPT
|
72 |
| -#define IMATH_NOEXCEPT noexcept |
| 78 | +# define IMATH_NOEXCEPT noexcept |
73 | 79 | #else
|
74 |
| -#define IMATH_NOEXCEPT |
| 80 | +# define IMATH_NOEXCEPT |
75 | 81 | #endif
|
76 | 82 |
|
77 | 83 | //
|
|
84 | 90 | // templates from compiling correctly.
|
85 | 91 | //
|
86 | 92 | #ifndef IMATH_FOREIGN_VECTOR_INTEROP
|
87 |
| -# if defined(__GNUC__) && __GNUC__ == 4 && !defined(__clang__) |
88 |
| -# define IMATH_FOREIGN_VECTOR_INTEROP 0 |
89 |
| -# else |
90 |
| -# define IMATH_FOREIGN_VECTOR_INTEROP 1 |
91 |
| -# endif |
| 93 | +# if defined(__GNUC__) && __GNUC__ == 4 && !defined(__clang__) |
| 94 | +# define IMATH_FOREIGN_VECTOR_INTEROP 0 |
| 95 | +# else |
| 96 | +# define IMATH_FOREIGN_VECTOR_INTEROP 1 |
| 97 | +# endif |
92 | 98 | #endif
|
93 | 99 |
|
94 |
| - |
95 | 100 | //
|
96 | 101 | // Decorator that makes a function available for both CPU and GPU, when
|
97 | 102 | // compiling for Cuda.
|
98 | 103 | //
|
99 | 104 | #ifdef __CUDACC__
|
100 |
| - #define IMATH_HOSTDEVICE __host__ __device__ |
| 105 | +# define IMATH_HOSTDEVICE __host__ __device__ |
101 | 106 | #else
|
102 |
| - #define IMATH_HOSTDEVICE |
| 107 | +# define IMATH_HOSTDEVICE |
103 | 108 | #endif
|
104 | 109 |
|
105 |
| - |
106 | 110 | //
|
107 | 111 | // Some compilers define a special intrinsic to use in conditionals that can
|
108 | 112 | // speed up extremely performance-critical spots if the conditional is
|
|
118 | 122 | //
|
119 | 123 | #if defined(__GNUC__) || defined(__clang__) || defined(__INTEL_COMPILER)
|
120 | 124 | # ifdef __cplusplus
|
121 |
| -# define IMATH_LIKELY(x) (__builtin_expect(static_cast<bool>(x), true)) |
122 |
| -# define IMATH_UNLIKELY(x) (__builtin_expect(static_cast<bool>(x), false)) |
| 125 | +# define IMATH_LIKELY(x) (__builtin_expect (static_cast<bool> (x), true)) |
| 126 | +# define IMATH_UNLIKELY(x) \ |
| 127 | + (__builtin_expect (static_cast<bool> (x), false)) |
123 | 128 | # else
|
124 |
| -# define IMATH_LIKELY(x) (__builtin_expect((x), 1)) |
125 |
| -# define IMATH_UNLIKELY(x) (__builtin_expect((x), 0)) |
| 129 | +# define IMATH_LIKELY(x) (__builtin_expect ((x), 1)) |
| 130 | +# define IMATH_UNLIKELY(x) (__builtin_expect ((x), 0)) |
126 | 131 | # endif
|
127 | 132 | #else
|
128 | 133 | # define IMATH_LIKELY(x) (x)
|
129 | 134 | # define IMATH_UNLIKELY(x) (x)
|
130 | 135 | #endif
|
131 | 136 |
|
132 |
| - |
133 | 137 | // On modern versions of gcc & clang, __has_attribute can test support for
|
134 | 138 | // __attribute__((attr)). Make sure it's safe for other compilers.
|
135 | 139 | #ifndef __has_attribute
|
136 | 140 | # define __has_attribute(x) 0
|
137 | 141 | #endif
|
138 | 142 |
|
139 |
| - |
140 | 143 | //
|
141 | 144 | // Simple way to mark things as deprecated.
|
142 | 145 | // When we are sure that C++14 is our true minimum, then we can just
|
143 | 146 | // directly use [[deprecated(msg)]].
|
144 | 147 | //
|
145 | 148 | #if defined(_MSC_VER)
|
146 |
| -# define IMATH_DEPRECATED(msg) __declspec(deprecated(msg)) |
| 149 | +# define IMATH_DEPRECATED(msg) __declspec(deprecated (msg)) |
147 | 150 | #elif defined(__cplusplus) && __cplusplus >= 201402L
|
148 |
| -# define IMATH_DEPRECATED(msg) [[deprecated(msg)]] |
| 151 | +# define IMATH_DEPRECATED(msg) [[deprecated (msg)]] |
149 | 152 | #elif defined(__GNUC__) || defined(__clang__)
|
150 |
| -# define IMATH_DEPRECATED(msg) __attribute__((deprecated(msg))) |
| 153 | +# define IMATH_DEPRECATED(msg) __attribute__ ((deprecated (msg))) |
151 | 154 | #else
|
152 |
| -# define IMATH_DEPRECATED(msg) /* unsupported on this platform */ |
| 155 | +# define IMATH_DEPRECATED(msg) /* unsupported on this platform */ |
153 | 156 | #endif
|
154 | 157 |
|
155 | 158 | // Whether the user configured the library to have symbol visibility
|
|
159 | 162 | // MSVC does not do the same visibility attributes, and when we are
|
160 | 163 | // compiling a static library we won't be in DLL mode, but just don't
|
161 | 164 | // define these and the export headers will work out
|
162 |
| -#if ! defined(_MSC_VER) && defined(IMATH_ENABLE_API_VISIBILITY) |
163 |
| -# define IMATH_PUBLIC_SYMBOL_ATTRIBUTE __attribute__ ((__visibility__ ("default"))) |
164 |
| -# define IMATH_PRIVATE_SYMBOL_ATTRIBUTE __attribute__ ((__visibility__ ("hidden"))) |
| 165 | +#if !defined(_MSC_VER) && defined(IMATH_ENABLE_API_VISIBILITY) |
| 166 | +# define IMATH_PUBLIC_SYMBOL_ATTRIBUTE \ |
| 167 | + __attribute__ ((__visibility__ ("default"))) |
| 168 | +# define IMATH_PRIVATE_SYMBOL_ATTRIBUTE \ |
| 169 | + __attribute__ ((__visibility__ ("hidden"))) |
165 | 170 | // clang differs from gcc and has type visibility which is needed for enums and templates
|
166 |
| -# if __has_attribute(__type_visibility__) |
167 |
| -# define IMATH_PUBLIC_TYPE_VISIBILITY_ATTRIBUTE __attribute__ ((__type_visibility__ ("default"))) |
168 |
| -# endif |
| 171 | +# if __has_attribute(__type_visibility__) |
| 172 | +# define IMATH_PUBLIC_TYPE_VISIBILITY_ATTRIBUTE \ |
| 173 | + __attribute__ ((__type_visibility__ ("default"))) |
| 174 | +# endif |
169 | 175 | #endif
|
170 | 176 |
|
171 | 177 | #endif // INCLUDED_IMATH_CONFIG_H
|
0 commit comments