Go to the documentation of this file. 6 #ifndef OPENVDB_PLATFORM_HAS_BEEN_INCLUDED 7 #define OPENVDB_PLATFORM_HAS_BEEN_INCLUDED 9 #define PRAGMA(x) _Pragma(#x) 14 #define OPENVDB_PREPROC_STRINGIFY_(x) #x 19 #define OPENVDB_PREPROC_STRINGIFY(x) OPENVDB_PREPROC_STRINGIFY_(x) 22 #define OPENVDB_PREPROC_CONCAT_(x, y) x ## y 27 #define OPENVDB_PREPROC_CONCAT(x, y) OPENVDB_PREPROC_CONCAT_(x, y) 32 #define OPENVDB_CHECK_GCC(MAJOR, MINOR) \ 33 (__GNUC__ > MAJOR || (__GNUC__ == MAJOR && __GNUC_MINOR__ >= MINOR)) 35 #define OPENVDB_CHECK_GCC(MAJOR, MINOR) 0 39 #define OPENVDB_HAS_CXX11 1 // kept for backward compatibility 41 #if __cplusplus >= 202002L 42 #define OPENVDB_HAS_CXX20 46 #if defined(OPENVDB_USE_SSE42) || defined(OPENVDB_USE_AVX) 49 #elif defined(__GNUC__) 50 #if defined(__x86_64__) || defined(__i386__) 51 #include <x86intrin.h> 52 #elif defined(__ARM_NEON__) 67 #if defined(_DLL) && !defined(OPENVDB_STATICLIB) && !defined(OPENVDB_DLL) 74 #if defined(__clang__) 75 #define OPENVDB_UBSAN_SUPPRESS(X) __attribute__((no_sanitize(X))) 77 #define OPENVDB_UBSAN_SUPPRESS(X) 82 #if defined(__GNUC__) || defined(__clang__) || defined(__INTEL_COMPILER) 84 #define OPENVDB_LIKELY(x) (__builtin_expect(static_cast<bool>(x), true)) 85 #define OPENVDB_UNLIKELY(x) (__builtin_expect(static_cast<bool>(x), false)) 87 #define OPENVDB_LIKELY(x) (__builtin_expect((x), 1)) 88 #define OPENVDB_UNLIKELY(x) (__builtin_expect((x), 0)) 91 #define OPENVDB_LIKELY(x) (x) 92 #define OPENVDB_UNLIKELY(x) (x) 99 #define OPENVDB_FORCE_INLINE __attribute__((always_inline)) inline 100 #elif defined(_MSC_VER) 101 #define OPENVDB_FORCE_INLINE __forceinline 103 #define OPENVDB_FORCE_INLINE inline 121 #if defined(__INTEL_COMPILER) 125 #define OPENVDB_NO_UNREACHABLE_CODE_WARNING_BEGIN \ 126 _Pragma("warning (push)") \ 127 _Pragma("warning (disable:111)") \ 128 _Pragma("warning (disable:128)") \ 129 _Pragma("warning (disable:185)") \ 130 _Pragma("warning (disable:280)") 131 #define OPENVDB_NO_UNREACHABLE_CODE_WARNING_END \ 132 _Pragma("warning (pop)") 133 #elif defined(__clang__) 134 #define OPENVDB_NO_UNREACHABLE_CODE_WARNING_BEGIN \ 135 PRAGMA(clang diagnostic push) \ 136 PRAGMA(clang diagnostic ignored "-Wunreachable-code") 137 #define OPENVDB_NO_UNREACHABLE_CODE_WARNING_END \ 138 PRAGMA(clang diagnostic pop) 140 #define OPENVDB_NO_UNREACHABLE_CODE_WARNING_BEGIN 141 #define OPENVDB_NO_UNREACHABLE_CODE_WARNING_END 146 #ifndef OPENVDB_NO_DEPRECATION_WARNINGS 147 #define OPENVDB_DEPRECATED [[deprecated]] 148 #define OPENVDB_DEPRECATED_MESSAGE(msg) [[deprecated(msg)]] 150 #define OPENVDB_DEPRECATED 151 #define OPENVDB_DEPRECATED_MESSAGE(msg) 168 #if defined __INTEL_COMPILER 169 #define OPENVDB_NO_DEPRECATION_WARNING_BEGIN \ 170 _Pragma("warning (push)") \ 171 _Pragma("warning (disable:1478)") 172 #define OPENVDB_NO_DEPRECATION_WARNING_END \ 173 _Pragma("warning (pop)") 174 #elif defined __clang__ 175 #define OPENVDB_NO_DEPRECATION_WARNING_BEGIN \ 176 _Pragma("clang diagnostic push") \ 177 _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") 179 #define OPENVDB_NO_DEPRECATION_WARNING_END \ 180 _Pragma("clang diagnostic pop") 181 #elif defined __GNUC__ 182 #define OPENVDB_NO_DEPRECATION_WARNING_BEGIN \ 183 _Pragma("GCC diagnostic push") \ 184 _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") 185 #define OPENVDB_NO_DEPRECATION_WARNING_END \ 186 _Pragma("GCC diagnostic pop") 187 #elif defined _MSC_VER 188 #define OPENVDB_NO_DEPRECATION_WARNING_BEGIN \ 189 __pragma(warning(push)) \ 190 __pragma(warning(disable : 4996)) 191 #define OPENVDB_NO_DEPRECATION_WARNING_END \ 192 __pragma(warning(pop)) 194 #define OPENVDB_NO_DEPRECATION_WARNING_BEGIN 195 #define OPENVDB_NO_DEPRECATION_WARNING_END 209 #if defined __INTEL_COMPILER 210 #define OPENVDB_NO_TYPE_CONVERSION_WARNING_BEGIN 211 #define OPENVDB_NO_TYPE_CONVERSION_WARNING_END 212 #elif defined __GNUC__ 214 #define OPENVDB_NO_TYPE_CONVERSION_WARNING_BEGIN \ 215 _Pragma("GCC diagnostic push") \ 216 _Pragma("GCC diagnostic ignored \"-Wconversion\"") \ 217 _Pragma("GCC diagnostic ignored \"-Wfloat-conversion\"") 218 #define OPENVDB_NO_TYPE_CONVERSION_WARNING_END \ 219 _Pragma("GCC diagnostic pop") 221 #define OPENVDB_NO_TYPE_CONVERSION_WARNING_BEGIN 222 #define OPENVDB_NO_TYPE_CONVERSION_WARNING_END 226 #ifdef OPENVDB_EXPORT 227 #undef OPENVDB_EXPORT 229 #ifdef OPENVDB_IMPORT 230 #undef OPENVDB_IMPORT 234 #define OPENVDB_EXPORT __declspec(dllexport) 235 #define OPENVDB_IMPORT __declspec(dllimport) 237 #define OPENVDB_EXPORT 238 #define OPENVDB_IMPORT 240 #elif defined(__GNUC__) 241 #define OPENVDB_EXPORT __attribute__((visibility("default"))) 242 #define OPENVDB_IMPORT __attribute__((visibility("default"))) 246 #if defined(_WIN32) && defined(OPENVDB_DLL) 247 #ifdef OPENVDB_PRIVATE 248 #define OPENVDB_TEMPLATE_EXPORT OPENVDB_EXPORT 249 #define OPENVDB_TEMPLATE_IMPORT 251 #define OPENVDB_TEMPLATE_EXPORT 252 #define OPENVDB_TEMPLATE_IMPORT OPENVDB_IMPORT 255 #define OPENVDB_TEMPLATE_IMPORT 256 #define OPENVDB_TEMPLATE_EXPORT 265 #ifdef OPENVDB_PRIVATE 266 #define OPENVDB_API OPENVDB_EXPORT 268 #define OPENVDB_API OPENVDB_IMPORT 270 #ifdef OPENVDB_HOUDINI_API 271 #undef OPENVDB_HOUDINI_API 273 #ifdef OPENVDB_HOUDINI_PRIVATE 274 #define OPENVDB_HOUDINI_API OPENVDB_EXPORT 276 #define OPENVDB_HOUDINI_API OPENVDB_IMPORT 279 #ifdef OPENVDB_AX_DLL 280 #ifdef OPENVDB_AX_API 281 #undef OPENVDB_AX_API 283 #ifdef OPENVDB_AX_PRIVATE 284 #define OPENVDB_AX_API OPENVDB_EXPORT 286 #define OPENVDB_AX_API OPENVDB_IMPORT 289 #define OPENVDB_AX_API 290 #endif // OPENVDB_AX_DLL 296 #define OPENVDB_START_THREADSAFE_STATIC_REFERENCE __pragma(warning(disable:1710)) 297 #define OPENVDB_FINISH_THREADSAFE_STATIC_REFERENCE __pragma(warning(default:1710)) 298 #define OPENVDB_START_THREADSAFE_STATIC_WRITE __pragma(warning(disable:1711)) 299 #define OPENVDB_FINISH_THREADSAFE_STATIC_WRITE __pragma(warning(default:1711)) 300 #define OPENVDB_START_THREADSAFE_STATIC_ADDRESS __pragma(warning(disable:1712)) 301 #define OPENVDB_FINISH_THREADSAFE_STATIC_ADDRESS __pragma(warning(default:1712)) 305 #define OPENVDB_START_NON_THREADSAFE_STATIC_REFERENCE __pragma(warning(disable:1710)) 306 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_REFERENCE __pragma(warning(default:1710)) 307 #define OPENVDB_START_NON_THREADSAFE_STATIC_WRITE __pragma(warning(disable:1711)) 308 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_WRITE __pragma(warning(default:1711)) 309 #define OPENVDB_START_NON_THREADSAFE_STATIC_ADDRESS __pragma(warning(disable:1712)) 310 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_ADDRESS __pragma(warning(default:1712)) 313 #define OPENVDB_THREADSAFE_STATIC_REFERENCE(CODE) \ 314 __pragma(warning(disable:1710)); CODE; __pragma(warning(default:1710)) 315 #define OPENVDB_THREADSAFE_STATIC_WRITE(CODE) \ 316 __pragma(warning(disable:1711)); CODE; __pragma(warning(default:1711)) 317 #define OPENVDB_THREADSAFE_STATIC_ADDRESS(CODE) \ 318 __pragma(warning(disable:1712)); CODE; __pragma(warning(default:1712)) 320 #else // GCC does not support these compiler warnings 322 #define OPENVDB_START_THREADSAFE_STATIC_REFERENCE 323 #define OPENVDB_FINISH_THREADSAFE_STATIC_REFERENCE 324 #define OPENVDB_START_THREADSAFE_STATIC_WRITE 325 #define OPENVDB_FINISH_THREADSAFE_STATIC_WRITE 326 #define OPENVDB_START_THREADSAFE_STATIC_ADDRESS 327 #define OPENVDB_FINISH_THREADSAFE_STATIC_ADDRESS 329 #define OPENVDB_START_NON_THREADSAFE_STATIC_REFERENCE 330 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_REFERENCE 331 #define OPENVDB_START_NON_THREADSAFE_STATIC_WRITE 332 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_WRITE 333 #define OPENVDB_START_NON_THREADSAFE_STATIC_ADDRESS 334 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_ADDRESS 336 #define OPENVDB_THREADSAFE_STATIC_REFERENCE(CODE) CODE 337 #define OPENVDB_THREADSAFE_STATIC_WRITE(CODE) CODE 338 #define OPENVDB_THREADSAFE_STATIC_ADDRESS(CODE) CODE 340 #endif // defined(__ICC) 342 #endif // OPENVDB_PLATFORM_HAS_BEEN_INCLUDED