Skip to content

Commit 506cf6d

Browse files
committed
[libc++] Fix modules and benchmarks CI builds when incomplete features are disabled
Differential Revision: https://reviews.llvm.org/D119036
1 parent 0748639 commit 506cf6d

File tree

20 files changed

+42
-38
lines changed

20 files changed

+42
-38
lines changed

libcxx/benchmarks/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@ endfunction()
166166
# Register Benchmark tests
167167
#==============================================================================
168168
file(GLOB BENCHMARK_TESTS "*.bench.cpp")
169+
170+
if (NOT LIBCXX_ENABLE_INCOMPLETE_FEATURES)
171+
list(FILTER BENCHMARK_TESTS EXCLUDE REGEX "(format_to_n|format_to|format|formatted_size|formatter_float|std_format_spec_string_unicode).bench.cpp")
172+
endif()
173+
169174
foreach(test_path ${BENCHMARK_TESTS})
170175
get_filename_component(test_file "${test_path}" NAME)
171176
string(REPLACE ".bench.cpp" "" test_name "${test_file}")

libcxx/include/__debug

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
# define _LIBCPP_ASSERT_IMPL(x, m) ((void)0)
3030
#elif _LIBCPP_DEBUG_LEVEL == 1
3131
# define _LIBCPP_DEBUG_ASSERT(x, m) ((void)0)
32-
# define _LIBCPP_ASSERT_IMPL(x, m) ((x) ? (void)0 : _VSTD::__libcpp_debug_function(_VSTD::__libcpp_debug_info(__FILE__, __LINE__, #x, m)))
32+
# define _LIBCPP_ASSERT_IMPL(x, m) ((x) ? (void)0 : ::std::__libcpp_debug_function(::std::__libcpp_debug_info(__FILE__, __LINE__, #x, m)))
3333
#elif _LIBCPP_DEBUG_LEVEL == 2
34-
# define _LIBCPP_DEBUG_ASSERT(x, m) _LIBCPP_ASSERT(__libcpp_is_constant_evaluated() || (x), m)
35-
# define _LIBCPP_ASSERT_IMPL(x, m) ((x) ? (void)0 : _VSTD::__libcpp_debug_function(_VSTD::__libcpp_debug_info(__FILE__, __LINE__, #x, m)))
34+
# define _LIBCPP_DEBUG_ASSERT(x, m) _LIBCPP_ASSERT(::std::__libcpp_is_constant_evaluated() || (x), m)
35+
# define _LIBCPP_ASSERT_IMPL(x, m) ((x) ? (void)0 : ::std::__libcpp_debug_function(::std::__libcpp_debug_info(__FILE__, __LINE__, #x, m)))
3636
#else
3737
# error _LIBCPP_DEBUG_LEVEL must be one of 0, 1, 2
3838
#endif

libcxx/include/module.modulemap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
// since __config may be included from C headers which may create an
33
// include cycle.
44
module std_config [system] [extern_c] {
5-
header "__config"
5+
textual header "__config"
6+
textual header "__config_site"
67
}
78

