diff --git a/libcxx/benchmarks/CMakeLists.txt b/libcxx/benchmarks/CMakeLists.txt --- a/libcxx/benchmarks/CMakeLists.txt +++ b/libcxx/benchmarks/CMakeLists.txt @@ -166,6 +166,11 @@ # Register Benchmark tests #============================================================================== file(GLOB BENCHMARK_TESTS "*.bench.cpp") + +if (NOT LIBCXX_ENABLE_INCOMPLETE_FEATURES) + list(FILTER BENCHMARK_TESTS EXCLUDE REGEX "(format_to_n|format_to|format|formatted_size|formatter_float|std_format_spec_string_unicode).bench.cpp") +endif() + foreach(test_path ${BENCHMARK_TESTS}) get_filename_component(test_file "${test_path}" NAME) string(REPLACE ".bench.cpp" "" test_name "${test_file}") diff --git a/libcxx/include/__debug b/libcxx/include/__debug --- a/libcxx/include/__debug +++ b/libcxx/include/__debug @@ -29,10 +29,10 @@ # define _LIBCPP_ASSERT_IMPL(x, m) ((void)0) #elif _LIBCPP_DEBUG_LEVEL == 1 # define _LIBCPP_DEBUG_ASSERT(x, m) ((void)0) -# define _LIBCPP_ASSERT_IMPL(x, m) ((x) ? (void)0 : _VSTD::__libcpp_debug_function(_VSTD::__libcpp_debug_info(__FILE__, __LINE__, #x, m))) +# define _LIBCPP_ASSERT_IMPL(x, m) ((x) ? (void)0 : ::std::__libcpp_debug_function(::std::__libcpp_debug_info(__FILE__, __LINE__, #x, m))) #elif _LIBCPP_DEBUG_LEVEL == 2 -# define _LIBCPP_DEBUG_ASSERT(x, m) _LIBCPP_ASSERT(__libcpp_is_constant_evaluated() || (x), m) -# define _LIBCPP_ASSERT_IMPL(x, m) ((x) ? (void)0 : _VSTD::__libcpp_debug_function(_VSTD::__libcpp_debug_info(__FILE__, __LINE__, #x, m))) +# define _LIBCPP_DEBUG_ASSERT(x, m) _LIBCPP_ASSERT(::std::__libcpp_is_constant_evaluated() || (x), m) +# define _LIBCPP_ASSERT_IMPL(x, m) ((x) ? (void)0 : ::std::__libcpp_debug_function(::std::__libcpp_debug_info(__FILE__, __LINE__, #x, m))) #else # error _LIBCPP_DEBUG_LEVEL must be one of 0, 1, 2 #endif diff --git a/libcxx/include/module.modulemap b/libcxx/include/module.modulemap --- a/libcxx/include/module.modulemap +++ b/libcxx/include/module.modulemap @@ -2,7 +2,8 @@ // since __config may be included from C headers which may create an // include cycle. module std_config [system] [extern_c] { - header "__config" + textual header "__config" + textual header "__config_site" } module std [system] { diff --git a/libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in b/libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in --- a/libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in +++ b/libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in @@ -5,7 +5,7 @@ config.substitutions.append(('%{flags}', '--driver-mode=g++')) config.substitutions.append(('%{compile_flags}', - '-nostdinc++ -isystem %{include} -isystem %{target-include} -I %{libcxx}/test/support -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -DNOMINMAX' + '-nostdinc++ -isystem %{include} -isystem %{target-include} -I %{libcxx}/test/support -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS' )) config.substitutions.append(('%{link_flags}', '-nostdlib -L %{lib} -lc++ -lmsvcrt -lmsvcprt -loldnames' diff --git a/libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in b/libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in --- a/libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in +++ b/libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in @@ -5,7 +5,7 @@ config.substitutions.append(('%{flags}', '--driver-mode=g++')) config.substitutions.append(('%{compile_flags}', - '-nostdinc++ -isystem %{include} -isystem %{target-include} -I %{libcxx}/test/support -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -DNOMINMAX' + '-nostdinc++ -isystem %{include} -isystem %{target-include} -I %{libcxx}/test/support -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS' )) config.substitutions.append(('%{link_flags}', '-nostdlib -L %{lib} -llibc++ -lmsvcrt -lmsvcprt -loldnames' diff --git a/libcxx/test/libcxx/algorithms/debug_less.pass.cpp b/libcxx/test/libcxx/algorithms/debug_less.pass.cpp --- a/libcxx/test/libcxx/algorithms/debug_less.pass.cpp +++ b/libcxx/test/libcxx/algorithms/debug_less.pass.cpp @@ -16,6 +16,7 @@ struct DebugException {}; +// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined #define _LIBCPP_DEBUG 0 #define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : throw ::DebugException()) diff --git a/libcxx/test/libcxx/debug/debug_abort.pass.cpp b/libcxx/test/libcxx/debug/debug_abort.pass.cpp --- a/libcxx/test/libcxx/debug/debug_abort.pass.cpp +++ b/libcxx/test/libcxx/debug/debug_abort.pass.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=0 +// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_DEBUG=0 // UNSUPPORTED: libcxx-no-debug-mode // Test that the default debug handler aborts the program. diff --git a/libcxx/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/db_deallocate.pass.cpp b/libcxx/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/db_deallocate.pass.cpp --- a/libcxx/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/db_deallocate.pass.cpp +++ b/libcxx/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/db_deallocate.pass.cpp @@ -16,6 +16,7 @@ int AssertCount = 0; +// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined #define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (void)::AssertCount++) #define _LIBCPP_DEBUG 0 #include diff --git a/libcxx/test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/db_deallocate.pass.cpp b/libcxx/test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/db_deallocate.pass.cpp --- a/libcxx/test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/db_deallocate.pass.cpp +++ b/libcxx/test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/db_deallocate.pass.cpp @@ -16,6 +16,7 @@ int AssertCount = 0; +// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined #define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (void)::AssertCount++) #define _LIBCPP_DEBUG 0 #include diff --git a/libcxx/test/libcxx/input.output/filesystems/class.path/path.itr/iterator_db.pass.cpp b/libcxx/test/libcxx/input.output/filesystems/class.path/path.itr/iterator_db.pass.cpp --- a/libcxx/test/libcxx/input.output/filesystems/class.path/path.itr/iterator_db.pass.cpp +++ b/libcxx/test/libcxx/input.output/filesystems/class.path/path.itr/iterator_db.pass.cpp @@ -10,7 +10,7 @@ // UNSUPPORTED: windows // UNSUPPORTED: libcxx-no-debug-mode -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=0 +// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_DEBUG=0 // diff --git a/libcxx/test/libcxx/iterators/advance.debug1.pass.cpp b/libcxx/test/libcxx/iterators/advance.debug1.pass.cpp --- a/libcxx/test/libcxx/iterators/advance.debug1.pass.cpp +++ b/libcxx/test/libcxx/iterators/advance.debug1.pass.cpp @@ -8,7 +8,7 @@ // UNSUPPORTED: c++03 // UNSUPPORTED: windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=0 +// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_DEBUG=0 // UNSUPPORTED: libcxx-no-debug-mode // diff --git a/libcxx/test/libcxx/iterators/next.debug1.pass.cpp b/libcxx/test/libcxx/iterators/next.debug1.pass.cpp --- a/libcxx/test/libcxx/iterators/next.debug1.pass.cpp +++ b/libcxx/test/libcxx/iterators/next.debug1.pass.cpp @@ -8,7 +8,7 @@ // UNSUPPORTED: c++03 // UNSUPPORTED: windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=0 +// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_DEBUG=0 // UNSUPPORTED: libcxx-no-debug-mode // @@ -27,8 +27,8 @@ forward_iterator it(a+1); - std::next(it, 1); // should work fine - std::next(it, 0); // should work fine + std::next(it, 1); // should work fine + std::next(it, 0); // should work fine EXPECT_DEATH( std::next(it, -1) ); // can't go backwards on a FwdIter return 0; diff --git a/libcxx/test/libcxx/iterators/prev.debug1.pass.cpp b/libcxx/test/libcxx/iterators/prev.debug1.pass.cpp --- a/libcxx/test/libcxx/iterators/prev.debug1.pass.cpp +++ b/libcxx/test/libcxx/iterators/prev.debug1.pass.cpp @@ -8,7 +8,7 @@ // UNSUPPORTED: c++03 // UNSUPPORTED: windows -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=0 +// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_DEBUG=0 // UNSUPPORTED: libcxx-no-debug-mode // @@ -26,8 +26,8 @@ int a[] = {1, 2, 3}; bidirectional_iterator bidi(a+1); - std::prev(bidi, -1); // should work fine - std::prev(bidi, 0); // should work fine + std::prev(bidi, -1); // should work fine + std::prev(bidi, 0); // should work fine std::prev(bidi, 1); // should work fine forward_iterator it(a+1); diff --git a/libcxx/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp b/libcxx/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp --- a/libcxx/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp +++ b/libcxx/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp @@ -11,7 +11,7 @@ // UNSUPPORTED: c++03 // UNSUPPORTED: libcxx-no-debug-mode -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=0 +// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_DEBUG=0 // diff --git a/libcxx/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp b/libcxx/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp --- a/libcxx/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp +++ b/libcxx/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp @@ -11,7 +11,7 @@ // UNSUPPORTED: c++03 // UNSUPPORTED: libcxx-no-debug-mode -// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=0 +// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_DEBUG=0 // diff --git a/libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/last_write_time.pass.cpp b/libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/last_write_time.pass.cpp --- a/libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/last_write_time.pass.cpp +++ b/libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/last_write_time.pass.cpp @@ -19,6 +19,9 @@ // file_time_type last_write_time() const; // file_time_type last_write_time(error_code const&) const noexcept; +// Disable min() and max() macros in on Windows. +// ADDITIONAL_COMPILE_FLAGS: -DNOMINMAX + #include "filesystem_include.h" #include #include diff --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp --- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp +++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp @@ -22,6 +22,9 @@ // void last_write_time(const path& p, file_time_type new_type, // std::error_code& ec) noexcept; +// Disable min() and max() macros in on Windows. +// ADDITIONAL_COMPILE_FLAGS: -DNOMINMAX + #include "filesystem_include.h" #include #include diff --git a/libcxx/test/support/filesystem_test_helper.h b/libcxx/test/support/filesystem_test_helper.h --- a/libcxx/test/support/filesystem_test_helper.h +++ b/libcxx/test/support/filesystem_test_helper.h @@ -31,6 +31,9 @@ # include #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + namespace utils { #ifdef _WIN32 inline int mkdir(const char* path, int mode) { (void)mode; return ::_mkdir(path); } @@ -733,4 +736,6 @@ return fs::path(); } -#endif /* FILESYSTEM_TEST_HELPER_HPP */ +_LIBCPP_POP_MACROS + +#endif /* FILESYSTEM_TEST_HELPER_H */ diff --git a/libcxx/utils/libcxx/test/config.py b/libcxx/utils/libcxx/test/config.py --- a/libcxx/utils/libcxx/test/config.py +++ b/libcxx/utils/libcxx/test/config.py @@ -245,10 +245,6 @@ # Build the tests in the same configuration as libcxx itself, # to avoid mismatches if linked statically. self.cxx.compile_flags += ['-D_CRT_STDIO_ISO_WIDE_SPECIFIERS'] - # Required so that tests using min/max don't fail on Windows, - # and so that those tests don't have to be changed to tolerate - # this insanity. - self.cxx.compile_flags += ['-DNOMINMAX'] additional_flags = self.get_lit_conf('test_compiler_flags') if additional_flags: self.cxx.compile_flags += shlex.split(additional_flags) diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py --- a/libcxx/utils/libcxx/test/features.py +++ b/libcxx/utils/libcxx/test/features.py @@ -129,22 +129,10 @@ '_LIBCPP_HAS_NO_UNICODE': 'libcpp-has-no-unicode', } for macro, feature in macros.items(): - DEFAULT_FEATURES += [ - Feature(name=lambda cfg, m=macro, f=feature: f + ( - '={}'.format(compilerMacros(cfg)[m]) if compilerMacros(cfg)[m] else '' - ), - when=lambda cfg, m=macro: m in compilerMacros(cfg), - - # FIXME: This is a hack that should be fixed using module maps. - # If modules are enabled then we have to lift all of the definitions - # in <__config_site> onto the command line. - actions=lambda cfg, m=macro: [ - AddCompileFlag('-Wno-macro-redefined -D{}'.format(m) + ( - '={}'.format(compilerMacros(cfg)[m]) if compilerMacros(cfg)[m] else '' - )) - ] - ) - ] + DEFAULT_FEATURES.append( + Feature(name=lambda cfg, m=macro, f=feature: f + ('={}'.format(compilerMacros(cfg)[m]) if compilerMacros(cfg)[m] else ''), + when=lambda cfg, m=macro: m in compilerMacros(cfg)) + ) # Mapping from canonical locale names (used in the tests) to possible locale