[libcxx-commits] [libcxx] 9282c9d - [libc++] Avoid name conflict with declaration in <unistd.h>
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Sep 13 06:17:49 PDT 2024
Author: Louis Dionne
Date: 2024-09-13T09:16:17-04:00
New Revision: 9282c9d282e8062965f20d4ef89324cc96b92447
URL: https://github.com/llvm/llvm-project/commit/9282c9d282e8062965f20d4ef89324cc96b92447
DIFF: https://github.com/llvm/llvm-project/commit/9282c9d282e8062965f20d4ef89324cc96b92447.diff
LOG: [libc++] Avoid name conflict with declaration in <unistd.h>
It appears that ::link is also declared as another kind of symbol
in <unistd.h>, which we seem to get transitively when we start using
a single top-level module. Instead of declaring these names as global
extern variables, use function parameters to achieve the same thing.
Added:
Modified:
libcxx/test/libcxx/diagnostics/chrono.nodiscard.verify.cpp
Removed:
################################################################################
diff --git a/libcxx/test/libcxx/diagnostics/chrono.nodiscard.verify.cpp b/libcxx/test/libcxx/diagnostics/chrono.nodiscard.verify.cpp
index 32a67dc4dc9c48..4cb10ae3c35e9a 100644
--- a/libcxx/test/libcxx/diagnostics/chrono.nodiscard.verify.cpp
+++ b/libcxx/test/libcxx/diagnostics/chrono.nodiscard.verify.cpp
@@ -21,11 +21,7 @@
#include "test_macros.h"
// These types have "private" constructors.
-extern std::chrono::time_zone tz;
-extern std::chrono::time_zone_link link;
-extern std::chrono::leap_second leap;
-
-void test() {
+void test(std::chrono::time_zone tz, std::chrono::time_zone_link link, std::chrono::leap_second leap) {
std::chrono::tzdb_list& list = std::chrono::get_tzdb_list();
list.front(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
list.begin(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
More information about the libcxx-commits
mailing list