diff options
author | Eric Fiselier <eric@efcs.ca> | 2017-01-19 23:48:05 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2017-01-19 23:48:05 +0000 |
commit | b8c2a52266cd622a10be8904f49faa02d0fe2438 (patch) | |
tree | b7bfe5d4bb492edaee608425f6339030be3efe57 /libcxx/test/support | |
parent | a332fa38e949a2a22adf4edd8fc5bf650c056346 (diff) | |
download | bcm5719-llvm-b8c2a52266cd622a10be8904f49faa02d0fe2438.tar.gz bcm5719-llvm-b8c2a52266cd622a10be8904f49faa02d0fe2438.zip |
Adjust msvc_stdlib_force_include.hpp to handle clang++
Summary: This patch adjusts the newly added `msvc_stdlib_force_include.hpp` so that it also works when used with `clang++`.
Reviewers: STL_MSFT
Reviewed By: STL_MSFT
Differential Revision: https://reviews.llvm.org/D28917
llvm-svn: 292539
Diffstat (limited to 'libcxx/test/support')
-rw-r--r-- | libcxx/test/support/msvc_stdlib_force_include.hpp | 157 |
1 files changed, 78 insertions, 79 deletions
diff --git a/libcxx/test/support/msvc_stdlib_force_include.hpp b/libcxx/test/support/msvc_stdlib_force_include.hpp index 56fd8eeb134..f2a31f45d10 100644 --- a/libcxx/test/support/msvc_stdlib_force_include.hpp +++ b/libcxx/test/support/msvc_stdlib_force_include.hpp @@ -1,79 +1,78 @@ -//===----------------------------------------------------------------------===//
-//
-// 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 MSVC's compiler and standard library with libc++'s tests.
-
-
-// Avoid assertion dialogs.
-#define _CRT_SECURE_INVALID_PARAMETER(EXPR) ::abort()
-
-#include <crtdbg.h>
-#include <stdlib.h>
-
-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{};
-
-
-// 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
-
-
-// atomic_is_lock_free.pass.cpp needs this VS 2015 Update 2 fix.
-#define _ENABLE_ATOMIC_ALIGNMENT_FIX
-
-
-// Enable features that /std:c++latest removes by default.
-#define _HAS_AUTO_PTR_ETC 1
-#define _HAS_FUNCTION_ASSIGN 1
-#define _HAS_OLD_IOSTREAMS_MEMBERS 1
-
-
-// MSVC doesn't have __int128_t.
-#define _LIBCPP_HAS_NO_INT128
-
-
-// MSVC has quick_exit() and at_quick_exit().
-#define _LIBCPP_HAS_QUICK_EXIT
-
-
-// MSVC's STL partially supports C++17.
-#define TEST_STD_VER 17
-
-
-// Silence warnings about raw pointers and other unchecked iterators.
-#define _SCL_SECURE_NO_WARNINGS
-
-
-// Silence compiler warnings.
-#pragma warning(disable: 4180) // qualifier applied to function type has no meaning; ignored
-#pragma warning(disable: 4521) // multiple copy constructors specified
-#pragma warning(disable: 4702) // unreachable code
-#pragma warning(disable: 6294) // Ill-defined for-loop: initial condition does not satisfy test. Loop body not executed.
-#pragma warning(disable: 28251) // Inconsistent annotation for 'new': this instance has no annotations.
-
-
-#endif // SUPPORT_MSVC_STDLIB_FORCE_INCLUDE_HPP
+//===----------------------------------------------------------------------===// +// +// 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. + +// Avoid assertion dialogs. +#define _CRT_SECURE_INVALID_PARAMETER(EXPR) ::abort() + +#include <crtdbg.h> +#include <stdlib.h> + +#if defined(_LIBCPP_VERSION) +#error This header may not be used when targeting libc++ +#endif + +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{}; + + +// MSVC frontend only configurations +#if !defined(__clang__) + +#define TEST_STD_VER 17 + +// 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 + +// Silence compiler warnings. +#pragma warning(disable: 4180) // qualifier applied to function type has no meaning; ignored +#pragma warning(disable: 4521) // multiple copy constructors specified +#pragma warning(disable: 4702) // unreachable code +#pragma warning(disable: 6294) // Ill-defined for-loop: initial condition does not satisfy test. Loop body not executed. +#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 + +// atomic_is_lock_free.pass.cpp needs this VS 2015 Update 2 fix. +#define _ENABLE_ATOMIC_ALIGNMENT_FIX + +// Enable features that /std:c++latest removes by default. +#define _HAS_AUTO_PTR_ETC 1 +#define _HAS_FUNCTION_ASSIGN 1 +#define _HAS_OLD_IOSTREAMS_MEMBERS 1 + +// Silence warnings about raw pointers and other unchecked iterators. +#define _SCL_SECURE_NO_WARNINGS + +#endif // SUPPORT_MSVC_STDLIB_FORCE_INCLUDE_HPP |