mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-21 23:30:38 +08:00

test/support/msvc_stdlib_force_include.hpp When testing MSVC's STL with C1XX, simulate a couple more compiler feature-test macros. When testing MSVC's STL, simulate a few library feature-test macros. test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp The vector_size attribute is a non-Standard extension that's supported by Clang and GCC, but not C1XX. Therefore, guard this with `__has_attribute(vector_size)`. Additionally, while these tests pass when MSVC's STL is compiled with Clang, I don't consider this to be a supported scenario for our library, so also guard this with defined(_LIBCPP_VERSION). test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp N4713 23.14.10 [func.not_fn]/1 depicts only `call_wrapper(call_wrapper&&) = default;` and `call_wrapper(const call_wrapper&) = default;`. According to 15.8.2 [class.copy.assign]/2 and /4, this makes call_wrapper non-assignable. Therefore, guard the assignability tests as libc++ specific. Add a (void) cast to tolerate not_fn() being marked as nodiscard. Fixes D41213. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@322144 91177308-0d34-0410-b5e6-96231b3b80d8
104 lines
3.4 KiB
C++
104 lines
3.4 KiB
C++
//===----------------------------------------------------------------------===//
|
|
//
|
|
// 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.
|
|
|
|
#ifndef _LIBCXX_IN_DEVCRT
|
|
// Silence warnings about CRT machinery.
|
|
#define _CRT_SECURE_NO_WARNINGS
|
|
|
|
// Avoid assertion dialogs.
|
|
#define _CRT_SECURE_INVALID_PARAMETER(EXPR) ::abort()
|
|
#endif // _LIBCXX_IN_DEVCRT
|
|
|
|
#include <crtdbg.h>
|
|
#include <stdlib.h>
|
|
|
|
#if defined(_LIBCPP_VERSION)
|
|
#error This header may not be used when targeting libc++
|
|
#endif
|
|
|
|
#ifndef _LIBCXX_IN_DEVCRT
|
|
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{};
|
|
#endif // _LIBCXX_IN_DEVCRT
|
|
|
|
// MSVC frontend only configurations
|
|
#if !defined(__clang__)
|
|
// 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
|
|
|
|
#define __has_attribute(X) _MSVC_HAS_ATTRIBUTE_ ## X
|
|
#define _MSVC_HAS_ATTRIBUTE_vector_size 0
|
|
|
|
#ifdef _NOEXCEPT_TYPES_SUPPORTED
|
|
#define __cpp_noexcept_function_type 201510
|
|
#endif // _NOEXCEPT_TYPES_SUPPORTED
|
|
|
|
// Silence compiler warnings.
|
|
#pragma warning(disable: 4180) // qualifier applied to function type has no meaning; ignored
|
|
#pragma warning(disable: 4324) // structure was padded due to alignment specifier
|
|
#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.
|
|
#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
|
|
|
|
#ifndef _LIBCXX_IN_DEVCRT
|
|
// atomic_is_lock_free.pass.cpp needs this VS 2015 Update 2 fix.
|
|
#define _ENABLE_ATOMIC_ALIGNMENT_FIX
|
|
|
|
// Silence warnings about raw pointers and other unchecked iterators.
|
|
#define _SCL_SECURE_NO_WARNINGS
|
|
|
|
// Silence warnings about features that are deprecated in C++17.
|
|
#define _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
|
|
#endif // _LIBCXX_IN_DEVCRT
|
|
|
|
#include <ciso646>
|
|
|
|
#if _HAS_CXX17
|
|
#define TEST_STD_VER 17
|
|
#else // _HAS_CXX17
|
|
#define TEST_STD_VER 14
|
|
#endif // _HAS_CXX17
|
|
|
|
// Simulate library feature-test macros.
|
|
#define __cpp_lib_invoke 201411
|
|
#define __cpp_lib_void_t 201411
|
|
|
|
#if _HAS_CXX17
|
|
#define __cpp_lib_atomic_is_always_lock_free 201603
|
|
#endif // _HAS_CXX17
|
|
|
|
#endif // SUPPORT_MSVC_STDLIB_FORCE_INCLUDE_HPP
|