diff options
Diffstat (limited to 'gl/lib/time.in.h')
-rw-r--r-- | gl/lib/time.in.h | 83 |
1 files changed, 82 insertions, 1 deletions
diff --git a/gl/lib/time.in.h b/gl/lib/time.in.h index 06428ad..58e103a 100644 --- a/gl/lib/time.in.h +++ b/gl/lib/time.in.h @@ -1,6 +1,6 @@ /* A more-standard <time.h>. - Copyright (C) 2007-2023 Free Software Foundation, Inc. + Copyright (C) 2007-2024 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -143,6 +143,12 @@ _GL_CXXALIAS_SYS (timespec_get, int, (struct timespec *ts, int base)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (timespec_get); # endif +# elif defined GNULIB_POSIXCHECK +# undef timespec_get +# if HAVE_RAW_DECL_TIMESPEC_GET +_GL_WARN_ON_USE (timespec_get, "timespec_get is unportable - " + "use gnulib module timespec_get for portability"); +# endif # endif /* Set *TS to the current time resolution, and return BASE. @@ -154,6 +160,12 @@ _GL_FUNCDECL_SYS (timespec_getres, int, (struct timespec *ts, int base) # endif _GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base)); _GL_CXXALIASWARN (timespec_getres); +# elif defined GNULIB_POSIXCHECK +# undef timespec_getres +# if HAVE_RAW_DECL_TIMESPEC_GETRES +_GL_WARN_ON_USE (timespec_getres, "timespec_getres is unportable - " + "use gnulib module timespec_getres for portability"); +# endif # endif /* Return the number of seconds that have elapsed since the Epoch. */ @@ -170,6 +182,12 @@ _GL_CXXALIAS_SYS (time, time_t, (time_t *__tp)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (time); # endif +# elif defined GNULIB_POSIXCHECK +# undef time +# if HAVE_RAW_DECL_TIME +_GL_WARN_ON_USE (time, "time has consistency problems - " + "use gnulib module time for portability"); +# endif # endif /* Sleep for at least RQTP seconds unless interrupted, If interrupted, @@ -195,6 +213,12 @@ _GL_CXXALIAS_SYS (nanosleep, int, (struct timespec const *__rqtp, struct timespec *__rmtp)); # endif _GL_CXXALIASWARN (nanosleep); +# elif defined GNULIB_POSIXCHECK +# undef nanosleep +# if HAVE_RAW_DECL_NANOSLEEP +_GL_WARN_ON_USE (nanosleep, "nanosleep is unportable - " + "use gnulib module nanosleep for portability"); +# endif # endif /* Initialize time conversion information. */ @@ -230,6 +254,12 @@ _GL_CXXALIAS_MDA (tzset, void, (void)); _GL_CXXALIAS_SYS (tzset, void, (void)); # endif _GL_CXXALIASWARN (tzset); +# elif defined GNULIB_POSIXCHECK +# undef tzset +# if HAVE_RAW_DECL_TZSET +_GL_WARN_ON_USE (tzset, "tzset has portability problems - " + "use gnulib module tzset for portability"); +# endif # endif /* Return the 'time_t' representation of TP and normalize TP. */ @@ -246,6 +276,12 @@ _GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (mktime); # endif +# elif defined GNULIB_POSIXCHECK +# undef mktime +# if HAVE_RAW_DECL_MKTIME +_GL_WARN_ON_USE (mktime, "mktime has portability problems - " + "use gnulib module mktime for portability"); +# endif # endif /* Convert TIMER to RESULT, assuming local time and UTC respectively. See @@ -296,6 +332,17 @@ _GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, # if @HAVE_DECL_LOCALTIME_R@ _GL_CXXALIASWARN (gmtime_r); # endif +# elif defined GNULIB_POSIXCHECK +# undef localtime_r +# if HAVE_RAW_DECL_LOCALTIME_R +_GL_WARN_ON_USE (localtime_r, "localtime_r is unportable - " + "use gnulib module time_r for portability"); +# endif +# undef gmtime_r +# if HAVE_RAW_DECL_GMTIME_R +_GL_WARN_ON_USE (gmtime_r, "gmtime_r is unportable - " + "use gnulib module time_r for portability"); +# endif # endif /* Convert TIMER to RESULT, assuming local time and UTC respectively. See @@ -316,6 +363,12 @@ _GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (localtime); # endif +# elif defined GNULIB_POSIXCHECK +# undef localtime +# if HAVE_RAW_DECL_LOCALTIME +_GL_WARN_ON_USE (localtime, "localtime has portability problems - " + "use gnulib module localtime for portability"); +# endif # endif # if 0 || @REPLACE_GMTIME@ @@ -347,6 +400,12 @@ _GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf, char const *restrict __format, struct tm *restrict __tm)); _GL_CXXALIASWARN (strptime); +# elif defined GNULIB_POSIXCHECK +# undef strptime +# if HAVE_RAW_DECL_STRPTIME +_GL_WARN_ON_USE (strptime, "strptime is unportable - " + "use gnulib module strptime for portability"); +# endif # endif /* Convert *TP to a date and time string. See @@ -368,6 +427,12 @@ _GL_CXXALIAS_SYS (ctime, char *, (time_t const *__tp)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (ctime); # endif +# elif defined GNULIB_POSIXCHECK +# undef ctime +# if HAVE_RAW_DECL_CTIME +_GL_WARN_ON_USE (ctime, "ctime has portability problems - " + "use gnulib module ctime for portability"); +# endif # endif /* Convert *TP to a date and time string. See @@ -392,6 +457,12 @@ _GL_CXXALIAS_SYS (strftime, size_t, # if __GLIBC__ >= 2 _GL_CXXALIASWARN (strftime); # endif +# elif defined GNULIB_POSIXCHECK +# undef strftime +# if HAVE_RAW_DECL_STRFTIME +_GL_WARN_ON_USE (strftime, "strftime has portability problems - " + "use gnulib module strftime-fixes for portability"); +# endif # endif # if defined _GNU_SOURCE && @GNULIB_TIME_RZ@ && ! @HAVE_TIMEZONE_T@ @@ -469,6 +540,12 @@ _GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (timegm); # endif +# elif defined GNULIB_POSIXCHECK +# undef timegm +# if HAVE_RAW_DECL_TIMEGM +_GL_WARN_ON_USE (timegm, "timegm is unportable - " + "use gnulib module timegm for portability"); +# endif # endif /* Encourage applications to avoid unsafe functions that can overrun @@ -476,8 +553,10 @@ _GL_CXXALIASWARN (timegm); applications should use strftime (or even sprintf) instead. */ # if defined GNULIB_POSIXCHECK # undef asctime +# if HAVE_RAW_DECL_ASCTIME _GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - " "better use strftime (or even sprintf) instead"); +# endif # endif # if defined GNULIB_POSIXCHECK # undef asctime_r @@ -488,8 +567,10 @@ _GL_WARN_ON_USE (asctime_r, "asctime_r can overrun buffers in some cases - " # endif # if defined GNULIB_POSIXCHECK # undef ctime +# if HAVE_RAW_DECL_CTIME _GL_WARN_ON_USE (ctime, "ctime can overrun buffers in some cases - " "better use strftime (or even sprintf) instead"); +# endif # endif # if defined GNULIB_POSIXCHECK # undef ctime_r |