89
module std [system] {

libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
55

66
config.substitutions.append(('%{flags}', '--driver-mode=g++'))
77
config.substitutions.append(('%{compile_flags}',
8-
'-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'
8+
'-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'
99
))
1010
config.substitutions.append(('%{link_flags}',
1111
'-nostdlib -L %{lib} -lc++ -lmsvcrt -lmsvcprt -loldnames'

libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
55

66
config.substitutions.append(('%{flags}', '--driver-mode=g++'))
77
config.substitutions.append(('%{compile_flags}',
8-
'-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'
8+
'-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'
99
))
1010
config.substitutions.append(('%{link_flags}',
1111
'-nostdlib -L %{lib} -llibc++ -lmsvcrt -lmsvcprt -loldnames'

libcxx/test/libcxx/algorithms/debug_less.pass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
struct DebugException {};
1818

19+
// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined
1920
#define _LIBCPP_DEBUG 0
2021
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : throw ::DebugException())
2122

libcxx/test/libcxx/debug/debug_abort.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=0
9+
// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_DEBUG=0
1010
// UNSUPPORTED: libcxx-no-debug-mode
1111

1212
// Test that the default debug handler aborts the program.

libcxx/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/db_deallocate.pass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
int AssertCount = 0;
1818

19+
// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined
1920
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (void)::AssertCount++)
2021
#define _LIBCPP_DEBUG 0
2122
#include <experimental/memory_resource>

libcxx/test/libcxx/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.mem/db_deallocate.pass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
int AssertCount = 0;
1818

19+
// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined
1920
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (void)::AssertCount++)
2021
#define _LIBCPP_DEBUG 0
2122
#include <experimental/memory_resource>

libcxx/test/libcxx/input.output/filesystems/class.path/path.itr/iterator_db.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// UNSUPPORTED: windows
1111
// UNSUPPORTED: libcxx-no-debug-mode
1212

13-
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=0
13+
// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_DEBUG=0
1414

1515
// <filesystem>
1616

libcxx/test/libcxx/iterators/advance.debug1.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
// UNSUPPORTED: c++03
1010
// UNSUPPORTED: windows
11-
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=0
11+
// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_DEBUG=0
1212
// UNSUPPORTED: libcxx-no-debug-mode
1313

1414
// <list>

libcxx/test/libcxx/iterators/next.debug1.pass.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
// UNSUPPORTED: c++03
1010
// UNSUPPORTED: windows
11-
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=0
11+
// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_DEBUG=0
1212
// UNSUPPORTED: libcxx-no-debug-mode
1313

1414
// <list>
@@ -27,8 +27,8 @@ int main(int, char**)
2727

2828

2929
forward_iterator<int *> it(a+1);
30-
std::next(it, 1); // should work fine
31-
std::next(it, 0); // should work fine
30+
std::next(it, 1); // should work fine
31+
std::next(it, 0); // should work fine
3232
EXPECT_DEATH( std::next(it, -1) ); // can't go backwards on a FwdIter
3333

3434
return 0;

libcxx/test/libcxx/iterators/prev.debug1.pass.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
// UNSUPPORTED: c++03
1010
// UNSUPPORTED: windows
11-
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=0
11+
// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_DEBUG=0
1212
// UNSUPPORTED: libcxx-no-debug-mode
1313

1414
// <list>
@@ -26,8 +26,8 @@ int main(int, char**)
2626
int a[] = {1, 2, 3};
2727

2828
bidirectional_iterator<int *> bidi(a+1);
29-
std::prev(bidi, -1); // should work fine
30-
std::prev(bidi, 0); // should work fine
29+
std::prev(bidi, -1); // should work fine
30+
std::prev(bidi, 0); // should work fine
3131
std::prev(bidi, 1); // should work fine
3232

3333
forward_iterator<int *> it(a+1);

libcxx/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// UNSUPPORTED: c++03
1212
// UNSUPPORTED: libcxx-no-debug-mode
1313

14-
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=0
14+
// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_DEBUG=0
1515

1616
// <future>
1717

libcxx/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// UNSUPPORTED: c++03
1212
// UNSUPPORTED: libcxx-no-debug-mode
1313

14-
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=0
14+
// ADDITIONAL_COMPILE_FLAGS: -Wno-macro-redefined -D_LIBCPP_DEBUG=0
1515

1616
// <future>
1717

libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/last_write_time.pass.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
// file_time_type last_write_time() const;
2020
// file_time_type last_write_time(error_code const&) const noexcept;
2121

22+
// Disable min() and max() macros in <windows.h> on Windows.
23+
// ADDITIONAL_COMPILE_FLAGS: -DNOMINMAX
24+
2225
#include "filesystem_include.h"
2326
#include <type_traits>
2427
#include <cassert>

libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
// void last_write_time(const path& p, file_time_type new_type,
2323
// std::error_code& ec) noexcept;
2424

25+
// Disable min() and max() macros in <windows.h> on Windows.
26+
// ADDITIONAL_COMPILE_FLAGS: -DNOMINMAX
27+
2528
#include "filesystem_include.h"
2629
#include <chrono>
2730
#include <cstdio>

libcxx/test/support/filesystem_test_helper.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
# include <sys/un.h>
3232
#endif
3333

34+
_LIBCPP_PUSH_MACROS
35+
#include <__undef_macros>
36+
3437
namespace utils {
3538
#ifdef _WIN32
3639
inline int mkdir(const char* path, int mode) { (void)mode; return ::_mkdir(path); }
@@ -733,4 +736,6 @@ inline fs::path GetWindowsInaccessibleDir() {
733736
return fs::path();
734737
}
735738

736-
#endif /* FILESYSTEM_TEST_HELPER_HPP */
739+
_LIBCPP_POP_MACROS
740+
741+
#endif /* FILESYSTEM_TEST_HELPER_H */

libcxx/utils/libcxx/test/config.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,6 @@ def configure_compile_flags(self):
245245
# Build the tests in the same configuration as libcxx itself,
246246
# to avoid mismatches if linked statically.
247247
self.cxx.compile_flags += ['-D_CRT_STDIO_ISO_WIDE_SPECIFIERS']
248-
# Required so that tests using min/max don't fail on Windows,
249-
# and so that those tests don't have to be changed to tolerate
250-
# this insanity.
251-
self.cxx.compile_flags += ['-DNOMINMAX']
252248
additional_flags = self.get_lit_conf('test_compiler_flags')
253249
if additional_flags:
254250
self.cxx.compile_flags += shlex.split(additional_flags)

libcxx/utils/libcxx/test/features.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -129,22 +129,10 @@
129129
'_LIBCPP_HAS_NO_UNICODE': 'libcpp-has-no-unicode',
130130
}
131131
for macro, feature in macros.items():
132-
DEFAULT_FEATURES += [
133-
Feature(name=lambda cfg, m=macro, f=feature: f + (
134-
'={}'.format(compilerMacros(cfg)[m]) if compilerMacros(cfg)[m] else ''
135-
),
136-
when=lambda cfg, m=macro: m in compilerMacros(cfg),
137-
138-
# FIXME: This is a hack that should be fixed using module maps.
139-
# If modules are enabled then we have to lift all of the definitions
140-
# in <__config_site> onto the command line.
141-
actions=lambda cfg, m=macro: [
142-
AddCompileFlag('-Wno-macro-redefined -D{}'.format(m) + (
143-
'={}'.format(compilerMacros(cfg)[m]) if compilerMacros(cfg)[m] else ''
144-
))
145-
]
146-
)
147-
]
132+
DEFAULT_FEATURES.append(
133+
Feature(name=lambda cfg, m=macro, f=feature: f + ('={}'.format(compilerMacros(cfg)[m]) if compilerMacros(cfg)[m] else ''),
134+
when=lambda cfg, m=macro: m in compilerMacros(cfg))
135+
)
148136

149137

150138
# Mapping from canonical locale names (used in the tests) to possible locale

0 commit comments

Comments
 (0)