[libcxx-commits] [libcxx] 506cf6d - [libc++] Fix modules and benchmarks CI builds when incomplete features are disabled
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Feb 8 12:15:13 PST 2022
Author: Louis Dionne
Date: 2022-02-08T15:15:07-05:00
New Revision: 506cf6dc048835c598b654e43ed8f723a42e39ba
URL: https://github.com/llvm/llvm-project/commit/506cf6dc048835c598b654e43ed8f723a42e39ba
DIFF: https://github.com/llvm/llvm-project/commit/506cf6dc048835c598b654e43ed8f723a42e39ba.diff
LOG: [libc++] Fix modules and benchmarks CI builds when incomplete features are disabled
Differential Revision: https://reviews.llvm.org/D119036
Added:
Modified:
libcxx/benchmarks/CMakeLists.txt
libcxx/include/__debug
libcxx/include/module.modulemap
libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in
libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in
libcxx/test/libcxx/algorithms/debug_less.pass.cpp
libcxx/test/libcxx/debug/debug_abort.pass.cpp
libcxx/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/db_deallocate.pass.cpp
libcxx/test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/db_deallocate.pass.cpp
libcxx/test/libcxx/input.output/filesystems/class.path/path.itr/iterator_db.pass.cpp
libcxx/test/libcxx/iterators/advance.debug1.pass.cpp
libcxx/test/libcxx/iterators/next.debug1.pass.cpp
libcxx/test/libcxx/iterators/prev.debug1.pass.cpp
libcxx/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp
libcxx/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp
libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/last_write_time.pass.cpp
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
libcxx/test/support/filesystem_test_helper.h
libcxx/utils/libcxx/test/config.py
libcxx/utils/libcxx/test/features.py
Removed:
################################################################################
diff --git a/libcxx/benchmarks/CMakeLists.txt b/libcxx/benchmarks/CMakeLists.txt
index 8c8c9e4f186e0..95e28618b55e3 100644
--- a/libcxx/benchmarks/CMakeLists.txt
+++ b/libcxx/benchmarks/CMakeLists.txt
@@ -166,6 +166,11 @@ endfunction()
# 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
index 43554dee5c9ed..5d0b5bf57f4ea 100644
--- 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
index a182ded3f5498..442958bb736b4 100644
--- 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
index dcb2b07ae724c..b779dede8b303 100644
--- a/libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in
+++ b/libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in
@@ -5,7 +5,7 @@ lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
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
index 14812b2af9c13..5a578f4785629 100644
--- a/libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in
+++ b/libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in
@@ -5,7 +5,7 @@ lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
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
index 6dd56955001d0..7f6374920f876 100644
--- 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
index 8ecb8be254fe3..a56c304d014f4 100644
--- 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
index 612451bb3b1fb..35e887d22d4c6 100644
--- 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 <experimental/memory_resource>
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
index cbc1e26136993..850d5aa0363be 100644
--- 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 <experimental/memory_resource>
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
index 8e25ac835e815..b29c0ca026cfd 100644
--- 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
// <filesystem>
diff --git a/libcxx/test/libcxx/iterators/advance.debug1.pass.cpp b/libcxx/test/libcxx/iterators/advance.debug1.pass.cpp
index 3b71f7f06255e..09a4e6a620d20 100644
--- 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
// <list>
diff --git a/libcxx/test/libcxx/iterators/next.debug1.pass.cpp b/libcxx/test/libcxx/iterators/next.debug1.pass.cpp
index e2eaf586bedd8..a7a51f71bb8db 100644
--- 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
// <list>
@@ -27,8 +27,8 @@ int main(int, char**)
forward_iterator<int *> 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
index 35d54491c7d9c..f236cdc442a8e 100644
--- 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
// <list>
@@ -26,8 +26,8 @@ int main(int, char**)
int a[] = {1, 2, 3};
bidirectional_iterator<int *> 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<int *> 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
index a79fdab4017e6..150813de8d9a3 100644
--- 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
// <future>
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
index 407b69fc63daf..19b67566ee826 100644
--- 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
// <future>
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
index 928248b3c2b87..6038bfd140dee 100644
--- 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 <windows.h> on Windows.
+// ADDITIONAL_COMPILE_FLAGS: -DNOMINMAX
+
#include "filesystem_include.h"
#include <type_traits>
#include <cassert>
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
index 4ecf6289c058a..3f1a47515602d 100644
--- 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 <windows.h> on Windows.
+// ADDITIONAL_COMPILE_FLAGS: -DNOMINMAX
+
#include "filesystem_include.h"
#include <chrono>
#include <cstdio>
diff --git a/libcxx/test/support/filesystem_test_helper.h b/libcxx/test/support/filesystem_test_helper.h
index 746cbe603f521..e8c453c787e1c 100644
--- a/libcxx/test/support/filesystem_test_helper.h
+++ b/libcxx/test/support/filesystem_test_helper.h
@@ -31,6 +31,9 @@
# include <sys/un.h>
#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 @@ inline fs::path GetWindowsInaccessibleDir() {
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
index fdc1ff4f714ab..bc718298dc76c 100644
--- a/libcxx/utils/libcxx/test/config.py
+++ b/libcxx/utils/libcxx/test/config.py
@@ -245,10 +245,6 @@ def configure_compile_flags(self):
# 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
index 429e2d82c97ba..54f318e8b36c3 100644
--- 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
More information about the libcxx-commits
mailing list