[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
retire GNULIB_PORTCHECK
From: |
Bruno Haible |
Subject: |
retire GNULIB_PORTCHECK |
Date: |
Sat, 27 Mar 2010 20:10:18 +0100 |
User-agent: |
KMail/1.9.9 |
The macro GNULIB_PORTCHECK, used in time.in.h, effectively means the same
as GNULIB_POSIXCHECK. It dates back to a time when Eric had not implemented
GNULIB_POSIXCHECK and not invented warn-on-use.
This patch modernizes this code and uses the common idiom.
2010-03-27 Bruno Haible <address@hidden>
Use GNULIB_POSIXCHECK instead of GNULIB_PORTCHECK.
* lib/time.in.h (asctime, asctime_r, ctime, ctime_r): Test
GNULIB_POSIXCHECK, not GNULIB_PORTCHECK. Provide compile-time warnings
rather than link errors.
--- lib/time.in.h.orig Sat Mar 27 20:06:04 2010
+++ lib/time.in.h Sat Mar 27 20:04:24 2010
@@ -185,15 +185,25 @@
/* Encourage applications to avoid unsafe functions that can overrun
buffers when given outlandish struct tm values. Portable
applications should use strftime (or even sprintf) instead. */
-# if GNULIB_PORTCHECK
+# if defined GNULIB_POSIXCHECK
# undef asctime
-# define asctime eschew_asctime
+_GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - "
+ "better use strftime (or even sprintf) instead");
+# endif
+# if defined GNULIB_POSIXCHECK
# undef asctime_r
-# define asctime_r eschew_asctime_r
+_GL_WARN_ON_USE (asctime, "asctime_r can overrun buffers in some cases - "
+ "better use strftime (or even sprintf) instead");
+# endif
+# if defined GNULIB_POSIXCHECK
# undef ctime
-# define ctime eschew_ctime
+_GL_WARN_ON_USE (asctime, "ctime can overrun buffers in some cases - "
+ "better use strftime (or even sprintf) instead");
+# endif
+# if defined GNULIB_POSIXCHECK
# undef ctime_r
-# define ctime_r eschew_ctime_r
+_GL_WARN_ON_USE (asctime, "ctime_r can overrun buffers in some cases - "
+ "better use strftime (or even sprintf) instead");
# endif
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- retire GNULIB_PORTCHECK,
Bruno Haible <=