From c105bcbf98f343fc3687ccfa675378666434eef5 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Sun, 17 Apr 2022 19:39:55 -0700 Subject: [PATCH] Specify -fno-builtin when testing to make sure that certain stdlib functions are not treated as [[nodiscard]]. The compiler might choose to treat them as [[nodiscard]] without the involvement of libc++ if we allow it to recognize them as builtins. --- libcxx/test/libcxx/diagnostics/nodiscard_extensions.pass.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libcxx/test/libcxx/diagnostics/nodiscard_extensions.pass.cpp b/libcxx/test/libcxx/diagnostics/nodiscard_extensions.pass.cpp index 15bd2f590aa1..ea8c989a9984 100644 --- a/libcxx/test/libcxx/diagnostics/nodiscard_extensions.pass.cpp +++ b/libcxx/test/libcxx/diagnostics/nodiscard_extensions.pass.cpp @@ -16,6 +16,10 @@ // be tested here and in nodiscard_extensions.fail.cpp. They should also // be listed in `UsingLibcxx.rst` in the documentation for the extension. +// Disable any builtin recognition of std::* in the compiler, that might also +// trigger -Wunused-value warnings. +// ADDITIONAL_COMPILE_FLAGS: -fno-builtin + #include #include // bit_cast #include // to_integer