1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef SUPPORT_MSVC_STDLIB_FORCE_INCLUDE_HPP 11 #define SUPPORT_MSVC_STDLIB_FORCE_INCLUDE_HPP 12 13 // This header is force-included when running the libc++ tests against the 14 // MSVC standard library. 15 16 #ifndef _LIBCXX_IN_DEVCRT 17 // Silence warnings about CRT machinery. 18 #define _CRT_SECURE_NO_WARNINGS 19 20 // Avoid assertion dialogs. 21 #define _CRT_SECURE_INVALID_PARAMETER(EXPR) ::abort() 22 #endif // _LIBCXX_IN_DEVCRT 23 24 #include <crtdbg.h> 25 #include <stdlib.h> 26 27 #if defined(_LIBCPP_VERSION) 28 #error This header may not be used when targeting libc++ 29 #endif 30 31 #ifndef _LIBCXX_IN_DEVCRT 32 struct AssertionDialogAvoider { AssertionDialogAvoiderAssertionDialogAvoider33 AssertionDialogAvoider() { 34 _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE); 35 _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); 36 37 _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE); 38 _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); 39 } 40 }; 41 42 const AssertionDialogAvoider assertion_dialog_avoider{}; 43 #endif // _LIBCXX_IN_DEVCRT 44 45 // MSVC frontend only configurations 46 #if !defined(__clang__) 47 // Simulate feature-test macros. 48 #define __has_feature(X) _MSVC_HAS_FEATURE_ ## X 49 #define _MSVC_HAS_FEATURE_cxx_exceptions 1 50 #define _MSVC_HAS_FEATURE_cxx_rtti 1 51 #define _MSVC_HAS_FEATURE_address_sanitizer 0 52 #define _MSVC_HAS_FEATURE_memory_sanitizer 0 53 #define _MSVC_HAS_FEATURE_thread_sanitizer 0 54 55 #define __has_attribute(X) _MSVC_HAS_ATTRIBUTE_ ## X 56 #define _MSVC_HAS_ATTRIBUTE_vector_size 0 57 58 // Silence compiler warnings. 59 #pragma warning(disable: 4180) // qualifier applied to function type has no meaning; ignored 60 #pragma warning(disable: 4324) // structure was padded due to alignment specifier 61 #pragma warning(disable: 4521) // multiple copy constructors specified 62 #pragma warning(disable: 4702) // unreachable code 63 #pragma warning(disable: 28251) // Inconsistent annotation for 'new': this instance has no annotations. 64 #endif // !defined(__clang__) 65 66 // MSVC doesn't have __int128_t. 67 #define _LIBCPP_HAS_NO_INT128 68 69 // MSVC has quick_exit() and at_quick_exit(). 70 #define _LIBCPP_HAS_QUICK_EXIT 71 72 #ifndef _LIBCXX_IN_DEVCRT 73 // atomic_is_lock_free.pass.cpp needs this VS 2015 Update 2 fix. 74 #define _ENABLE_ATOMIC_ALIGNMENT_FIX 75 76 // Silence warnings about features that are deprecated in C++17. 77 #define _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS 78 #endif // _LIBCXX_IN_DEVCRT 79 80 #include <ciso646> 81 82 #if _HAS_CXX17 83 #define TEST_STD_VER 17 84 #else // _HAS_CXX17 85 #define TEST_STD_VER 14 86 #endif // _HAS_CXX17 87 88 #endif // SUPPORT_MSVC_STDLIB_FORCE_INCLUDE_HPP 89