OpenVDB  5.2.0
Platform.h
Go to the documentation of this file.
1 //
3 // Copyright (c) 2012-2018 DreamWorks Animation LLC
4 //
5 // All rights reserved. This software is distributed under the
6 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
7 //
8 // Redistributions of source code must retain the above copyright
9 // and license notice and the following restrictions and disclaimer.
10 //
11 // * Neither the name of DreamWorks Animation nor the names of
12 // its contributors may be used to endorse or promote products derived
13 // from this software without specific prior written permission.
14 //
15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
20 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 // IN NO EVENT SHALL THE COPYRIGHT HOLDERS' AND CONTRIBUTORS' AGGREGATE
27 // LIABILITY FOR ALL CLAIMS REGARDLESS OF THEIR BASIS EXCEED US$250.00.
28 //
32 
33 #ifndef OPENVDB_PLATFORM_HAS_BEEN_INCLUDED
34 #define OPENVDB_PLATFORM_HAS_BEEN_INCLUDED
35 
36 #include "PlatformConfig.h"
37 
38 #define PRAGMA(x) _Pragma(#x)
39 
43 #ifdef OPENVDB_DEPRECATED
44 #undef OPENVDB_DEPRECATED
45 #endif
46 #ifdef _MSC_VER
47  #define OPENVDB_DEPRECATED __declspec(deprecated)
48 #else
49  #define OPENVDB_DEPRECATED __attribute__ ((deprecated))
50 #endif
51 
53 #if defined(__GNUC__)
54  #define OPENVDB_CHECK_GCC(MAJOR, MINOR) \
55  (__GNUC__ > MAJOR || (__GNUC__ == MAJOR && __GNUC_MINOR__ >= MINOR))
56 #else
57  #define OPENVDB_CHECK_GCC(MAJOR, MINOR) 0
58 #endif
59 
61 #ifdef __INTEL_COMPILER
62  #ifdef __INTEL_CXX11_MODE__
63  #define OPENVDB_HAS_CXX11 1
64  #endif
65 #elif defined(__clang__)
66  #ifndef _LIBCPP_VERSION
67  #include <ciso646>
68  #endif
69  #ifdef _LIBCPP_VERSION
70  #define OPENVDB_HAS_CXX11 1
71  #endif
72 #elif defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus > 199711L)
73  #define OPENVDB_HAS_CXX11 1
74 #elif defined(_MSC_VER)
75  #if (_MSC_VER >= 1700)
76  #define OPENVDB_HAS_CXX11 1
77  #endif
78 #endif
79 #if defined(__GNUC__) && !OPENVDB_CHECK_GCC(4, 4)
80  // ICC uses GCC's standard library headers, so even if the ICC version
81  // is recent enough for C++11, the GCC version might not be.
82  #undef OPENVDB_HAS_CXX11
83 #endif
84 
88 #if defined(__GNUC__) && OPENVDB_CHECK_GCC(4, 4)
89  #define OPENVDB_STATIC_SPECIALIZATION
90 #else
91  #define OPENVDB_STATIC_SPECIALIZATION static
92 #endif
93 
94 
110 #if defined(__INTEL_COMPILER)
111  // Disable ICC remarks 111 ("statement is unreachable"), 128 ("loop is not reachable"),
112  // 185 ("dynamic initialization in unreachable code"), and 280 ("selector expression
113  // is constant").
114  #define OPENVDB_NO_UNREACHABLE_CODE_WARNING_BEGIN \
115  _Pragma("warning (push)") \
116  _Pragma("warning (disable:111)") \
117  _Pragma("warning (disable:128)") \
118  _Pragma("warning (disable:185)") \
119  _Pragma("warning (disable:280)")
120  #define OPENVDB_NO_UNREACHABLE_CODE_WARNING_END \
121  _Pragma("warning (pop)")
122 #elif defined(__clang__)
123  #define OPENVDB_NO_UNREACHABLE_CODE_WARNING_BEGIN \
124  PRAGMA(clang diagnostic push) \
125  PRAGMA(clang diagnostic ignored "-Wunreachable-code")
126  #define OPENVDB_NO_UNREACHABLE_CODE_WARNING_END \
127  PRAGMA(clang diagnostic pop)
128 #else
129  #define OPENVDB_NO_UNREACHABLE_CODE_WARNING_BEGIN
130  #define OPENVDB_NO_UNREACHABLE_CODE_WARNING_END
131 #endif
132 
133 
134 #ifdef _MSC_VER
135  #ifndef _USE_MATH_DEFINES
139  #define _USE_MATH_DEFINES
140  #endif
141  #include <boost/math/special_functions/round.hpp>
143  using boost::math::round;
144 #endif
145 
147 #ifdef _MSC_VER
148  #include <float.h>
149  static inline double copysign(double x, double y) { return _copysign(x, y); }
150 #endif
151 
154 #include <boost/cstdint.hpp>
155 using boost::int8_t;
156 using boost::int16_t;
157 using boost::int32_t;
158 using boost::int64_t;
159 using boost::uint8_t;
160 using boost::uint16_t;
161 using boost::uint32_t;
162 using boost::uint64_t;
163 
165 #ifdef OPENVDB_EXPORT
166 #undef OPENVDB_EXPORT
167 #endif
168 #ifdef OPENVDB_IMPORT
169 #undef OPENVDB_IMPORT
170 #endif
171 #ifdef __GNUC__
172  #define OPENVDB_EXPORT __attribute__((visibility("default")))
173  #define OPENVDB_IMPORT __attribute__((visibility("default")))
174 #endif
175 #ifdef _WIN32
176  #ifdef OPENVDB_DLL
177  #define OPENVDB_EXPORT __declspec(dllexport)
178  #define OPENVDB_IMPORT __declspec(dllimport)
179  #else
180  #define OPENVDB_EXPORT
181  #define OPENVDB_IMPORT
182  #endif
183 #endif
184 
188 #ifdef OPENVDB_API
189 #undef OPENVDB_API
190 #endif
191 #ifdef OPENVDB_PRIVATE
192  #define OPENVDB_API OPENVDB_EXPORT
193 #else
194  #define OPENVDB_API OPENVDB_IMPORT
195 #endif
196 #ifdef OPENVDB_HOUDINI_API
197 #undef OPENVDB_HOUDINI_API
198 #endif
199 #ifdef OPENVDB_HOUDINI_PRIVATE
200  #define OPENVDB_HOUDINI_API OPENVDB_EXPORT
201 #else
202  #define OPENVDB_HOUDINI_API OPENVDB_IMPORT
203 #endif
204 
205 #endif // OPENVDB_PLATFORM_HAS_BEEN_INCLUDED
206 
207 // Copyright (c) 2012-2018 DreamWorks Animation LLC
208 // All rights reserved. This software is distributed under the
209 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )