Skip to content

Commit 957efd8

Browse files
committed
More fixes.
1 parent 57c28c7 commit 957efd8

File tree

4 files changed

+32
-4
lines changed

4 files changed

+32
-4
lines changed

libcxx/modules/std/chrono.inc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,15 @@ export namespace std {
213213
using std::chrono::ambiguous_local_time;
214214
using std::chrono::nonexistent_local_time;
215215
# endif // if 0
216+
#endif // !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) &&
217+
// !defined(_LIBCPP_HAS_NO_LOCALIZATION)
216218

217219
// [time.zone.info], information classes
218220
using std::chrono::local_info;
219221
using std::chrono::sys_info;
220222

223+
#if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) && \
224+
!defined(_LIBCPP_HAS_NO_LOCALIZATION)
221225
# if 0
222226
// [time.zone.timezone], class time_zone
223227
using std::chrono::choose;
@@ -248,7 +252,7 @@ export namespace std {
248252
# endif
249253
# endif // _LIBCPP_ENABLE_EXPERIMENTAL
250254
#endif // !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) &&
251-
// !defined(_LIBCPP_HAS_NO_LOCALIZATION)
255+
// !defined(_LIBCPP_HAS_NO_LOCALIZATION)
252256

253257
} // namespace chrono
254258

libcxx/modules/std/ranges.inc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,6 @@ export namespace std {
138138
}
139139
#endif // _LIBCPP_HAS_NO_LOCALIZATION
140140

141-
#if _LIBCPP_STD_VER >= 23
142-
// [range.adaptor.object], range adaptor objects
143-
using std::ranges::range_adaptor_closure;
144141
// Note: This declaration not in the synopsis or explicitly in the wording.
145142
// However it is needed for the range adaptors.
146143
// [range.adaptor.object]/3
@@ -151,7 +148,11 @@ export namespace std {
151148
// involving an object of type cv D as an operand to the | operator is
152149
// undefined if overload resolution selects a program-defined operator|
153150
// function.
151+
// This is used internally in C++20 mode.
154152
using std::ranges::operator|;
153+
#if _LIBCPP_STD_VER >= 23
154+
// [range.adaptor.object], range adaptor objects
155+
using std::ranges::range_adaptor_closure;
155156
#endif
156157

157158
// [range.all], all view

libcxx/test/libcxx/clang_tidy.gen.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
// The GCC compiler flags are not always compatible with clang-tidy.
2525
// UNSUPPORTED{BLOCKLIT}: gcc
2626
27+
// Clang 17 has false positives.
28+
// UNSUPPORTED{BLOCKLIT}: clang-17
29+
2730
{lit_header_restrictions.get(header, '')}
2831
2932
// TODO: run clang-tidy with modules enabled once they are supported

libcxx/test/tools/clang_tidy_checks/CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,26 @@ if(NOT HAS_CLANG_TIDY_HEADERS)
6464
"clang-tidy headers are not present.")
6565
return()
6666
endif()
67+
68+
# The clangTidy plugin uses C++20, when using stdlibc++ verify the version is correct.
69+
# Note it has not been tested whether version 11 works.
70+
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test.cpp" "
71+
#include <version>
72+
#if defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE < 12
73+
# error The stdlibc++ version is too old.
74+
#endif
75+
int main(){}
76+
")
77+
try_compile(HAS_NEWER_STANDARD_LIBRARY
78+
"${CMAKE_CURRENT_BINARY_DIR}"
79+
"${CMAKE_CURRENT_BINARY_DIR}/test.cpp"
80+
LINK_LIBRARIES clangTidy)
81+
82+
if(NOT HAS_NEWER_STANDARD_LIBRARY)
83+
message(STATUS "Clang-tidy tests are disabled due to using "
84+
"stdlibc++ older than version 12")
85+
return()
86+
endif()
6787
message(STATUS "Clang-tidy tests are enabled.")
6888

6989
set(SOURCES

0 commit comments

Comments
 (0)