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 // Silence warnings about CRT machinery. 17 #define _CRT_SECURE_NO_WARNINGS 18 19 // Avoid assertion dialogs. 20 #define _CRT_SECURE_INVALID_PARAMETER(EXPR) ::abort() 21 22 #include <crtdbg.h> 23 #include <stdlib.h> 24 25 #if defined(_LIBCPP_VERSION) 26 #error This header may not be used when targeting libc++ 27 #endif 28 29 struct AssertionDialogAvoider { 30 AssertionDialogAvoider() { 31 _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE); 32 _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); 33 34 _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE); 35 _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); 36 } 37 }; 38 39 const AssertionDialogAvoider assertion_dialog_avoider{}; 40 41 // MSVC frontend only configurations 42 #if !defined(__clang__) 43 #define TEST_STD_VER 17 44 45 // Simulate feature-test macros. 46 #define __has_feature(X) _MSVC_HAS_FEATURE_ ## X 47 #define _MSVC_HAS_FEATURE_cxx_exceptions 1 48 #define _MSVC_HAS_FEATURE_cxx_rtti 1 49 #define _MSVC_HAS_FEATURE_address_sanitizer 0 50 #define _MSVC_HAS_FEATURE_memory_sanitizer 0 51 #define _MSVC_HAS_FEATURE_thread_sanitizer 0 52 53 // Silence compiler warnings. 54 #pragma warning(disable: 4180) // qualifier applied to function type has no meaning; ignored 55 #pragma warning(disable: 4521) // multiple copy constructors specified 56 #pragma warning(disable: 4702) // unreachable code 57 #pragma warning(disable: 6294) // Ill-defined for-loop: initial condition does not satisfy test. Loop body not executed. 58 #pragma warning(disable: 28251) // Inconsistent annotation for 'new': this instance has no annotations. 59 #endif // !defined(__clang__) 60 61 // MSVC doesn't have __int128_t. 62 #define _LIBCPP_HAS_NO_INT128 63 64 // MSVC has quick_exit() and at_quick_exit(). 65 #define _LIBCPP_HAS_QUICK_EXIT 66 67 // atomic_is_lock_free.pass.cpp needs this VS 2015 Update 2 fix. 68 #define _ENABLE_ATOMIC_ALIGNMENT_FIX 69 70 // Enable features that /std:c++latest removes by default. 71 #define _HAS_AUTO_PTR_ETC 1 72 #define _HAS_FUNCTION_ASSIGN 1 73 #define _HAS_OLD_IOSTREAMS_MEMBERS 1 74 75 // Silence warnings about raw pointers and other unchecked iterators. 76 #define _SCL_SECURE_NO_WARNINGS 77 78 #endif // SUPPORT_MSVC_STDLIB_FORCE_INCLUDE_HPP 79