[PATCH] D55661: [libcxx] [test] [ctime] Ignore -Wformat-zero-length warnings

Michał Górny via Phabricator reviews at reviews.llvm.org
Thu Dec 13 09:38:23 PST 2018


mgorny created this revision.
mgorny added reviewers: krytarowski, mclow.lists, EricWF.
Herald added a subscriber: ldionne.

Explicitly disable the -Wformat-zero-length diagnostic when running
ctime tests, since one of the test cases passes zero-length format
string to strftime().  When strftime() is appropriately decorated
with __attribute__(format, ...), this caused the test to fail because
of this warning (e.g. on NetBSD).


Repository:
  rCXX libc++

https://reviews.llvm.org/D55661

Files:
  test/std/utilities/time/date.time/ctime.pass.cpp


Index: test/std/utilities/time/date.time/ctime.pass.cpp
===================================================================
--- test/std/utilities/time/date.time/ctime.pass.cpp
+++ test/std/utilities/time/date.time/ctime.pass.cpp
@@ -26,6 +26,10 @@
 #endif
 #endif
 
+#if defined(__GNUC__)
+#pragma GCC diagnostic ignored "-Wformat-zero-length"
+#endif
+
 int main()
 {
     std::clock_t c = 0;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55661.178088.patch
Type: text/x-patch
Size: 395 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20181213/e1069fbd/attachment.bin>


More information about the libcxx-commits mailing list