aboutsummaryrefslogtreecommitdiff
path: root/libcxx/src
diff options
context:
space:
mode:
authorNikolas Klauser <nikolasklauser@berlin.de>2024-11-13 11:57:16 +0100
committerGitHub <noreply@github.com>2024-11-13 11:57:16 +0100
commitb69ddbc62838f23ace237c206676b1ed1c882638 (patch)
treec61faf36c7d5022310899fe6bfe40b1f0460a046 /libcxx/src
parent889b3c9487d114b9d082e9552599c8a8a8ccc660 (diff)
downloadllvm-b69ddbc62838f23ace237c206676b1ed1c882638.zip
llvm-b69ddbc62838f23ace237c206676b1ed1c882638.tar.gz
llvm-b69ddbc62838f23ace237c206676b1ed1c882638.tar.bz2
[libc++] Make variables in templates inline (#115785)
The variables are all `constexpr`, which implies `inline`. Since they aren't `constexpr` in C++03 they're also not `inline` there. Because of that we define them out-of-line currently. Instead we can use the C++17 extension of `inline` variables, which results in the same weak definitions of the variables but without having all the boilerplate.
Diffstat (limited to 'libcxx/src')
-rw-r--r--libcxx/src/chrono.cpp6
-rw-r--r--libcxx/src/filesystem/filesystem_clock.cpp3
-rw-r--r--libcxx/src/filesystem/path.cpp3
3 files changed, 12 insertions, 0 deletions
diff --git a/libcxx/src/chrono.cpp b/libcxx/src/chrono.cpp
index f17ea55..098b6a1 100644
--- a/libcxx/src/chrono.cpp
+++ b/libcxx/src/chrono.cpp
@@ -134,7 +134,10 @@ static system_clock::time_point __libcpp_system_clock_now() {
#endif
+_LIBCPP_DIAGNOSTIC_PUSH
+_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated")
const bool system_clock::is_steady;
+_LIBCPP_DIAGNOSTIC_POP
system_clock::time_point system_clock::now() noexcept { return __libcpp_system_clock_now(); }
@@ -226,7 +229,10 @@ static steady_clock::time_point __libcpp_steady_clock_now() {
# error "Monotonic clock not implemented on this platform"
# endif
+_LIBCPP_DIAGNOSTIC_PUSH
+_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated")
const bool steady_clock::is_steady;
+_LIBCPP_DIAGNOSTIC_POP
steady_clock::time_point steady_clock::now() noexcept { return __libcpp_steady_clock_now(); }
diff --git a/libcxx/src/filesystem/filesystem_clock.cpp b/libcxx/src/filesystem/filesystem_clock.cpp
index 473a54a..e4cfb9e 100644
--- a/libcxx/src/filesystem/filesystem_clock.cpp
+++ b/libcxx/src/filesystem/filesystem_clock.cpp
@@ -36,7 +36,10 @@
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
+_LIBCPP_DIAGNOSTIC_PUSH
+_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated")
const bool _FilesystemClock::is_steady;
+_LIBCPP_DIAGNOSTIC_POP
_FilesystemClock::time_point _FilesystemClock::now() noexcept {
typedef chrono::duration<rep> __secs;
diff --git a/libcxx/src/filesystem/path.cpp b/libcxx/src/filesystem/path.cpp
index 5874244..9f7dc54 100644
--- a/libcxx/src/filesystem/path.cpp
+++ b/libcxx/src/filesystem/path.cpp
@@ -24,7 +24,10 @@ using parser::string_view_t;
// path definitions
///////////////////////////////////////////////////////////////////////////////
+_LIBCPP_DIAGNOSTIC_PUSH
+_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated")
constexpr path::value_type path::preferred_separator;
+_LIBCPP_DIAGNOSTIC_POP
path& path::replace_extension(path const& replacement) {
path p = extension();