Building a testdir of all of gnulib with clang, I get 696 of the kind ./time.h:858:18: warning: asctime can overrun buffers in some cases - better use strftime (or even sprintf) instead [-Wuser-defined-warnings]
This patch fixes it. 2020-10-18 Bruno Haible <br...@clisp.org> time: Fix warning about asctime when asctime is not used. * lib/time.in.h (asctime_r, ctime, ctime_r): Fix _GL_WARN_ON_USE invocation. diff --git a/lib/time.in.h b/lib/time.in.h index 3b539c2..2c7172e 100644 --- a/lib/time.in.h +++ b/lib/time.in.h @@ -356,17 +356,17 @@ _GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - " # endif # if defined GNULIB_POSIXCHECK # undef asctime_r -_GL_WARN_ON_USE (asctime, "asctime_r can overrun buffers in some cases - " +_GL_WARN_ON_USE (asctime_r, "asctime_r can overrun buffers in some cases - " "better use strftime (or even sprintf) instead"); # endif # if defined GNULIB_POSIXCHECK # undef ctime -_GL_WARN_ON_USE (asctime, "ctime can overrun buffers in some cases - " +_GL_WARN_ON_USE (ctime, "ctime can overrun buffers in some cases - " "better use strftime (or even sprintf) instead"); # endif # if defined GNULIB_POSIXCHECK # undef ctime_r -_GL_WARN_ON_USE (asctime, "ctime_r can overrun buffers in some cases - " +_GL_WARN_ON_USE (ctime_r, "ctime_r can overrun buffers in some cases - " "better use strftime (or even sprintf) instead"); # endif