bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

time: Fix warning about asctime when asctime is not used


From: Bruno Haible
Subject: time: Fix warning about asctime when asctime is not used
Date: Sun, 18 Oct 2020 20:45:38 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-189-generic; KDE/5.18.0; x86_64; ; )

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  <bruno@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
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]