28 #if _MSC_VER //>= 1400
43 #define gsInfo std::cout
50 #define gsWarn std::cout<<"Warning: "
61 #define gsDebug std::cout<<"GISMO_DEBUG: "
63 #define gsDebugVar(variable) gsDebug << (strrchr(__FILE__, '/') ? \
64 strrchr(__FILE__, '/') + 1 : __FILE__) <<":"<< \
65 __LINE__<< ", "#variable": \n"<<(variable)<<std::endl
66 #define gsDebugIf(cond,variable) if (cond) gsDebug <<"[ "#cond" ] -- "<< \
67 (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) \
68 <<":"<<__LINE__<< ", "#variable": \n"<<(variable)<<std::endl
70 #define gsDebug if (0) std::cout
71 #define gsDebugVar(variable)
72 #define gsDebugIf(cond,variable)
82 #define GISMO_HPP_HEADER(x) #x
89 # define GISMO_ASSERT(cond, message) do if(!(cond)) {std::cerr \
90 <<"Assert `"<<#cond<<"` "<<message<<"\n"<<__FILE__<<", line "\
91 <<__LINE__<<" ("<<__FUNCTION__<<")"<<std::endl; \
92 throw std::logic_error("GISMO_ASSERT"); } while(false)
94 # define GISMO_ASSERT(condition, message)
102 #define GISMO_ENSURE(cond, message) do if(!(cond)) {std::cerr \
103 <<"Ensure `"<<#cond<<"` "<<message<<"\n"<<__FILE__<<", line " \
104 <<__LINE__<<" ("<< __FUNCTION__<< ")"<<std::endl; \
105 throw std::runtime_error("GISMO_ENSURE");} while(false)
112 #define GISMO_UNUSED(x) static_cast<void>(x)
118 #define GISMO_ERROR(message) do {std::cerr <<"Error " <<message<<"\n"\
119 <<__FILE__<<", line " <<__LINE__<<" ("<<__FUNCTION__<<")"<<std::endl; \
120 throw std::runtime_error("GISMO_ERROR");} while(false)
129 #define GISMO_NO_IMPLEMENTATION {std::cerr \
130 <<"Virtual member function `"<<__FUNCTION__<<"` has not been implemented\n" \
131 <<__FILE__<<", line "<<__LINE__<<"\n"<<typeid(*this).name()<<std::endl; \
132 throw std::runtime_error("GISMO_NO_IMPLEMENTATION");}
156 template <
typename T>
bool gsIsnan (T a) {
return a != a;}
162 template <
typename T>
bool gsIsfinite(T a) {
return (a - a) == (a - a);}
174 #if _MSC_VER //>= 1400
175 static const int gismo_CrtSetReportMode = _CrtSetReportMode(
176 _CRT_ASSERT, _CRTDBG_MODE_FILE );
177 static const _HFILE gismo_CrtSetReportFile = _CrtSetReportFile(
178 _CRT_ASSERT, _CRTDBG_FILE_STDERR );
179 static const int gismo_set_abort_behavior = _set_abort_behavior(
180 0x0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
216 #pragma warning( push )
217 #pragma warning( disable : 4100 4127 4146 4231 4251 4428 4275 4503 4505 4512 4566 4661 4714 4789 4996 4510 4610 4752)
219 #elif defined __INTEL_COMPILER
229 #pragma warning disable 2196 279 161 175
231 #elif defined __clang__
234 #pragma clang diagnostic push
235 #pragma clang diagnostic ignored "-Wconstant-logical-operand"
236 #pragma clang diagnostic ignored "-Wbind-to-temporary-copy"
238 #elif defined __GNUC__ // major version >=4
240 #if ( __GNUC__>4 || (__GNUC__==4 && __GNUC_MINOR__>7) )
241 #pragma GCC diagnostic ignored "-Wunused-local-typedefs"
244 #if (__cplusplus < 201703L && __GNUC__>6)
247 #pragma GCC diagnostic ignored "-Wnoexcept-type"
266 #ifndef GISMO_NO_STATIC_ASSERT
268 #if defined(__GXX_EXPERIMENTAL_CXX0X__) || _MSC_VER >= 1600
271 #define GISMO_STATIC_ASSERT(X,MSG) static_assert(X,#MSG);
278 template<
bool condition>
struct static_assertion {};
279 template<>
struct static_assertion<true> {
enum { STATIC_ASSERTION_FAILED }; };
289 #define GISMO_STATIC_ASSERT(CONDITION,MSG) \
290 {gismo::internal::static_assertion<bool(CONDITION)>::STATIC_ASSERTION_FAILED;}
294 #define GISMO_STATIC_ASSERT(CONDITION,MSG) \
295 if (gismo::internal::static_assertion<bool(CONDITION)>::STATIC_ASSERTION_FAILED) {}
301 #else // GISMO_NO_STATIC_ASSERT
303 #define GISMO_STATIC_ASSERT(CONDITION,MSG) GISMO_ASSERT(CONDITION, #MSG);
305 #endif // GISMO_NO_STATIC_ASSERT
309 #ifdef GISMO_WITH_WARNINGS
312 #define GISMO_DEPRECATED __attribute__((deprecated))
313 #elif defined(_MSC_VER)
314 #define GISMO_DEPRECATED __declspec(deprecated)
316 #define GISMO_DEPRECATED
319 #define GISMO_DEPRECATED
bool gsIsnumber(T a)
Definition: gsDebug.h:155
bool gsIsfinite(T a)
Definition: gsDebug.h:162