Specify -fno-builtin when testing to make sure that certain stdlib
authorRichard Smith <richard@metafoo.co.uk>
Mon, 18 Apr 2022 02:39:55 +0000 (19:39 -0700)
committerRichard Smith <richard@metafoo.co.uk>
Mon, 18 Apr 2022 02:41:34 +0000 (19:41 -0700)
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

index 15bd2f590aa10e60f9be1861d473fd07840b3f25..ea8c989a9984089cac69c617b004aedfc141c142 100644 (file)
 // 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 <algorithm>
 #include <bit> // bit_cast
 #include <cstddef> // to_integer