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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292539 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2017-01-19 23:48:05 +00:00
parent 56257d4918
commit e70e03c7f6
3 changed files with 84 additions and 84 deletions

View File

@@ -189,7 +189,6 @@
# define _LIBCPP_LITTLE_ENDIAN 1 # define _LIBCPP_LITTLE_ENDIAN 1
# define _LIBCPP_BIG_ENDIAN 0 # define _LIBCPP_BIG_ENDIAN 0
# define _LIBCPP_SHORT_WCHAR 1 # define _LIBCPP_SHORT_WCHAR 1
// If mingw not explicitly detected, assume using MS C runtime only. // If mingw not explicitly detected, assume using MS C runtime only.
# ifndef __MINGW32__ # ifndef __MINGW32__
# define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library # define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
@@ -197,6 +196,9 @@
# if (defined(_M_AMD64) || defined(__x86_64__)) || (defined(_M_ARM) || defined(__arm__)) # if (defined(_M_AMD64) || defined(__x86_64__)) || (defined(_M_ARM) || defined(__arm__))
# define _LIBCPP_HAS_BITSCAN64 # define _LIBCPP_HAS_BITSCAN64
# endif # endif
# if defined(_LIBCPP_MSVCRT)
# define _LIBCPP_HAS_QUICK_EXIT
# endif
#endif // defined(_WIN32) #endif // defined(_WIN32)
#ifdef __sun__ #ifdef __sun__

View File

@@ -468,10 +468,9 @@ class Configuration(object):
self.cxx.compile_flags += [ self.cxx.compile_flags += [
'-include', os.path.join(support_path, 'nasty_macros.hpp')] '-include', os.path.join(support_path, 'nasty_macros.hpp')]
if self.cxx_stdlib_under_test == 'msvc': if self.cxx_stdlib_under_test == 'msvc':
# FIXME: Uncomment this once STL commits the support header. self.cxx.compile_flags += [
# self.cxx.compile_flags += [ '-include', os.path.join(support_path,
# '-include', os.path.join(support_path, 'msvc_stdlib_force_include.hpp')]
# 'msvc_stdlib_force_include.h')]
pass pass
if self.is_windows and self.debug_build and \ if self.is_windows and self.debug_build and \
self.cxx_stdlib_under_test != 'msvc': self.cxx_stdlib_under_test != 'msvc':

View File

@@ -1,79 +1,78 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// //
// The LLVM Compiler Infrastructure // The LLVM Compiler Infrastructure
// //
// This file is dual licensed under the MIT and the University of Illinois Open // This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details. // Source Licenses. See LICENSE.TXT for details.
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifndef SUPPORT_MSVC_STDLIB_FORCE_INCLUDE_HPP #ifndef SUPPORT_MSVC_STDLIB_FORCE_INCLUDE_HPP
#define 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
// This header is force-included when running MSVC's compiler and standard library with libc++'s tests. // MSVC standard library.
// Avoid assertion dialogs.
// Avoid assertion dialogs. #define _CRT_SECURE_INVALID_PARAMETER(EXPR) ::abort()
#define _CRT_SECURE_INVALID_PARAMETER(EXPR) ::abort()
#include <crtdbg.h>
#include <crtdbg.h> #include <stdlib.h>
#include <stdlib.h>
#if defined(_LIBCPP_VERSION)
struct AssertionDialogAvoider { #error This header may not be used when targeting libc++
AssertionDialogAvoider() { #endif
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); struct AssertionDialogAvoider {
AssertionDialogAvoider() {
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE); _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); _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. const AssertionDialogAvoider assertion_dialog_avoider{};
#define __has_feature(X) _MSVC_HAS_FEATURE_ ## X
#define _MSVC_HAS_FEATURE_cxx_exceptions 1
#define _MSVC_HAS_FEATURE_cxx_rtti 1 // MSVC frontend only configurations
#define _MSVC_HAS_FEATURE_address_sanitizer 0 #if !defined(__clang__)
#define _MSVC_HAS_FEATURE_memory_sanitizer 0
#define _MSVC_HAS_FEATURE_thread_sanitizer 0 #define TEST_STD_VER 17
// Simulate feature-test macros.
// atomic_is_lock_free.pass.cpp needs this VS 2015 Update 2 fix. #define __has_feature(X) _MSVC_HAS_FEATURE_ ## X
#define _ENABLE_ATOMIC_ALIGNMENT_FIX #define _MSVC_HAS_FEATURE_cxx_exceptions 1
#define _MSVC_HAS_FEATURE_cxx_rtti 1
#define _MSVC_HAS_FEATURE_address_sanitizer 0
// Enable features that /std:c++latest removes by default. #define _MSVC_HAS_FEATURE_memory_sanitizer 0
#define _HAS_AUTO_PTR_ETC 1 #define _MSVC_HAS_FEATURE_thread_sanitizer 0
#define _HAS_FUNCTION_ASSIGN 1
#define _HAS_OLD_IOSTREAMS_MEMBERS 1 // Silence compiler warnings.
#pragma warning(disable: 4180) // qualifier applied to function type has no meaning; ignored
#pragma warning(disable: 4521) // multiple copy constructors specified
// MSVC doesn't have __int128_t. #pragma warning(disable: 4702) // unreachable code
#define _LIBCPP_HAS_NO_INT128 #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.
// MSVC has quick_exit() and at_quick_exit(). #endif // !defined(__clang__)
#define _LIBCPP_HAS_QUICK_EXIT
// MSVC doesn't have __int128_t.
#define _LIBCPP_HAS_NO_INT128
// MSVC's STL partially supports C++17.
#define TEST_STD_VER 17 // MSVC has quick_exit() and at_quick_exit().
#define _LIBCPP_HAS_QUICK_EXIT
// Silence warnings about raw pointers and other unchecked iterators. // atomic_is_lock_free.pass.cpp needs this VS 2015 Update 2 fix.
#define _SCL_SECURE_NO_WARNINGS #define _ENABLE_ATOMIC_ALIGNMENT_FIX
// Enable features that /std:c++latest removes by default.
// Silence compiler warnings. #define _HAS_AUTO_PTR_ETC 1
#pragma warning(disable: 4180) // qualifier applied to function type has no meaning; ignored #define _HAS_FUNCTION_ASSIGN 1
#pragma warning(disable: 4521) // multiple copy constructors specified #define _HAS_OLD_IOSTREAMS_MEMBERS 1
#pragma warning(disable: 4702) // unreachable code
#pragma warning(disable: 6294) // Ill-defined for-loop: initial condition does not satisfy test. Loop body not executed. // Silence warnings about raw pointers and other unchecked iterators.
#pragma warning(disable: 28251) // Inconsistent annotation for 'new': this instance has no annotations. #define _SCL_SECURE_NO_WARNINGS
#endif // SUPPORT_MSVC_STDLIB_FORCE_INCLUDE_HPP
#endif // SUPPORT_MSVC_STDLIB_FORCE_INCLUDE_HPP