File indexing completed on 2025-01-30 10:02:49
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED
0009 #define CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 #include <catch2/internal/catch_platform.hpp>
0028 #include <catch2/catch_user_config.hpp>
0029
0030 #ifdef __cplusplus
0031
0032 # if (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L)
0033 # define CATCH_CPP14_OR_GREATER
0034 # endif
0035
0036 # if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
0037 # define CATCH_CPP17_OR_GREATER
0038 # endif
0039
0040 #endif
0041
0042
0043
0044 #if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && !defined(__CUDACC__) && !defined(__LCC__) && !defined(__NVCOMPILER)
0045 # define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic push" )
0046 # define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic pop" )
0047
0048
0049
0050 # define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \
0051 _Pragma( "GCC diagnostic ignored \"-Wparentheses\"" )
0052
0053 # define CATCH_INTERNAL_SUPPRESS_UNUSED_RESULT \
0054 _Pragma( "GCC diagnostic ignored \"-Wunused-result\"" )
0055
0056 # define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \
0057 _Pragma( "GCC diagnostic ignored \"-Wunused-variable\"" )
0058
0059 # define CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS \
0060 _Pragma( "GCC diagnostic ignored \"-Wuseless-cast\"" )
0061
0062 # define CATCH_INTERNAL_SUPPRESS_SHADOW_WARNINGS \
0063 _Pragma( "GCC diagnostic ignored \"-Wshadow\"" )
0064
0065 # define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__)
0066
0067 #endif
0068
0069 #if defined(__NVCOMPILER)
0070 # define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "diag push" )
0071 # define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "diag pop" )
0072 # define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS _Pragma( "diag_suppress declared_but_not_referenced" )
0073 #endif
0074
0075 #if defined(__CUDACC__) && !defined(__clang__)
0076 # ifdef __NVCC_DIAG_PRAGMA_SUPPORT__
0077
0078 # define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "nv_diagnostic push" )
0079 # define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "nv_diagnostic pop" )
0080 # define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS _Pragma( "nv_diag_suppress 177" )
0081 # else
0082 # define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS _Pragma( "diag_suppress 177" )
0083 # endif
0084 #endif
0085
0086
0087
0088 #if defined(__clang__) && !defined(_MSC_VER)
0089
0090 # define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic push" )
0091 # define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic pop" )
0092
0093 #endif
0094
0095 #if defined(__clang__)
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113 # if !defined(__ibmxl__) && !defined(__CUDACC__) && !defined( __NVCOMPILER )
0114 # define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__)
0115 # endif
0116
0117
0118 # define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
0119 _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" ) \
0120 _Pragma( "clang diagnostic ignored \"-Wglobal-constructors\"")
0121
0122 # define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \
0123 _Pragma( "clang diagnostic ignored \"-Wparentheses\"" )
0124
0125 # define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \
0126 _Pragma( "clang diagnostic ignored \"-Wunused-variable\"" )
0127
0128 # define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \
0129 _Pragma( "clang diagnostic ignored \"-Wgnu-zero-variadic-macro-arguments\"" )
0130
0131 # define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \
0132 _Pragma( "clang diagnostic ignored \"-Wunused-template\"" )
0133
0134 # define CATCH_INTERNAL_SUPPRESS_COMMA_WARNINGS \
0135 _Pragma( "clang diagnostic ignored \"-Wcomma\"" )
0136
0137 # define CATCH_INTERNAL_SUPPRESS_SHADOW_WARNINGS \
0138 _Pragma( "clang diagnostic ignored \"-Wshadow\"" )
0139
0140 #endif
0141
0142
0143
0144
0145 #if defined( CATCH_PLATFORM_WINDOWS ) || \
0146 defined( CATCH_PLATFORM_PLAYSTATION ) || \
0147 defined( __CYGWIN__ ) || \
0148 defined( __QNX__ ) || \
0149 defined( __EMSCRIPTEN__ ) || \
0150 defined( __DJGPP__ ) || \
0151 defined( __OS400__ )
0152 # define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS
0153 #else
0154 # define CATCH_INTERNAL_CONFIG_POSIX_SIGNALS
0155 #endif
0156
0157
0158
0159 #if defined(CATCH_PLATFORM_WINDOWS_UWP) || defined(CATCH_PLATFORM_PLAYSTATION)
0160 # define CATCH_INTERNAL_CONFIG_NO_GETENV
0161 #else
0162 # define CATCH_INTERNAL_CONFIG_GETENV
0163 #endif
0164
0165
0166
0167 #if defined(__ANDROID__)
0168 # define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING
0169 #endif
0170
0171
0172
0173 #if defined(__MINGW32__)
0174 # define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH
0175 #endif
0176
0177
0178
0179 #if defined(__ORBIS__)
0180 # define CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE
0181 #endif
0182
0183
0184
0185 #ifdef __CYGWIN__
0186
0187
0188
0189 # define _BSD_SOURCE
0190
0191
0192 # if !((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \
0193 && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF))
0194
0195 # define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING
0196
0197 # endif
0198 #endif
0199
0200
0201
0202 #if defined(_MSC_VER)
0203
0204
0205
0206 # if !defined( __CUDACC__ )
0207 # define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \
0208 __pragma( warning( push ) )
0209 # define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \
0210 __pragma( warning( pop ) )
0211 # endif
0212
0213
0214
0215 # if defined(CATCH_PLATFORM_WINDOWS_UWP)
0216 # define CATCH_INTERNAL_CONFIG_NO_COLOUR_WIN32
0217 # else
0218 # define CATCH_INTERNAL_CONFIG_WINDOWS_SEH
0219 # endif
0220
0221
0222
0223
0224 # if !defined(__clang__)
0225 # if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL)
0226 # define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
0227 # endif
0228 # endif
0229
0230 #endif
0231
0232 #if defined(_REENTRANT) || defined(_MSC_VER)
0233
0234 # define CATCH_INTERNAL_CONFIG_USE_ASYNC
0235 #endif
0236
0237
0238
0239 #if defined(__EXCEPTIONS) || defined(__cpp_exceptions) || defined(_CPPUNWIND)
0240 # define CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED
0241 #endif
0242
0243
0244
0245
0246 #if defined(__BORLANDC__)
0247 #define CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN
0248 #endif
0249
0250
0251
0252
0253
0254
0255 #if defined(UNDER_RTSS) || defined(RTX64_BUILD)
0256 #define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH
0257 #define CATCH_INTERNAL_CONFIG_NO_ASYNC
0258 #define CATCH_INTERNAL_CONFIG_NO_COLOUR_WIN32
0259 #endif
0260
0261 #if !defined(_GLIBCXX_USE_C99_MATH_TR1)
0262 #define CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER
0263 #endif
0264
0265
0266 #if defined(__has_include)
0267
0268 #if __has_include(<string_view>) && defined(CATCH_CPP17_OR_GREATER)
0269 # define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW
0270 #endif
0271
0272
0273 # if __has_include(<optional>) && defined(CATCH_CPP17_OR_GREATER)
0274 # define CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL
0275 # endif
0276
0277
0278 # if __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER)
0279 # include <cstddef>
0280 # if defined(__cpp_lib_byte) && (__cpp_lib_byte > 0)
0281 # define CATCH_INTERNAL_CONFIG_CPP17_BYTE
0282 # endif
0283 # endif
0284
0285
0286 # if __has_include(<variant>) && defined(CATCH_CPP17_OR_GREATER)
0287 # if defined(__clang__) && (__clang_major__ < 8)
0288
0289
0290 # include <ciso646>
0291 # if defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9)
0292 # define CATCH_CONFIG_NO_CPP17_VARIANT
0293 # else
0294 # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT
0295 # endif
0296 # else
0297 # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT
0298 # endif
0299 # endif
0300 #endif
0301
0302
0303 #if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH) && !defined(CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH)
0304 # define CATCH_CONFIG_WINDOWS_SEH
0305 #endif
0306
0307 #if defined(CATCH_INTERNAL_CONFIG_POSIX_SIGNALS) && !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_POSIX_SIGNALS)
0308 # define CATCH_CONFIG_POSIX_SIGNALS
0309 #endif
0310
0311 #if defined(CATCH_INTERNAL_CONFIG_GETENV) && !defined(CATCH_INTERNAL_CONFIG_NO_GETENV) && !defined(CATCH_CONFIG_NO_GETENV) && !defined(CATCH_CONFIG_GETENV)
0312 # define CATCH_CONFIG_GETENV
0313 #endif
0314
0315 #if !defined(CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_CPP11_TO_STRING)
0316 # define CATCH_CONFIG_CPP11_TO_STRING
0317 #endif
0318
0319 #if defined(CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_NO_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_CPP17_OPTIONAL)
0320 # define CATCH_CONFIG_CPP17_OPTIONAL
0321 #endif
0322
0323 #if defined(CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_NO_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_CPP17_STRING_VIEW)
0324 # define CATCH_CONFIG_CPP17_STRING_VIEW
0325 #endif
0326
0327 #if defined(CATCH_INTERNAL_CONFIG_CPP17_VARIANT) && !defined(CATCH_CONFIG_NO_CPP17_VARIANT) && !defined(CATCH_CONFIG_CPP17_VARIANT)
0328 # define CATCH_CONFIG_CPP17_VARIANT
0329 #endif
0330
0331 #if defined(CATCH_INTERNAL_CONFIG_CPP17_BYTE) && !defined(CATCH_CONFIG_NO_CPP17_BYTE) && !defined(CATCH_CONFIG_CPP17_BYTE)
0332 # define CATCH_CONFIG_CPP17_BYTE
0333 #endif
0334
0335
0336 #if defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT)
0337 # define CATCH_INTERNAL_CONFIG_NEW_CAPTURE
0338 #endif
0339
0340 #if defined(CATCH_INTERNAL_CONFIG_NEW_CAPTURE) && !defined(CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NEW_CAPTURE)
0341 # define CATCH_CONFIG_NEW_CAPTURE
0342 #endif
0343
0344 #if !defined( CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED ) && \
0345 !defined( CATCH_CONFIG_DISABLE_EXCEPTIONS ) && \
0346 !defined( CATCH_CONFIG_NO_DISABLE_EXCEPTIONS )
0347 # define CATCH_CONFIG_DISABLE_EXCEPTIONS
0348 #endif
0349
0350 #if defined(CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_NO_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_POLYFILL_ISNAN)
0351 # define CATCH_CONFIG_POLYFILL_ISNAN
0352 #endif
0353
0354 #if defined(CATCH_INTERNAL_CONFIG_USE_ASYNC) && !defined(CATCH_INTERNAL_CONFIG_NO_ASYNC) && !defined(CATCH_CONFIG_NO_USE_ASYNC) && !defined(CATCH_CONFIG_USE_ASYNC)
0355 # define CATCH_CONFIG_USE_ASYNC
0356 #endif
0357
0358 #if defined(CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER) && !defined(CATCH_CONFIG_NO_GLOBAL_NEXTAFTER) && !defined(CATCH_CONFIG_GLOBAL_NEXTAFTER)
0359 # define CATCH_CONFIG_GLOBAL_NEXTAFTER
0360 #endif
0361
0362
0363
0364
0365 #if !defined(CATCH_INTERNAL_START_WARNINGS_SUPPRESSION)
0366 # define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION
0367 #endif
0368 #if !defined(CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION)
0369 # define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
0370 #endif
0371 #if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS)
0372 # define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS
0373 #endif
0374 #if !defined(CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS)
0375 # define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS
0376 #endif
0377 #if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_RESULT)
0378 # define CATCH_INTERNAL_SUPPRESS_UNUSED_RESULT
0379 #endif
0380 #if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS)
0381 # define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS
0382 #endif
0383 #if !defined(CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS)
0384 # define CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS
0385 #endif
0386 #if !defined(CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS)
0387 # define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS
0388 #endif
0389 #if !defined( CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS )
0390 # define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS
0391 #endif
0392 #if !defined( CATCH_INTERNAL_SUPPRESS_COMMA_WARNINGS )
0393 # define CATCH_INTERNAL_SUPPRESS_COMMA_WARNINGS
0394 #endif
0395 #if !defined( CATCH_INTERNAL_SUPPRESS_SHADOW_WARNINGS )
0396 # define CATCH_INTERNAL_SUPPRESS_SHADOW_WARNINGS
0397 #endif
0398
0399
0400
0401
0402 #if !defined(CATCH_INTERNAL_IGNORE_BUT_WARN)
0403 # define CATCH_INTERNAL_IGNORE_BUT_WARN(...)
0404 #endif
0405
0406 #if defined(__APPLE__) && defined(__apple_build_version__) && (__clang_major__ < 10)
0407 # undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS
0408 #elif defined(__clang__) && (__clang_major__ < 5)
0409 # undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS
0410 #endif
0411
0412
0413 #if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
0414 #define CATCH_TRY if ((true))
0415 #define CATCH_CATCH_ALL if ((false))
0416 #define CATCH_CATCH_ANON(type) if ((false))
0417 #else
0418 #define CATCH_TRY try
0419 #define CATCH_CATCH_ALL catch (...)
0420 #define CATCH_CATCH_ANON(type) catch (type)
0421 #endif
0422
0423 #if defined(CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_NO_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR)
0424 #define CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
0425 #endif
0426
0427 #if defined( CATCH_PLATFORM_WINDOWS ) && \
0428 !defined( CATCH_CONFIG_COLOUR_WIN32 ) && \
0429 !defined( CATCH_CONFIG_NO_COLOUR_WIN32 ) && \
0430 !defined( CATCH_INTERNAL_CONFIG_NO_COLOUR_WIN32 )
0431 # define CATCH_CONFIG_COLOUR_WIN32
0432 #endif
0433
0434 #if defined( CATCH_CONFIG_SHARED_LIBRARY ) && defined( _MSC_VER ) && \
0435 !defined( CATCH_CONFIG_STATIC )
0436 # ifdef Catch2_EXPORTS
0437 # define CATCH_EXPORT
0438 # else
0439 # define CATCH_EXPORT __declspec( dllimport )
0440 # endif
0441 #else
0442 # define CATCH_EXPORT
0443 #endif
0444
0445 #endif