2017-01-20 07:48:05 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
|
|
// Source Licenses. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef SUPPORT_MSVC_STDLIB_FORCE_INCLUDE_HPP
|
|
|
|
#define SUPPORT_MSVC_STDLIB_FORCE_INCLUDE_HPP
|
|
|
|
|
|
|
|
// This header is force-included when running the libc++ tests against the
|
|
|
|
// MSVC standard library.
|
|
|
|
|
2017-05-11 03:10:49 +08:00
|
|
|
#ifndef _LIBCXX_IN_DEVCRT
|
|
|
|
// Silence warnings about CRT machinery.
|
|
|
|
#define _CRT_SECURE_NO_WARNINGS
|
2017-02-06 06:48:02 +08:00
|
|
|
|
2017-05-11 03:10:49 +08:00
|
|
|
// Avoid assertion dialogs.
|
|
|
|
#define _CRT_SECURE_INVALID_PARAMETER(EXPR) ::abort()
|
|
|
|
#endif // _LIBCXX_IN_DEVCRT
|
2017-01-20 07:48:05 +08:00
|
|
|
|
|
|
|
#include <crtdbg.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#if defined(_LIBCPP_VERSION)
|
2017-02-06 06:48:02 +08:00
|
|
|
#error This header may not be used when targeting libc++
|
2017-01-20 07:48:05 +08:00
|
|
|
#endif
|
|
|
|
|
2017-05-11 03:10:49 +08:00
|
|
|
#ifndef _LIBCXX_IN_DEVCRT
|
2017-01-20 07:48:05 +08:00
|
|
|
struct AssertionDialogAvoider {
|
|
|
|
AssertionDialogAvoider() {
|
|
|
|
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
|
|
|
|
_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
|
|
|
|
|
|
|
|
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
|
|
|
|
_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const AssertionDialogAvoider assertion_dialog_avoider{};
|
2017-05-11 03:10:49 +08:00
|
|
|
#endif // _LIBCXX_IN_DEVCRT
|
2017-01-20 07:48:05 +08:00
|
|
|
|
|
|
|
// MSVC frontend only configurations
|
|
|
|
#if !defined(__clang__)
|
2017-02-06 06:48:02 +08:00
|
|
|
// Simulate feature-test macros.
|
|
|
|
#define __has_feature(X) _MSVC_HAS_FEATURE_ ## X
|
|
|
|
#define _MSVC_HAS_FEATURE_cxx_exceptions 1
|
|
|
|
#define _MSVC_HAS_FEATURE_cxx_rtti 1
|
|
|
|
#define _MSVC_HAS_FEATURE_address_sanitizer 0
|
|
|
|
#define _MSVC_HAS_FEATURE_memory_sanitizer 0
|
|
|
|
#define _MSVC_HAS_FEATURE_thread_sanitizer 0
|
|
|
|
|
2018-01-10 08:39:46 +08:00
|
|
|
#define __has_attribute(X) _MSVC_HAS_ATTRIBUTE_ ## X
|
|
|
|
#define _MSVC_HAS_ATTRIBUTE_vector_size 0
|
|
|
|
|
2017-02-06 06:48:02 +08:00
|
|
|
// Silence compiler warnings.
|
|
|
|
#pragma warning(disable: 4180) // qualifier applied to function type has no meaning; ignored
|
2017-09-27 07:08:39 +08:00
|
|
|
#pragma warning(disable: 4324) // structure was padded due to alignment specifier
|
2017-02-06 06:48:02 +08:00
|
|
|
#pragma warning(disable: 4521) // multiple copy constructors specified
|
|
|
|
#pragma warning(disable: 4702) // unreachable code
|
|
|
|
#pragma warning(disable: 28251) // Inconsistent annotation for 'new': this instance has no annotations.
|
2017-01-20 07:48:05 +08:00
|
|
|
#endif // !defined(__clang__)
|
|
|
|
|
|
|
|
// MSVC doesn't have __int128_t.
|
|
|
|
#define _LIBCPP_HAS_NO_INT128
|
|
|
|
|
|
|
|
// MSVC has quick_exit() and at_quick_exit().
|
|
|
|
#define _LIBCPP_HAS_QUICK_EXIT
|
|
|
|
|
2017-05-11 04:58:30 +08:00
|
|
|
#ifndef _LIBCXX_IN_DEVCRT
|
|
|
|
// atomic_is_lock_free.pass.cpp needs this VS 2015 Update 2 fix.
|
|
|
|
#define _ENABLE_ATOMIC_ALIGNMENT_FIX
|
2017-01-20 07:48:05 +08:00
|
|
|
|
2017-06-06 10:46:12 +08:00
|
|
|
// Silence warnings about features that are deprecated in C++17.
|
|
|
|
#define _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
|
2017-05-11 03:10:49 +08:00
|
|
|
#endif // _LIBCXX_IN_DEVCRT
|
2017-01-20 07:48:05 +08:00
|
|
|
|
[libcxx] [test] In msvc_stdlib_force_include.hpp, use _HAS_CXX17 to set TEST_STD_VER.
_HAS_CXX17 indicates whether MSVC's STL is in C++17 mode.
In MSVC there's a distinction between CRT headers like stdlib.h and STL headers
like cstdlib. Only the STL headers drag in yvals.h, our internal STL-wide header
that defines internal macros like _HAS_CXX17.
_HAS_CXX17 is an MSVC STL library macro, unconditionally defined. We centralize
everything on this, because we have to ask different questions to determine
whether C1XX, EDG, or Clang is in 14 or 17 mode, and we additionally permit
users to override the detection in one way (it's okay to ask for 17 from the
compiler, but only 14 from the libs, at least for the moment; only noexcept
in the type system will give us a headache).
As this header is for testing MSVC's STL, we can assume _HAS_CXX17 is defined.
Fixes D32726.
llvm-svn: 302104
2017-05-04 09:35:11 +08:00
|
|
|
#include <ciso646>
|
|
|
|
|
|
|
|
#if _HAS_CXX17
|
|
|
|
#define TEST_STD_VER 17
|
|
|
|
#else // _HAS_CXX17
|
|
|
|
#define TEST_STD_VER 14
|
|
|
|
#endif // _HAS_CXX17
|
|
|
|
|
2017-01-20 07:48:05 +08:00
|
|
|
#endif // SUPPORT_MSVC_STDLIB_FORCE_INCLUDE_HPP
|