1e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier//===----------------------------------------------------------------------===// 2e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier// 3e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier// The LLVM Compiler Infrastructure 4e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier// 5e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier// This file is dual licensed under the MIT and the University of Illinois Open 6e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier// Source Licenses. See LICENSE.TXT for details. 7e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier// 8e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier//===----------------------------------------------------------------------===// 9e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier 10e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier#ifndef SUPPORT_MSVC_STDLIB_FORCE_INCLUDE_HPP 11e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier#define SUPPORT_MSVC_STDLIB_FORCE_INCLUDE_HPP 12e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier 13e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier// This header is force-included when running the libc++ tests against the 14e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier// MSVC standard library. 15e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier 1602af098ef7e48d774036632ccdf67a3f52aab6edStephan T. Lavavej// Silence warnings about CRT machinery. 1702af098ef7e48d774036632ccdf67a3f52aab6edStephan T. Lavavej#define _CRT_SECURE_NO_WARNINGS 1802af098ef7e48d774036632ccdf67a3f52aab6edStephan T. Lavavej 19e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier// Avoid assertion dialogs. 20e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier#define _CRT_SECURE_INVALID_PARAMETER(EXPR) ::abort() 21e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier 22e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier#include <crtdbg.h> 23e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier#include <stdlib.h> 24e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier 25e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier#if defined(_LIBCPP_VERSION) 2602af098ef7e48d774036632ccdf67a3f52aab6edStephan T. Lavavej #error This header may not be used when targeting libc++ 27e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier#endif 28e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier 29e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselierstruct AssertionDialogAvoider { 30e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier AssertionDialogAvoider() { 31e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE); 32e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); 33e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier 34e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE); 35e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); 36e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier } 37e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier}; 38e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier 39e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselierconst AssertionDialogAvoider assertion_dialog_avoider{}; 40e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier 41e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier// MSVC frontend only configurations 42e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier#if !defined(__clang__) 4302af098ef7e48d774036632ccdf67a3f52aab6edStephan T. Lavavej #define TEST_STD_VER 17 4402af098ef7e48d774036632ccdf67a3f52aab6edStephan T. Lavavej 4502af098ef7e48d774036632ccdf67a3f52aab6edStephan T. Lavavej // Simulate feature-test macros. 4602af098ef7e48d774036632ccdf67a3f52aab6edStephan T. Lavavej #define __has_feature(X) _MSVC_HAS_FEATURE_ ## X 4702af098ef7e48d774036632ccdf67a3f52aab6edStephan T. Lavavej #define _MSVC_HAS_FEATURE_cxx_exceptions 1 4802af098ef7e48d774036632ccdf67a3f52aab6edStephan T. Lavavej #define _MSVC_HAS_FEATURE_cxx_rtti 1 4902af098ef7e48d774036632ccdf67a3f52aab6edStephan T. Lavavej #define _MSVC_HAS_FEATURE_address_sanitizer 0 5002af098ef7e48d774036632ccdf67a3f52aab6edStephan T. Lavavej #define _MSVC_HAS_FEATURE_memory_sanitizer 0 5102af098ef7e48d774036632ccdf67a3f52aab6edStephan T. Lavavej #define _MSVC_HAS_FEATURE_thread_sanitizer 0 5202af098ef7e48d774036632ccdf67a3f52aab6edStephan T. Lavavej 5302af098ef7e48d774036632ccdf67a3f52aab6edStephan T. Lavavej // Silence compiler warnings. 5402af098ef7e48d774036632ccdf67a3f52aab6edStephan T. Lavavej #pragma warning(disable: 4180) // qualifier applied to function type has no meaning; ignored 5502af098ef7e48d774036632ccdf67a3f52aab6edStephan T. Lavavej #pragma warning(disable: 4521) // multiple copy constructors specified 5602af098ef7e48d774036632ccdf67a3f52aab6edStephan T. Lavavej #pragma warning(disable: 4702) // unreachable code 5702af098ef7e48d774036632ccdf67a3f52aab6edStephan T. Lavavej #pragma warning(disable: 6294) // Ill-defined for-loop: initial condition does not satisfy test. Loop body not executed. 5802af098ef7e48d774036632ccdf67a3f52aab6edStephan T. Lavavej #pragma warning(disable: 28251) // Inconsistent annotation for 'new': this instance has no annotations. 59e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier#endif // !defined(__clang__) 60e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier 61e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier// MSVC doesn't have __int128_t. 62e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier#define _LIBCPP_HAS_NO_INT128 63e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier 64e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier// MSVC has quick_exit() and at_quick_exit(). 65e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier#define _LIBCPP_HAS_QUICK_EXIT 66e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier 67e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier// atomic_is_lock_free.pass.cpp needs this VS 2015 Update 2 fix. 68e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier#define _ENABLE_ATOMIC_ALIGNMENT_FIX 69e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier 70e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier// Enable features that /std:c++latest removes by default. 71e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier#define _HAS_AUTO_PTR_ETC 1 72e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier#define _HAS_FUNCTION_ASSIGN 1 73e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier#define _HAS_OLD_IOSTREAMS_MEMBERS 1 74e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier 75e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier// Silence warnings about raw pointers and other unchecked iterators. 76e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier#define _SCL_SECURE_NO_WARNINGS 77e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier 78e70e03c7f6e7be329ab7edcf28f4cdf2ff4aad7cEric Fiselier#endif // SUPPORT_MSVC_STDLIB_FORCE_INCLUDE_HPP 79