From 94b2bde631ae32ac733e2a8ca920e6a8bfa99150 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Tue, 18 Apr 2017 23:09:36 +0000 Subject: [PATCH] Cleanup _LIBCPP_HAS_NO_ macros for std::initializer_list llvm-svn: 300623 --- libcxx/include/initializer_list | 4 ++-- .../support.initlist/include_cxx03.pass.cpp | 18 ++++++++++++++++++ .../support.initlist.access/access.pass.cpp | 8 ++------ .../support.initlist.cons/default.pass.cpp | 5 +++-- .../support.initlist.range/begin_end.pass.cpp | 7 ++----- .../language.support/support.initlist/types.pass.cpp | 4 ++-- 6 files changed, 29 insertions(+), 17 deletions(-) create mode 100644 libcxx/test/std/language.support/support.initlist/include_cxx03.pass.cpp diff --git a/libcxx/include/initializer_list b/libcxx/include/initializer_list index d6dfa80..8c234aa 100644 --- a/libcxx/include/initializer_list +++ b/libcxx/include/initializer_list @@ -53,7 +53,7 @@ template const E* end(initializer_list il) noexcept; // constexpr in namespace std // purposefully not versioned { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#ifndef _LIBCPP_CXX03_LANG template class _LIBCPP_TEMPLATE_VIS initializer_list @@ -111,7 +111,7 @@ end(initializer_list<_Ep> __il) _NOEXCEPT return __il.end(); } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // !defined(_LIBCPP_CXX03_LANG) } // std diff --git a/libcxx/test/std/language.support/support.initlist/include_cxx03.pass.cpp b/libcxx/test/std/language.support/support.initlist/include_cxx03.pass.cpp new file mode 100644 index 0000000..8710ddc --- /dev/null +++ b/libcxx/test/std/language.support/support.initlist/include_cxx03.pass.cpp @@ -0,0 +1,18 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// Test that the file can be included in C++03 + +#include + +int main() +{ +} diff --git a/libcxx/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp b/libcxx/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp index e51ef7b..f6fd556 100644 --- a/libcxx/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp +++ b/libcxx/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // template class initializer_list; // const E* begin() const; @@ -19,8 +21,6 @@ #include "test_macros.h" -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - struct A { A(std::initializer_list il) @@ -52,13 +52,9 @@ struct B #endif // TEST_STD_VER > 11 -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS A test1 = {3, 2, 1}; -#endif #if TEST_STD_VER > 11 constexpr B test2 = {3, 2, 1}; #endif // TEST_STD_VER > 11 diff --git a/libcxx/test/std/language.support/support.initlist/support.initlist.cons/default.pass.cpp b/libcxx/test/std/language.support/support.initlist/support.initlist.cons/default.pass.cpp index e091834..2d831c9 100644 --- a/libcxx/test/std/language.support/support.initlist/support.initlist.cons/default.pass.cpp +++ b/libcxx/test/std/language.support/support.initlist/support.initlist.cons/default.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // template class initializer_list; // initializer_list(); @@ -20,10 +22,9 @@ struct A {}; int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS std::initializer_list il; assert(il.size() == 0); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + #if TEST_STD_VER > 11 constexpr std::initializer_list il2; static_assert(il2.size() == 0, ""); diff --git a/libcxx/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp b/libcxx/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp index 938025d..102ed64 100644 --- a/libcxx/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp +++ b/libcxx/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // // template const E* begin(initializer_list il); @@ -17,8 +19,6 @@ #include "test_macros.h" -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - struct A { A(std::initializer_list il) @@ -49,13 +49,10 @@ struct B }; #endif // TEST_STD_VER > 11 -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS A test1 = {3, 2, 1}; -#endif #if TEST_STD_VER > 11 constexpr B test2 = {3, 2, 1}; #endif // TEST_STD_VER > 11 diff --git a/libcxx/test/std/language.support/support.initlist/types.pass.cpp b/libcxx/test/std/language.support/support.initlist/types.pass.cpp index 8358300..a301ef9 100644 --- a/libcxx/test/std/language.support/support.initlist/types.pass.cpp +++ b/libcxx/test/std/language.support/support.initlist/types.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // template // class initializer_list // { @@ -26,12 +28,10 @@ struct A {}; int main() { -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS static_assert((std::is_same::value_type, A>::value), ""); static_assert((std::is_same::reference, const A&>::value), ""); static_assert((std::is_same::const_reference, const A&>::value), ""); static_assert((std::is_same::size_type, std::size_t>::value), ""); static_assert((std::is_same::iterator, const A*>::value), ""); static_assert((std::is_same::const_iterator, const A*>::value), ""); -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS } -- 2.7.4