diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-01-09 21:23:41 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-01-09 21:23:41 +0000 |
commit | 78da6db1f23c0bfe8a36a5b5c05d06005037e556 (patch) | |
tree | 313656e2b2326f4a83a68f108956d0551c751600 /test | |
parent | 4a2db4d30e1653093d4d8b06e8221e2f8b723507 (diff) | |
download | src-78da6db1f23c0bfe8a36a5b5c05d06005037e556.tar.gz src-78da6db1f23c0bfe8a36a5b5c05d06005037e556.zip |
Notes
Diffstat (limited to 'test')
24 files changed, 323 insertions, 45 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d174ec72ca08..ad110fbfb30b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -34,7 +34,7 @@ pythonize_bool(LIBCXXABI_ENABLE_SHARED) pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER) pythonize_bool(LIBCXX_HAS_ATOMIC_LIB) pythonize_bool(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB) -pythonize_bool(LIBCXX_HAS_EXTERNAL_THREAD_API) +pythonize_bool(LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY) # By default, for non-standalone builds, libcxx and libcxxabi share a library # directory. diff --git a/test/libcxx/iterators/trivial_iterators.pass.cpp b/test/libcxx/iterators/trivial_iterators.pass.cpp index c4b3aae92ff2..d924a57ffeab 100644 --- a/test/libcxx/iterators/trivial_iterators.pass.cpp +++ b/test/libcxx/iterators/trivial_iterators.pass.cpp @@ -25,9 +25,10 @@ #include <vector> #include <initializer_list> +#include "test_macros.h" #include "test_iterators.h" -#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS +#if TEST_STD_VER >= 11 #define DELETE_FUNCTION = delete #else #define DELETE_FUNCTION diff --git a/test/libcxx/test/config.py b/test/libcxx/test/config.py index 7043b8a01c4a..5fcb8f4a9b3f 100644 --- a/test/libcxx/test/config.py +++ b/test/libcxx/test/config.py @@ -67,7 +67,8 @@ class Configuration(object): self.cxx_library_root = None self.cxx_runtime_root = None self.abi_library_root = None - self.env = {} + self.link_shared = self.get_lit_bool('enable_shared', default=True) + self.exec_env = {} self.use_target = False self.use_system_cxx_lib = False self.use_clang_verify = False @@ -146,7 +147,7 @@ class Configuration(object): # Print as list to prevent "set([...])" from being printed. self.lit_config.note('Using available_features: %s' % list(self.config.available_features)) - self.lit_config.note('Using environment: %r' % self.env) + self.lit_config.note('Using environment: %r' % self.exec_env) def get_test_format(self): return LibcxxTestFormat( @@ -154,7 +155,7 @@ class Configuration(object): self.use_clang_verify, self.execute_external, self.executor, - exec_env=self.env) + exec_env=self.exec_env) def configure_executor(self): exec_str = self.get_lit_conf('executor', "None") @@ -207,12 +208,16 @@ class Configuration(object): self.config.available_features.add('%s-%s' % (cxx_type, maj_v)) self.config.available_features.add('%s-%s.%s' % ( cxx_type, maj_v, min_v)) + self.cxx.compile_env = dict(os.environ) + # 'CCACHE_CPP2' prevents ccache from stripping comments while + # preprocessing. This is required to prevent stripping of '-verify' + # comments. + self.cxx.compile_env['CCACHE_CPP2'] = '1' def _configure_clang_cl(self, clang_path): assert self.cxx_is_clang_cl # FIXME: don't hardcode the target - flags = ['-fms-compatibility-version=19.00', - '--target=i686-unknown-windows'] + flags = ['--target=i686-pc-windows'] compile_flags = [] link_flags = ['-fuse-ld=lld'] if 'INCLUDE' in os.environ: @@ -555,7 +560,7 @@ class Configuration(object): if not os.path.isdir(dynamic_env): os.makedirs(dynamic_env) self.cxx.compile_flags += ['-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT="%s"' % dynamic_env] - self.env['LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT'] = ("%s" % dynamic_env) + self.exec_env['LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT'] = ("%s" % dynamic_env) dynamic_helper = os.path.join(self.libcxx_src_root, 'test', 'support', 'filesystem_dynamic_test_helper.py') @@ -577,7 +582,7 @@ class Configuration(object): self.cxx.link_flags += ['-nodefaultlibs'] # FIXME: Handle MSVCRT as part of the ABI library handling. if self.is_windows: - self.cxx.link_flags += ['-nostdlib', '-lmsvcrtd'] + self.cxx.link_flags += ['-nostdlib'] self.configure_link_flags_cxx_library() self.configure_link_flags_abi_library() self.configure_extra_library_flags() @@ -602,8 +607,14 @@ class Configuration(object): if not self.use_system_cxx_lib: if self.cxx_library_root: self.cxx.link_flags += ['-L' + self.cxx_library_root] - if self.cxx_runtime_root and not self.is_windows: - self.cxx.link_flags += ['-Wl,-rpath,' + self.cxx_runtime_root] + if self.is_windows and self.link_shared: + self.add_path(self.cxx.compile_env, self.cxx_library_root) + if self.cxx_runtime_root: + if not self.is_windows: + self.cxx.link_flags += ['-Wl,-rpath,' + + self.cxx_runtime_root] + elif self.is_windows and self.link_shared: + self.add_path(self.exec_env, self.cxx_runtime_root) def configure_link_flags_abi_library_path(self): # Configure ABI library paths. @@ -612,14 +623,15 @@ class Configuration(object): self.cxx.link_flags += ['-L' + self.abi_library_root] if not self.is_windows: self.cxx.link_flags += ['-Wl,-rpath,' + self.abi_library_root] + else: + self.add_path(self.exec_env, self.abi_library_root) def configure_link_flags_cxx_library(self): libcxx_experimental = self.get_lit_bool('enable_experimental', default=False) if libcxx_experimental: self.config.available_features.add('c++experimental') self.cxx.link_flags += ['-lc++experimental'] - libcxx_shared = self.get_lit_bool('enable_shared', default=True) - if libcxx_shared: + if self.link_shared: self.cxx.link_flags += ['-lc++'] else: cxx_library_root = self.get_lit_conf('cxx_library_root') @@ -654,7 +666,8 @@ class Configuration(object): elif cxx_abi == 'libcxxrt': self.cxx.link_flags += ['-lcxxrt'] elif cxx_abi == 'none' or cxx_abi == 'default': - pass + if self.is_windows: + self.cxx.link_flags += ['-lmsvcrtd'] else: self.lit_config.fatal( 'C++ ABI setting %s unsupported for tests' % cxx_abi) @@ -746,7 +759,7 @@ class Configuration(object): self.cxx.flags += ['-fsanitize=undefined', '-fno-sanitize=vptr,function,float-divide-by-zero', '-fno-sanitize-recover=all'] - self.env['UBSAN_OPTIONS'] = 'print_stacktrace=1' + self.exec_env['UBSAN_OPTIONS'] = 'print_stacktrace=1' self.config.available_features.add('ubsan') # Setup the sanitizer compile flags @@ -754,10 +767,10 @@ class Configuration(object): if san == 'Address' or san == 'Address;Undefined' or san == 'Undefined;Address': self.cxx.flags += ['-fsanitize=address'] if llvm_symbolizer is not None: - self.env['ASAN_SYMBOLIZER_PATH'] = llvm_symbolizer + self.exec_env['ASAN_SYMBOLIZER_PATH'] = llvm_symbolizer # FIXME: Turn ODR violation back on after PR28391 is resolved # https://llvm.org/bugs/show_bug.cgi?id=28391 - self.env['ASAN_OPTIONS'] = 'detect_odr_violation=0' + self.exec_env['ASAN_OPTIONS'] = 'detect_odr_violation=0' self.config.available_features.add('asan') self.config.available_features.add('sanitizer-new-delete') self.cxx.compile_flags += ['-O1'] @@ -769,7 +782,7 @@ class Configuration(object): self.cxx.compile_flags += [ '-fsanitize-memory-track-origins'] if llvm_symbolizer is not None: - self.env['MSAN_SYMBOLIZER_PATH'] = llvm_symbolizer + self.exec_env['MSAN_SYMBOLIZER_PATH'] = llvm_symbolizer self.config.available_features.add('msan') self.config.available_features.add('sanitizer-new-delete') self.cxx.compile_flags += ['-O1'] @@ -855,8 +868,8 @@ class Configuration(object): sub.append(('%link', link_str)) sub.append(('%build', build_str)) # Configure exec prefix substitutions. - exec_env_str = 'env ' if len(self.env) != 0 else '' - for k, v in self.env.items(): + exec_env_str = 'env ' if len(self.exec_env) != 0 else '' + for k, v in self.exec_env.items(): exec_env_str += ' %s=%s' % (k, v) # Configure run env substitution. exec_str = exec_env_str @@ -898,4 +911,12 @@ class Configuration(object): "inferred target_triple as: %r" % self.config.target_triple) def configure_env(self): - self.target_info.configure_env(self.env) + self.target_info.configure_env(self.exec_env) + + def add_path(self, dest_env, new_path): + if 'PATH' not in dest_env: + dest_env['PATH'] = new_path + else: + split_char = ';' if self.is_windows else ':' + dest_env['PATH'] = '%s%s%s' % (new_path, split_char, + dest_env['PATH']) diff --git a/test/libcxx/test/executor.py b/test/libcxx/test/executor.py index ee4288fb0083..250186cecb84 100644 --- a/test/libcxx/test/executor.py +++ b/test/libcxx/test/executor.py @@ -7,6 +7,7 @@ # #===----------------------------------------------------------------------===## +import platform import os from libcxx.test import tracing @@ -34,6 +35,7 @@ class Executor(object): class LocalExecutor(Executor): def __init__(self): super(LocalExecutor, self).__init__() + self.is_windows = platform.system() == 'Windows' def run(self, exe_path, cmd=None, work_dir='.', file_deps=None, env=None): cmd = cmd or [exe_path] @@ -43,9 +45,30 @@ class LocalExecutor(Executor): env_cmd += ['%s=%s' % (k, v) for k, v in env.items()] if work_dir == '.': work_dir = os.getcwd() - out, err, rc = executeCommand(env_cmd + cmd, cwd=work_dir) + if not self.is_windows: + out, err, rc = executeCommand(env_cmd + cmd, cwd=work_dir) + else: + out, err, rc = executeCommand(cmd, cwd=work_dir, + env=self._build_windows_env(env)) return (env_cmd + cmd, out, err, rc) + def _build_windows_env(self, exec_env): + # FIXME: Finding Windows DLL's at runtime requires modifying the + # PATH environment variables. However we don't want to print out + # the entire PATH as part of the diagnostic for every failing test. + # Therefore this hack builds a new executable environment that + # merges the current environment and the supplied environment while + # still only printing the supplied environment in diagnostics. + if not self.is_windows or exec_env is None: + return None + new_env = dict(os.environ) + for key, value in exec_env.items(): + if key == 'PATH': + assert value.strip() != '' and "expected non-empty path" + new_env['PATH'] = "%s;%s" % (value, os.environ['PATH']) + else: + new_env[key] = value + return new_env class PrefixExecutor(Executor): """Prefix an executor with some other command wrapper. diff --git a/test/libcxx/test/format.py b/test/libcxx/test/format.py index ee6ab82c6e3a..cbd96f340bbc 100644 --- a/test/libcxx/test/format.py +++ b/test/libcxx/test/format.py @@ -41,11 +41,6 @@ class LibcxxTestFormat(object): self.execute_external = execute_external self.executor = executor self.exec_env = dict(exec_env) - self.cxx.compile_env = dict(os.environ) - # 'CCACHE_CPP2' prevents ccache from stripping comments while - # preprocessing. This is required to prevent stripping of '-verify' - # comments. - self.cxx.compile_env['CCACHE_CPP2'] = '1' @staticmethod def _make_custom_parsers(): diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in index c89af09ddbf3..0cccffcf5ec0 100644 --- a/test/lit.site.cfg.in +++ b/test/lit.site.cfg.in @@ -28,7 +28,7 @@ config.has_libatomic = "@LIBCXX_HAS_ATOMIC_LIB@" config.use_libatomic = "@LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB@" config.libcxxabi_shared = "@LIBCXXABI_ENABLE_SHARED@" -config.cxx_ext_threads = "@LIBCXX_HAS_EXTERNAL_THREAD_API@" +config.cxx_ext_threads = "@LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY@" # Let the main config do the real work. config.loaded_site_config = True diff --git a/test/std/containers/sequences/array/iterators.pass.cpp b/test/std/containers/sequences/array/iterators.pass.cpp index 7d9050800dea..dd4aab30a026 100644 --- a/test/std/containers/sequences/array/iterators.pass.cpp +++ b/test/std/containers/sequences/array/iterators.pass.cpp @@ -132,10 +132,10 @@ int main() static_assert ( std::rbegin(c) != std::rend(c), ""); static_assert ( std::cbegin(c) != std::cend(c), ""); static_assert ( std::crbegin(c) != std::crend(c), ""); - + static_assert ( *c.begin() == 0, ""); static_assert ( *c.rbegin() == 4, ""); - + static_assert ( *std::begin(c) == 0, "" ); static_assert ( *std::cbegin(c) == 0, "" ); static_assert ( *std::rbegin(c) == 4, "" ); diff --git a/test/std/input.output/iostream.format/input.streams/istream/istream.cons/copy.fail.cpp b/test/std/input.output/iostream.format/input.streams/istream/istream.cons/copy.fail.cpp new file mode 100644 index 000000000000..c5721f211abb --- /dev/null +++ b/test/std/input.output/iostream.format/input.streams/istream/istream.cons/copy.fail.cpp @@ -0,0 +1,55 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// <istream> + +// template <class charT, class traits = char_traits<charT> > +// class basic_istream; + +// basic_istream(basic_istream const& rhs) = delete; +// basic_istream& operator=(basic_istream const&) = delete; + +#include <istream> +#include <type_traits> +#include <cassert> + +struct test_istream + : public std::basic_istream<char> +{ + typedef std::basic_istream<char> base; + + test_istream(test_istream&& s) + : base(std::move(s)) // OK + { + } + + test_istream& operator=(test_istream&& s) { + base::operator=(std::move(s)); // OK + return *this; + } + + test_istream(test_istream const& s) + : base(s) // expected-error {{call to deleted constructor of 'std::basic_istream<char>'}} + { + } + + test_istream& operator=(test_istream const& s) { + base::operator=(s); // expected-error {{call to deleted member function 'operator='}} + return *this; + } + +}; + + +int main() +{ + +} diff --git a/test/std/input.output/iostream.format/input.streams/istream/istream.cons/move.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream/istream.cons/move.pass.cpp index 04cb9d3fb6ba..6e00f399306d 100644 --- a/test/std/input.output/iostream.format/input.streams/istream/istream.cons/move.pass.cpp +++ b/test/std/input.output/iostream.format/input.streams/istream/istream.cons/move.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <istream> // template <class charT, class traits = char_traits<charT> > @@ -17,8 +19,6 @@ #include <istream> #include <cassert> -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - template <class CharT> struct testbuf : public std::basic_streambuf<CharT> @@ -37,11 +37,8 @@ struct test_istream : base(std::move(s)) {} }; -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { testbuf<char> sb; test_istream<char> is1(&sb); @@ -74,5 +71,4 @@ int main() assert(is.precision() == 6); assert(is.getloc().name() == "C"); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/test/std/iterators/iterator.range/begin-end.pass.cpp b/test/std/iterators/iterator.range/begin-end.pass.cpp index a0774888d567..2b5377f486f4 100644 --- a/test/std/iterators/iterator.range/begin-end.pass.cpp +++ b/test/std/iterators/iterator.range/begin-end.pass.cpp @@ -179,10 +179,10 @@ int main(){ static_assert ( std::rbegin(c) != std::rend(c), ""); static_assert ( std::cbegin(c) != std::cend(c), ""); static_assert ( std::crbegin(c) != std::crend(c), ""); - + static_assert ( *c.begin() == 0, ""); static_assert ( *c.rbegin() == 4, ""); - + static_assert ( *std::begin(c) == 0, "" ); static_assert ( *std::cbegin(c) == 0, "" ); static_assert ( *std::rbegin(c) == 4, "" ); @@ -191,7 +191,7 @@ int main(){ { static constexpr const int c[] = {0,1,2,3,4}; - + static_assert ( *std::begin(c) == 0, "" ); static_assert ( *std::cbegin(c) == 0, "" ); static_assert ( *std::rbegin(c) == 4, "" ); diff --git a/test/std/strings/string.view/string_view.literals/literal.pass.cpp b/test/std/strings/string.view/string_view.literals/literal.pass.cpp new file mode 100644 index 000000000000..9fb128ab0f55 --- /dev/null +++ b/test/std/strings/string.view/string_view.literals/literal.pass.cpp @@ -0,0 +1,57 @@ +// -*- 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9 +// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8 +// Note: libc++ supports string_view before C++17, but literals were introduced in C++14 + +#include <string_view> +#include <cassert> + +int main() +{ + using namespace std::literals::string_view_literals; + + static_assert ( std::is_same<decltype( "Hi"sv), std::string_view>::value, "" ); + static_assert ( std::is_same<decltype( u8"Hi"sv), std::string_view>::value, "" ); + static_assert ( std::is_same<decltype( L"Hi"sv), std::wstring_view>::value, "" ); + static_assert ( std::is_same<decltype( u"Hi"sv), std::u16string_view>::value, "" ); + static_assert ( std::is_same<decltype( U"Hi"sv), std::u32string_view>::value, "" ); + + std::string_view foo; + std::wstring_view Lfoo; + std::u16string_view ufoo; + std::u32string_view Ufoo; + + foo = ""sv; assert( foo.size() == 0); + foo = u8""sv; assert( foo.size() == 0); + Lfoo = L""sv; assert(Lfoo.size() == 0); + ufoo = u""sv; assert(ufoo.size() == 0); + Ufoo = U""sv; assert(Ufoo.size() == 0); + + foo = " "sv; assert( foo.size() == 1); + foo = u8" "sv; assert( foo.size() == 1); + Lfoo = L" "sv; assert(Lfoo.size() == 1); + ufoo = u" "sv; assert(ufoo.size() == 1); + Ufoo = U" "sv; assert(Ufoo.size() == 1); + + foo = "ABC"sv; assert( foo == "ABC"); assert( foo == std::string_view ( "ABC")); + foo = u8"ABC"sv; assert( foo == u8"ABC"); assert( foo == std::string_view (u8"ABC")); + Lfoo = L"ABC"sv; assert(Lfoo == L"ABC"); assert(Lfoo == std::wstring_view ( L"ABC")); + ufoo = u"ABC"sv; assert(ufoo == u"ABC"); assert(ufoo == std::u16string_view( u"ABC")); + Ufoo = U"ABC"sv; assert(Ufoo == U"ABC"); assert(Ufoo == std::u32string_view( U"ABC")); + + static_assert( "ABC"sv.size() == 3, ""); + static_assert(u8"ABC"sv.size() == 3, ""); + static_assert( L"ABC"sv.size() == 3, ""); + static_assert( u"ABC"sv.size() == 3, ""); + static_assert( U"ABC"sv.size() == 3, ""); +} diff --git a/test/std/strings/string.view/string_view.literals/literal1.fail.cpp b/test/std/strings/string.view/string_view.literals/literal1.fail.cpp new file mode 100644 index 000000000000..6e6854f5559a --- /dev/null +++ b/test/std/strings/string.view/string_view.literals/literal1.fail.cpp @@ -0,0 +1,23 @@ +// -*- 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9 +// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8 + +#include <string_view> +#include <cassert> + +int main() +{ + using std::string_view; + + string_view foo = ""sv; // should fail w/conversion operator not found +} diff --git a/test/std/strings/string.view/string_view.literals/literal1.pass.cpp b/test/std/strings/string.view/string_view.literals/literal1.pass.cpp new file mode 100644 index 000000000000..f663d022b2e1 --- /dev/null +++ b/test/std/strings/string.view/string_view.literals/literal1.pass.cpp @@ -0,0 +1,25 @@ +// -*- 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9 +// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8 +// Note: libc++ supports string_view before C++17, but literals were introduced in C++14 + +#include <string_view> +#include <cassert> + +int main() +{ + using namespace std::literals; + + std::string_view foo = ""sv; + assert(foo.length() == 0); +} diff --git a/test/std/strings/string.view/string_view.literals/literal2.fail.cpp b/test/std/strings/string.view/string_view.literals/literal2.fail.cpp new file mode 100644 index 000000000000..4907a55104e0 --- /dev/null +++ b/test/std/strings/string.view/string_view.literals/literal2.fail.cpp @@ -0,0 +1,21 @@ +// -*- 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9 +// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8 + +#include <string_view> +#include <cassert> + +int main() +{ + std::string_view foo = ""sv; // should fail w/conversion operator not found +} diff --git a/test/std/strings/string.view/string_view.literals/literal2.pass.cpp b/test/std/strings/string.view/string_view.literals/literal2.pass.cpp new file mode 100644 index 000000000000..3bb6f6c0a0e3 --- /dev/null +++ b/test/std/strings/string.view/string_view.literals/literal2.pass.cpp @@ -0,0 +1,25 @@ +// -*- 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9 +// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8 +// Note: libc++ supports string_view before C++17, but literals were introduced in C++14 + +#include <string_view> +#include <cassert> + +int main() +{ + using namespace std::literals::string_view_literals; + + std::string_view foo = ""sv; + assert(foo.length() == 0); +} diff --git a/test/std/strings/string.view/string_view.literals/literal3.pass.cpp b/test/std/strings/string.view/string_view.literals/literal3.pass.cpp new file mode 100644 index 000000000000..144a1cdd1c8a --- /dev/null +++ b/test/std/strings/string.view/string_view.literals/literal3.pass.cpp @@ -0,0 +1,25 @@ +// -*- 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 +// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9 +// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8 +// Note: libc++ supports string_view before C++17, but literals were introduced in C++14 + +#include <string_view> +#include <cassert> + +int main() +{ + using namespace std; + + string_view foo = ""sv; + assert(foo.length() == 0); +} diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h index bae1e013f571..6b3f1e2ab0de 100644 --- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h +++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h @@ -19,7 +19,9 @@ #include <type_traits> #include <cassert> -#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS +#include "test_macros.h" + +#if TEST_STD_VER >= 11 #define DELETE_FUNCTION = delete #else #define DELETE_FUNCTION { assert(false); } diff --git a/test/std/utilities/time/time.duration/time.duration.arithmetic/op_mod=duration.pass.cpp b/test/std/utilities/time/time.duration/time.duration.arithmetic/op_mod=duration.pass.cpp index 624468671244..194e085ab04e 100644 --- a/test/std/utilities/time/time.duration/time.duration.arithmetic/op_mod=duration.pass.cpp +++ b/test/std/utilities/time/time.duration/time.duration.arithmetic/op_mod=duration.pass.cpp @@ -38,7 +38,7 @@ int main() us1 %= std::chrono::milliseconds(3); assert(us1.count() == 2); } - + #if TEST_STD_VER > 14 static_assert(test_constexpr(), ""); #endif diff --git a/test/std/utilities/time/time.duration/time.duration.arithmetic/op_mod=rep.pass.cpp b/test/std/utilities/time/time.duration/time.duration.arithmetic/op_mod=rep.pass.cpp index a4852d261f7e..7dcf002259bc 100644 --- a/test/std/utilities/time/time.duration/time.duration.arithmetic/op_mod=rep.pass.cpp +++ b/test/std/utilities/time/time.duration/time.duration.arithmetic/op_mod=rep.pass.cpp @@ -34,7 +34,7 @@ int main() us %= 3; assert(us.count() == 2); } - + #if TEST_STD_VER > 14 static_assert(test_constexpr(), ""); #endif diff --git a/test/std/utilities/time/time.duration/time.duration.arithmetic/op_times=.pass.cpp b/test/std/utilities/time/time.duration/time.duration.arithmetic/op_times=.pass.cpp index 0f76788c00ef..f3bf79035b0e 100644 --- a/test/std/utilities/time/time.duration/time.duration.arithmetic/op_times=.pass.cpp +++ b/test/std/utilities/time/time.duration/time.duration.arithmetic/op_times=.pass.cpp @@ -34,7 +34,7 @@ int main() ns *= 5; assert(ns.count() == 15); } - + #if TEST_STD_VER > 14 static_assert(test_constexpr(), ""); #endif diff --git a/test/support/disable_missing_braces_warning.h b/test/support/disable_missing_braces_warning.h index c53eef8a951d..ac8b40728157 100644 --- a/test/support/disable_missing_braces_warning.h +++ b/test/support/disable_missing_braces_warning.h @@ -13,6 +13,8 @@ // Disable the missing braces warning for this reason. #if defined(__GNUC__) #pragma GCC diagnostic ignored "-Wmissing-braces" +#elif defined(__clang__) +#pragma clang diagnostic ignored "-Wmissing-braces" #endif #endif // SUPPORT_DISABLE_MISSING_BRACES_WARNING_H diff --git a/test/support/external_threads.cpp b/test/support/external_threads.cpp index 68ba96ff879e..019ab473aa11 100644 --- a/test/support/external_threads.cpp +++ b/test/support/external_threads.cpp @@ -6,5 +6,5 @@ // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -#define _LIBCPP_BUILDING_THREAD_API_EXTERNAL_PTHREAD +#define _LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL #include <__threading_support> diff --git a/test/support/nasty_macros.hpp b/test/support/nasty_macros.hpp index 074853ea0b8a..f6c8aaddbea6 100644 --- a/test/support/nasty_macros.hpp +++ b/test/support/nasty_macros.hpp @@ -37,4 +37,11 @@ #define _Y NASTY_MACRO #define _Z NASTY_MACRO +// Test that libc++ doesn't use names reserved by WIN32 API Macros. +// NOTE: Obviously we can only define these on non-windows platforms. +#ifndef _WIN32 +#define __deallocate NASTY_MACRO +#define __out NASTY_MACRO +#endif + #endif // SUPPORT_NASTY_MACROS_HPP diff --git a/test/support/test_iterators.h b/test/support/test_iterators.h index 379933eb51b4..a2c22b09de84 100644 --- a/test/support/test_iterators.h +++ b/test/support/test_iterators.h @@ -17,7 +17,7 @@ #include "test_macros.h" -#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS +#if TEST_STD_VER >= 11 #define DELETE_FUNCTION = delete #else #define DELETE_FUNCTION |