@@ -82,6 +82,92 @@ namespace cv { namespace debug_build_guard { } using namespace debug_build_guard
8282#define __CV_VA_NUM_ARGS_HELPER (_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N
8383#define __CV_VA_NUM_ARGS (...) __CV_VA_NUM_ARGS_HELPER(__VA_ARGS__, 10 , 9 , 8 , 7 , 6 , 5 , 4 , 3 , 2 , 1 , 0 )
8484
85+ #if defined __GNUC__
86+ #define CV_Func __func__
87+ #elif defined _MSC_VER
88+ #define CV_Func __FUNCTION__
89+ #else
90+ #define CV_Func " "
91+ #endif
92+
93+ // ! @cond IGNORED
94+
95+ // ////////////// static assert /////////////////
96+ #define CVAUX_CONCAT_EXP (a, b ) a##b
97+ #define CVAUX_CONCAT (a, b ) CVAUX_CONCAT_EXP(a,b)
98+
99+ #if defined(__clang__)
100+ # ifndef __has_extension
101+ # define __has_extension __has_feature /* compatibility, for older versions of clang */
102+ # endif
103+ # if __has_extension(cxx_static_assert)
104+ # define CV_StaticAssert (condition, reason ) static_assert ((condition), reason " " #condition)
105+ # elif __has_extension(c_static_assert)
106+ # define CV_StaticAssert (condition, reason ) _Static_assert ((condition), reason " " #condition)
107+ # endif
108+ #elif defined(__GNUC__)
109+ # if (defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L)
110+ # define CV_StaticAssert (condition, reason ) static_assert ((condition), reason " " #condition)
111+ # endif
112+ #elif defined(_MSC_VER)
113+ # if _MSC_VER >= 1600 /* MSVC 10 */
114+ # define CV_StaticAssert (condition, reason ) static_assert ((condition), reason " " #condition)
115+ # endif
116+ #endif
117+ #ifndef CV_StaticAssert
118+ # if !defined(__clang__) && defined(__GNUC__) && (__GNUC__*100 + __GNUC_MINOR__ > 302)
119+ # define CV_StaticAssert (condition, reason ) ({ extern int __attribute__ ((error (" CV_StaticAssert: " reason " " #condition))) CV_StaticAssert (); ((condition) ? 0 : CV_StaticAssert ()); })
120+ # else
121+ template <bool x> struct CV_StaticAssert_failed ;
122+ template <> struct CV_StaticAssert_failed <true > { enum { val = 1 }; };
123+ template <int x> struct CV_StaticAssert_test {};
124+ # define CV_StaticAssert (condition, reason )\
125+ typedef cv::CV_StaticAssert_test< sizeof (cv::CV_StaticAssert_failed< static_cast <bool >(condition) >) > CVAUX_CONCAT (CV_StaticAssert_failed_at_, __LINE__)
126+ # endif
127+ #endif
128+
129+ // Suppress warning "-Wdeprecated-declarations" / C4996
130+ #if defined(_MSC_VER)
131+ #define CV_DO_PRAGMA (x ) __pragma(x)
132+ #elif defined(__GNUC__)
133+ #define CV_DO_PRAGMA (x ) _Pragma (#x)
134+ #else
135+ #define CV_DO_PRAGMA (x )
136+ #endif
137+
138+ #ifdef _MSC_VER
139+ #define CV_SUPPRESS_DEPRECATED_START \
140+ CV_DO_PRAGMA (warning(push)) \
141+ CV_DO_PRAGMA(warning(disable: 4996 ))
142+ #define CV_SUPPRESS_DEPRECATED_END CV_DO_PRAGMA (warning(pop))
143+ #elif defined (__clang__) || ((__GNUC__) && (__GNUC__*100 + __GNUC_MINOR__ > 405))
144+ #define CV_SUPPRESS_DEPRECATED_START \
145+ CV_DO_PRAGMA (GCC diagnostic push) \
146+ CV_DO_PRAGMA(GCC diagnostic ignored " -Wdeprecated-declarations" )
147+ #define CV_SUPPRESS_DEPRECATED_END CV_DO_PRAGMA (GCC diagnostic pop)
148+ #else
149+ #define CV_SUPPRESS_DEPRECATED_START
150+ #define CV_SUPPRESS_DEPRECATED_END
151+ #endif
152+
153+ #define CV_UNUSED (name ) (void )name
154+
155+ #if defined __GNUC__ && !defined __EXCEPTIONS
156+ #define CV_TRY
157+ #define CV_CATCH (A, B ) for (A B; false ; )
158+ #define CV_CATCH_ALL if (false )
159+ #define CV_THROW (A ) abort()
160+ #define CV_RETHROW () abort()
161+ #else
162+ #define CV_TRY try
163+ #define CV_CATCH (A, B ) catch (const A & B)
164+ #define CV_CATCH_ALL catch (...)
165+ #define CV_THROW (A ) throw A
166+ #define CV_RETHROW () throw
167+ #endif
168+
169+ // ! @endcond
170+
85171// undef problematic defines sometimes defined by system headers (windows.h in particular)
86172#undef small
87173#undef min
0 commit comments