|
13 | 13 | // MSVC standard library.
|
14 | 14 |
|
15 | 15 | #ifndef _LIBCXX_IN_DEVCRT
|
16 |
| - // Silence warnings about CRT machinery. |
17 |
| - #define _CRT_SECURE_NO_WARNINGS 1 |
| 16 | +// Silence warnings about CRT machinery. |
| 17 | +# define _CRT_SECURE_NO_WARNINGS 1 |
18 | 18 |
|
19 |
| - // Avoid assertion dialogs. |
20 |
| - #define _CRT_SECURE_INVALID_PARAMETER(EXPR) ::abort() |
| 19 | +// Avoid assertion dialogs. |
| 20 | +# define _CRT_SECURE_INVALID_PARAMETER(EXPR) ::abort() |
| 21 | + |
| 22 | +// Declare POSIX function names. (By default, Clang -fno-ms-compatibility causes them to be omitted.) |
| 23 | +# define _CRT_DECLARE_NONSTDC_NAMES 1 |
| 24 | + |
| 25 | +// Silence warnings about POSIX function names. |
| 26 | +# define _CRT_NONSTDC_NO_WARNINGS 1 |
| 27 | + |
| 28 | +// Avoid Windows.h macroizing min() and max(). |
| 29 | +# define NOMINMAX 1 |
21 | 30 | #endif // _LIBCXX_IN_DEVCRT
|
22 | 31 |
|
23 | 32 | #include <crtdbg.h>
|
24 | 33 | #include <stdlib.h>
|
25 | 34 |
|
26 | 35 | #if defined(_LIBCPP_VERSION)
|
27 |
| - #error This header may not be used when targeting libc++ |
| 36 | +# error This header may not be used when targeting libc++ |
28 | 37 | #endif
|
29 | 38 |
|
30 | 39 | #ifndef _LIBCXX_IN_DEVCRT
|
31 | 40 | struct AssertionDialogAvoider {
|
32 |
| - AssertionDialogAvoider() { |
33 |
| - _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE); |
34 |
| - _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); |
| 41 | + AssertionDialogAvoider() { |
| 42 | + _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE); |
| 43 | + _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); |
35 | 44 |
|
36 |
| - _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE); |
37 |
| - _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); |
38 |
| - } |
| 45 | + _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE); |
| 46 | + _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); |
| 47 | + } |
39 | 48 | };
|
40 | 49 |
|
41 | 50 | const AssertionDialogAvoider assertion_dialog_avoider{};
|
42 | 51 | #endif // _LIBCXX_IN_DEVCRT
|
43 | 52 |
|
44 | 53 | // MSVC frontend only configurations
|
45 | 54 | #if !defined(__clang__)
|
46 |
| - // Simulate feature-test macros. |
47 |
| - #define __has_feature(X) _MSVC_HAS_FEATURE_ ## X |
48 |
| - #define _MSVC_HAS_FEATURE_cxx_exceptions 1 |
49 |
| - #define _MSVC_HAS_FEATURE_cxx_rtti 1 |
50 |
| - #define _MSVC_HAS_FEATURE_address_sanitizer 0 |
51 |
| - #define _MSVC_HAS_FEATURE_memory_sanitizer 0 |
52 |
| - #define _MSVC_HAS_FEATURE_thread_sanitizer 0 |
53 |
| - |
54 |
| - #define __has_attribute(X) _MSVC_HAS_ATTRIBUTE_ ## X |
55 |
| - #define _MSVC_HAS_ATTRIBUTE_vector_size 0 |
56 |
| - |
57 |
| - // Silence compiler warnings. |
58 |
| - #pragma warning(disable: 4180) // qualifier applied to function type has no meaning; ignored |
59 |
| - #pragma warning(disable: 4324) // structure was padded due to alignment specifier |
60 |
| - #pragma warning(disable: 4521) // multiple copy constructors specified |
61 |
| - #pragma warning(disable: 4702) // unreachable code |
62 |
| - #pragma warning(disable: 28251) // Inconsistent annotation for 'new': this instance has no annotations. |
63 |
| -#endif // !defined(__clang__) |
| 55 | +// Simulate feature-test macros. |
| 56 | +# define __has_feature(X) _MSVC_HAS_FEATURE_##X |
| 57 | +# define _MSVC_HAS_FEATURE_cxx_exceptions 1 |
| 58 | +# define _MSVC_HAS_FEATURE_cxx_rtti 1 |
| 59 | +# define _MSVC_HAS_FEATURE_address_sanitizer 0 |
| 60 | +# define _MSVC_HAS_FEATURE_hwaddress_sanitizer 0 |
| 61 | +# define _MSVC_HAS_FEATURE_memory_sanitizer 0 |
| 62 | +# define _MSVC_HAS_FEATURE_thread_sanitizer 0 |
| 63 | + |
| 64 | +# define __has_attribute(X) _MSVC_HAS_ATTRIBUTE_##X |
| 65 | +# define _MSVC_HAS_ATTRIBUTE_vector_size 0 |
| 66 | + |
| 67 | +// Silence compiler warnings. |
| 68 | +# pragma warning(disable : 4180) // qualifier applied to function type has no meaning; ignored |
| 69 | +# pragma warning(disable : 4324) // structure was padded due to alignment specifier |
| 70 | +# pragma warning(disable : 4521) // multiple copy constructors specified |
| 71 | +# pragma warning(disable : 4702) // unreachable code |
| 72 | +# pragma warning(disable : 28251) // Inconsistent annotation for 'new': this instance has no annotations. |
| 73 | +#endif // !defined(__clang__) |
64 | 74 |
|
65 | 75 | #ifndef _LIBCXX_IN_DEVCRT
|
66 |
| - // atomic_is_lock_free.pass.cpp needs this VS 2015 Update 2 fix. |
67 |
| - #define _ENABLE_ATOMIC_ALIGNMENT_FIX |
| 76 | +// atomic_is_lock_free.pass.cpp needs this VS 2015 Update 2 fix. |
| 77 | +# define _ENABLE_ATOMIC_ALIGNMENT_FIX |
68 | 78 |
|
69 |
| - // Restore features that are removed in C++20. |
70 |
| - #define _HAS_FEATURES_REMOVED_IN_CXX20 1 |
| 79 | +// Restore features that are removed in C++20. |
| 80 | +# define _HAS_FEATURES_REMOVED_IN_CXX20 1 |
71 | 81 |
|
72 |
| - // Silence warnings about the unspecified complex<non-floating-point> |
73 |
| - #define _SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING |
| 82 | +// Silence warnings about the unspecified complex<non-floating-point> |
| 83 | +# define _SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING |
74 | 84 |
|
75 |
| - // Silence warnings about features that are deprecated in non-default language modes. |
76 |
| - #define _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS |
77 |
| - #define _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS |
78 |
| - #define _SILENCE_ALL_CXX23_DEPRECATION_WARNINGS |
| 85 | +// Silence warnings about features that are deprecated in non-default language modes. |
| 86 | +# define _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS |
| 87 | +# define _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS |
| 88 | +# define _SILENCE_ALL_CXX23_DEPRECATION_WARNINGS |
79 | 89 | #endif // _LIBCXX_IN_DEVCRT
|
80 | 90 |
|
81 | 91 | #include <version>
|
82 | 92 |
|
83 | 93 | #if _HAS_CXX23
|
84 |
| - #define TEST_STD_VER 99 |
| 94 | +# define TEST_STD_VER 99 |
85 | 95 | #elif _HAS_CXX20
|
86 |
| - #define TEST_STD_VER 20 |
| 96 | +# define TEST_STD_VER 20 |
87 | 97 | #elif _HAS_CXX17
|
88 |
| - #define TEST_STD_VER 17 |
| 98 | +# define TEST_STD_VER 17 |
89 | 99 | #else
|
90 |
| - #define TEST_STD_VER 14 |
| 100 | +# define TEST_STD_VER 14 |
91 | 101 | #endif
|
92 | 102 |
|
93 | 103 | #define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
|
94 | 104 |
|
95 | 105 | #ifdef __clang__
|
96 |
| -#define _LIBCPP_SUPPRESS_DEPRECATED_PUSH \ |
97 |
| - _Pragma("GCC diagnostic push") \ |
98 |
| - _Pragma("GCC diagnostic ignored \"-Wdeprecated\"") |
99 |
| -#define _LIBCPP_SUPPRESS_DEPRECATED_POP \ |
100 |
| - _Pragma("GCC diagnostic pop") |
| 106 | +# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH \ |
| 107 | + _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wdeprecated\"") |
| 108 | +# define _LIBCPP_SUPPRESS_DEPRECATED_POP _Pragma("GCC diagnostic pop") |
101 | 109 | #else // ^^^ clang / MSVC vvv
|
102 |
| -#define _LIBCPP_SUPPRESS_DEPRECATED_PUSH \ |
103 |
| - __pragma(warning(push)) \ |
104 |
| - __pragma(warning(disable : 4996)) \ |
105 |
| - __pragma(warning(disable : 5215)) |
106 |
| -#define _LIBCPP_SUPPRESS_DEPRECATED_POP \ |
107 |
| - __pragma(warning(pop)) |
| 110 | +# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH \ |
| 111 | + __pragma(warning(push)) __pragma(warning(disable : 4996)) __pragma(warning(disable : 5215)) |
| 112 | +# define _LIBCPP_SUPPRESS_DEPRECATED_POP __pragma(warning(pop)) |
108 | 113 | #endif // __clang__
|
109 | 114 |
|
110 | 115 | #endif // SUPPORT_MSVC_STDLIB_FORCE_INCLUDE_H
|
0 commit comments