summaryrefslogtreecommitdiff
path: root/m4/parse-datetime.m4
Commit message (Collapse)AuthorAgeFilesLines
* maint: run 'make update-copyright'Simon Josefsson2023-01-011-1/+1
|
* maint: run 'make update-copyright'Paul Eggert2022-01-011-1/+1
|
* Move .h file names out of the *.m4 files.Bruno Haible2021-12-151-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is useful because Autoconf macros defined in *.m4 files can be AC_REQUIREd. In the configure file, they are then expanded before gl_INIT, i.e. at a place where it is not known whether they are required for the lib/ or for the tests/ directory (or both). * m4/gnulib-common.m4 (gl_CONDITIONAL_HEADER): New macro. * m4/alloca.m4 (gl_FUNC_ALLOCA): Set GL_GENERATE_ALLOCA_H instead of ALLOCA_H. Drop AC_SUBST and AM_CONDITIONAL invocations. * modules/alloca-opt (configure.ac): Invoke gl_CONDITIONAL_HEADER. * m4/argz.m4 (gl_FUNC_ARGZ): Set GL_GENERATE_ARGZ_H instead of ARGZ_H. Drop AC_SUBST and AM_CONDITIONAL invocations. * modules/argz (configure.ac): Invoke gl_CONDITIONAL_HEADER. * m4/assert_h.m4 (gl_ASSERT_H): Set GL_GENERATE_ASSERT_H instead of ASSERT_H. Drop AC_SUBST and AM_CONDITIONAL invocations. * modules/assert-h (configure.ac): Invoke gl_CONDITIONAL_HEADER. * m4/byteswap.m4 (gl_BYTESWAP): Set GL_GENERATE_BYTESWAP_H instead of BYTESWAP_H. Drop AC_SUBST and AM_CONDITIONAL invocations. * modules/byteswap (configure.ac): Invoke gl_CONDITIONAL_HEADER. * m4/errno_h.m4 (gl_HEADER_ERRNO_H): Set GL_GENERATE_ERRNO_H instead of ERRNO_H. Drop AC_SUBST and AM_CONDITIONAL invocations. (gl_REPLACE_ERRNO_VALUE): Update. * m4/perror.m4 (gl_FUNC_PERROR): Update. * m4/strerror.m4 (gl_FUNC_STRERROR): Update. * m4/strerror_r.m4 (gl_FUNC_STRERROR_R, gl_FUNC_STRERROR_R_WORKS): Update. * modules/errno (configure.ac): Invoke gl_CONDITIONAL_HEADER. * m4/execinfo.m4 (gl_EXECINFO_H): Set GL_GENERATE_EXECINFO_H instead of EXECINFO_H. Drop AC_SUBST and AM_CONDITIONAL invocations. Drop AC_LIBOBJ invocation. * modules/execinfo (configure.ac): Invoke gl_CONDITIONAL_HEADER and AC_LIBOBJ. * m4/float_h.m4 (gl_FLOAT_H): Set GL_GENERATE_FLOAT_H instead of FLOAT_H. Drop AC_SUBST and AM_CONDITIONAL invocations. * modules/float (configure.ac): Invoke gl_CONDITIONAL_HEADER. * m4/fnmatch_h.m4 (gl_FNMATCH_H, gl_REPLACE_FNMATCH_H): Set GL_GENERATE_FNMATCH_H instead of FNMATCH_H. Drop AC_SUBST and AM_CONDITIONAL invocations. * modules/fnmatch-h (configure.ac): Invoke gl_CONDITIONAL_HEADER. * modules/fnmatch (configure.ac): Likewise. * m4/getopt.m4 (gl_FUNC_GETOPT_POSIX, gl_GETOPT_SUBSTITUTE_HEADER): Set GL_GENERATE_GETOPT_H instead of GETOPT_H. Set GL_GENERATE_GETOPT_CDEFS_H instead of GETOPT_CDEFS_H. Drop AC_SUBST invocations. * modules/getopt-posix (configure.ac): Invoke gl_CONDITIONAL_HEADER. * m4/glob_h.m4 (gl_GLOB_H, gl_REPLACE_GLOB_H): Set GL_GENERATE_GLOB_H instead of GLOB_H. Drop AC_SUBST and AM_CONDITIONAL invocations. * modules/glob-h (configure.ac): Invoke gl_CONDITIONAL_HEADER. * modules/glob (configure.ac): Likewise. * m4/iconv_h.m4 (gl_ICONV_H_DEFAULTS, gl_REPLACE_ICONV_H): Set GL_GENERATE_ICONV_H instead of ICONV_H. Drop AC_SUBST and AM_CONDITIONAL invocations. (gl_ICONV_H): Update. * modules/iconv-h (configure.ac): Invoke gl_CONDITIONAL_HEADER. * modules/iconv_open (configure.ac): Likewise. * m4/ieee754-h.m4 (gl_IEEE754_H): Set GL_GENERATE_IEEE754_H instead of IEEE754_H. Drop AC_SUBST and AM_CONDITIONAL invocations. * modules/ieee754-h (configure.ac): Invoke gl_CONDITIONAL_HEADER. * m4/libgmp.m4 (gl_LIBGMP): Set GL_GENERATE_GMP_H instead of GMP_H. Drop AC_SUBST invocation. * modules/libgmp (configure.ac): Invoke gl_CONDITIONAL_HEADER. (Makefile.am): Use GL_GENERATE_GMP_H. * m4/libtextstyle-optional.m4 (gl_LIBTEXTSTYLE_OPTIONAL): Set GL_GENERATE_TEXTSTYLE_H instead of TEXTSTYLE_H. Drop AC_SUBST and AM_CONDITIONAL invocations. * modules/libtextstyle-optional (configure.ac): Invoke gl_CONDITIONAL_HEADER. * m4/limits-h.m4 (gl_LIMITS_H, gl_REPLACE_LIMITS_H): Set GL_GENERATE_LIMITS_H instead of LIMITS_H. Drop AC_SUBST and AM_CONDITIONAL invocations. * modules/limits-h (configure.ac): Invoke gl_CONDITIONAL_HEADER. * m4/monetary_h.m4 (gl_MONETARY_H): Set GL_GENERATE_MONETARY_H instead of MONETARY_H. Drop AC_SUBST and AM_CONDITIONAL invocations. * modules/monetary (configure.ac): Invoke gl_CONDITIONAL_HEADER. * m4/net_if_h.m4 (gl_HEADER_NET_IF): Set GL_GENERATE_NET_IF_H instead of NET_IF_H. Drop AC_SUBST and AM_CONDITIONAL invocations. * modules/net_if (configure.ac): Invoke gl_CONDITIONAL_HEADER. * m4/netinet_in_h.m4 (gl_HEADER_NETINET_IN): Set GL_GENERATE_NETINET_IN_H instead of NETINET_IN_H. Drop AC_SUBST and AM_CONDITIONAL invocations. * modules/netinet_in (configure.ac): Invoke gl_CONDITIONAL_HEADER. * m4/selinux-context-h.m4 (gl_HEADERS_SELINUX_CONTEXT_H): Set GL_GENERATE_SELINUX_CONTEXT_H instead of SELINUX_CONTEXT_H. Drop AC_SUBST and AM_CONDITIONAL invocations. * m4/selinux-label-h.m4 (gl_HEADERS_SELINUX_LABEL_H): Set GL_GENERATE_SELINUX_LABEL_H instead of SELINUX_LABEL_H. Drop AC_SUBST and AM_CONDITIONAL invocations. * modules/selinux-h (configure.ac): Invoke gl_CONDITIONAL_HEADER. * m4/stdalign.m4 (gl_STDALIGN_H): Set GL_GENERATE_STDALIGN_H instead of STDALIGN_H. Drop AC_SUBST and AM_CONDITIONAL invocations. * modules/stdalign (configure.ac): Invoke gl_CONDITIONAL_HEADER. * m4/stdarg.m4 (gl_STDARG_H): Set GL_GENERATE_STDARG_H instead of STDARG_H. Drop AC_SUBST and AM_CONDITIONAL invocations. * modules/stdarg (configure.ac): Invoke gl_CONDITIONAL_HEADER. * m4/stdbool.m4 (gl_STDBOOL_H): Renamed from AM_STDBOOL_H. Set GL_GENERATE_STDBOOL_H instead of STDBOOL_H. Drop AC_SUBST and AM_CONDITIONAL invocations. * m4/parse-datetime.m4 (gl_PARSE_DATETIME): Don't require AM_STDBOOL_H. * modules/stdbool (configure.ac): Invoke gl_STDBOOL_H instead of AM_STDBOOL_H. Invoke gl_CONDITIONAL_HEADER. * m4/stddef_h.m4 (gl_STDDEF_H): Set GL_GENERATE_STDDEF_H instead of STDDEF_H. Drop AC_SUBST and AM_CONDITIONAL invocations. * modules/stddef (configure.ac): Invoke gl_CONDITIONAL_HEADER. * m4/stdint.m4 (gl_STDINT_H): Set GL_GENERATE_STDINT_H instead of STDINT_H. Drop AC_SUBST and AM_CONDITIONAL invocations. * m4/inttypes.m4 (gl_INTTYPES_PRI_SCN): Update. * modules/stdint (configure.ac): Invoke gl_CONDITIONAL_HEADER. * m4/stdnoreturn.m4 (gl_STDNORETURN_H): Set GL_GENERATE_STDNORETURN_H instead of STDNORETURN_H. Drop AC_SUBST and AM_CONDITIONAL invocations. * modules/stdnoreturn (configure.ac): Invoke gl_CONDITIONAL_HEADER. * m4/sys_socket_h.m4 (gl_SYS_SOCKET_H): Set GL_GENERATE_SYS_SOCKET_H instead of SYS_SOCKET_H. * m4/sysexits.m4 (gl_SYSEXITS): Set GL_GENERATE_SYSEXITS_H instead of SYSEXITS_H. Drop AC_SUBST and AM_CONDITIONAL invocations. * modules/sysexits (configure.ac): Invoke gl_CONDITIONAL_HEADER. * modules/sigsegv (configure.ac): Set GL_GENERATE_SIGSEGV_H instead of SIGSEGV_H. Drop AC_SUBST and AM_CONDITIONAL invocations. Invoke gl_CONDITIONAL_HEADER.
* maint: run 'make update-copyright'Paul Eggert2020-12-311-1/+1
|
* Small autoconf macro improvements.Bruno Haible2020-07-261-6/+10
| | | | | | | | | * m4/mktime.m4 (gl_FUNC_MKTIME_WORKS): Make it possible for the user to override the value of gl_cv_func_working_mktime. * m4/multiarch.m4 (gl_MULTIARCH): Show a line "checking whether the compiler produces multi-arch binaries..." in the configure output. * m4/size_max.m4 (gl_SIZE_MAX): When not found, say "no". * m4/parse-datetime.m4 (gl_C_COMPOUND_LITERALS): Improve indentation.
* bison: rely on bison's %require to check a version requirementAkim Demaille2020-05-031-1/+1
| | | | | | | | | | | See https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00021.html. * m4/bison.m4 (gl_PROG_BISON): Let bison itself decide if it it recent enough of not. So far it is the only know Yacc tool that supports '%require'. Other yaccs will actually even choke on seeing the -o option after the input file name. * m4/parse-datetime.m4: Simplify gl_PROG_BISON invocation.
* bison: New module.Bruno Haible2020-05-011-22/+2
| | | | | | | | | * m4/bison.m4 (gl_PROG_BISON): New macro, extracted from m4/parse-datetime.m4. * m4/parse-datetime.m4 (gl_PARSE_DATETIME): Invoke gl_PROG_BISON. * modules/bison: New file. * modules/parse-datetime (Files): Remove m4/bison.m4. (Depends-on): Add bison.
* parse-datetime: Use 'restrict'.Bruno Haible2020-02-231-1/+2
| | | | | | * lib/parse-datetime.h (parse_datetime, parse_datetime2): Use 'restrict'. * m4/parse-datetime.m4 (gl_PARSE_DATETIME): Require AC_C_RESTRICT.
* maint: Run 'make update-copyright'Paul Eggert2019-12-311-1/+1
|
* parse-datetime: Require Bison 2.4 or newer.Bruno Haible2019-07-201-1/+32
| | | | | | | * m4/parse-datetime.m4 (gl_PARSE_DATETIME): Set PARSE_DATETIME_BISON. Code taken from gettext's intl.m4. * modules/parse-datetime (Makefile.am): Use PARSE_DATETIME_BISON instead of YACC.
* maint: Run 'make update-copyright'Paul Eggert2019-01-011-1/+1
|
* maint: Run 'make update-copyright'Paul Eggert2018-01-011-1/+1
|
* parse-datetime: overflow and debug cleanupsPaul Eggert2017-04-221-17/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This long patch was triggered by this bug report from Ruediger Meier: http://lists.gnu.org/archive/html/bug-gnulib/2017-04/msg00028.html I fixed the bug he noted, then found some others nearby, and then still others. Oh my goodness, there were a lot of bugs. I cleaned up some of the code to follow GNU standards while I was at it. * lib/parse-datetime.y (ISDIGIT): Remove; all callers changed to use c_isdigit. (EPOCH_YEAR): Remove; unused. (TM_YEAR_BASE): Now an enum rather than a macro. (HOUR, debug_strfdatetime): Multiply hour by 3600, not 60, to get time zone offset, since timezones now are in terms of seconds and not minutes. (long_time_t): Remove. All uses replaced by time_t or intmax_t as appropriate. Verify that intmax_t is wide enough. (time_overflow, time_zone_str): New functions, used to deal more reliably with overflow. (dbg_printf): Add printf attribute, to help catch integer width errors. (textint, relative_time, parser_control, time_zone_hhmm, set_hhmmss) (%union, to_hour, yylex, parse_datetime2): Use intmax_t instead of long int and/or long_time_t. All uses changed. (DBGBUFSIZE): Move earlier. (relative_time, set_hhmmss, parser_control): Just use int for nanoseconds and for time zones; that’s wide enough. (parser_control): Use bool for members like year_seen that can be booleans instead of counters. All uses changed. Remove debug_default_input_timezone; no longer needed. All uses removed. (apply_relative_time): Return a bool overflow flag. All uses changed to check for overflow. (apply_relative_time, zone, date, relunit, relunit_snumber) (signed_seconds, unsigned_seconds, yylex, parse_datetime2): Check for integer overflow portably. (str_days): Use just int for N, as it’s wide enough. Prefer 2D char arrays to arrays of char * when it looks like 2D is a win on typical platforms. Prefer snprintf to strncpy/strncat, for simplicity; all buffers are smaller than INT_MAX so this is safe. (TIME_ZONE_BUFSiZE, TM_YEAR_BUFSIZE): New constants. (debug_print_current_time): Don’t assume tv_nsec is of type long, as this is not true on x32. Output "." before any nanoseconds. (debug_print_current_time, parse_datetime2): Output local zones using a more-consistent format. (debug_print_current_time, date, parse_datetime2): (main) [TEST]: Don’t assume time_t is the same width as long. (print_rel_part): New function, replacing ... (PRINT_REL_PART): ... this macro, which was removed. All uses changed. (debug_print_relative_time): Use bool for boolean. (local_zone): dsts_seen now counts only tDST instances. (date): Fix printf of size_t to use %z. Do not assume numeric tokens have negative values merely because the context suggests a syntax with "-" separating tokens. (time_zone_hhmm): Return bool success indicator, which checks for overflow. Store result into PC->time_zone instead. All callers changed. (tm_year_str): New function. Return a bool success indicator and store the result into a buffer. All callers changed. Output the numerically correct string even if adding 1900 to the year would overflow. (to_tm_year): New function, replacing the old to_year. All callers changed. (tm_diff): Sync with glibc. (lookup_word): Use to_uchar instead of doing it by hand. (TZBUFSIZE): Now local to the only function that needs it. (debug_strfdatetime): Simplify now that time zones are int seconds. (debug_strfdate): Work even if tm_year + 1900 would overflow. (get_effective_timezone): Remove. All uses removed. (parse_datetime2): Use fprintf in pieces instead of snprintfing to a fixed-size buffer. Don’t assume that gmtime succeeds iff localtime succeeds. Use tm_gmtoff if available. Simplify how ‘goto fail;’ works in conjunction with the ‘ok’ flag. * m4/parse-datetime.m4 (gl_PARSE_DATETIME): Don’t define TIME_T_FITS_IN_LONG_INT, as it is no longer needed. * modules/parse-datetime (Depends-on): Add inttypes.
* version-etc: new yearPaul Eggert2017-01-011-1/+1
| | | | | | | | | | * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
* version-etc: new yearPaul Eggert2016-01-011-1/+1
| | | | | | | | | | * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
* version-etc: new yearPaul Eggert2014-12-311-1/+1
| | | | | | * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright date. * all files: Run 'make update-copyright'.
* maint: update copyrightEric Blake2014-01-011-1/+1
| | | | | | I ran 'make update-copyright'. Signed-off-by: Eric Blake <eblake@redhat.com>
* maint: update all copyright year number rangesEric Blake2013-01-011-1/+1
| | | | | | Run "make update-copyright". Compare to commit 1602f0a from last year. Signed-off-by: Eric Blake <eblake@redhat.com>
* parse-datetime, parse-duration: no 'static inline'Paul Eggert2012-11-291-2/+1
| | | | | | | | | | * lib/parse-datetime.y (to_uchar): * lib/parse-duration.c (str_const_to_ul, str_const_to_l) (scale_n_add): Now static, not static inline. * m4/parse-datetime.m4 (gl_PARSE_DATETIME): * modules/parse-duration (configure.ac): Do not require AC_C_INLINE.
* parse-datetime: fix failure to diagnose invalid inputJim Meyering2012-07-041-1/+2
| | | | | | | | | | | | date -d "$(printf '\xb0')" would print 00:00:00 with today's date rather than diagnosing the invalid input. Now it reports this: date: invalid date '\260' * lib/parse-datetime.y (to_uchar): Define. (yylex): Don't sign-extend "other" bytes. * m4/parse-datetime.m4: Require AC_C_INLINE for first use of "inline". Thanks to Bruno Haible for the patch to this file. * tests/test-parse-datetime.c (main): Add a test to trigger the bug. Peter Evans reported the bug in GNU date: http://bugs.gnu.org/11843
* maint: update all copyright year number rangesJim Meyering2012-01-011-1/+1
| | | | Run "make update-copyright".
* TYPE_MAXIMUM: avoid theoretically undefined behaviorPaul Eggert2011-01-301-3/+5
| | | | | | | | | | | | | | * lib/intprops.h (TYPE_MINIMUM, TYPE_MAXIMUM): Do not shift a negative number, which the C Standard says has undefined behavior. In practice this is not a problem, but might as well do it by the book. Reported by Rich Felker and Eric Blake; see <http://lists.gnu.org/archive/html/bug-gnulib/2011-01/msg00493.html>. * lib/strtol.c (TYPE_MINIMUM, TYPE_MAXIMUM): Likewise. * m4/mktime.m4 (AC_FUNC_MKTIME): Likewise. * m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): Likewise. * m4/parse-datetime.m4 (gl_PARSE_DATETIME): Likewise. * m4/stdint.m4 (gl_STDINT_H): Likewise. * lib/mktime.c (TYPE_MAXIMUM): Redo slightly to match the others.
* maint: update almost all copyright ranges to include 2011Jim Meyering2011-01-011-1/+1
| | | | Run the new "make update-copyright" rule.
* parse-datetime: better name than get_dateEric Blake2010-10-051-0/+53
* NEWS: Reword the deprecation notice. * modules/get_date: Rename to modules/parse-datetime. * modules/get_date-tests: Rename to modules/parse-datetime-tests. * m4/get_date.m4: Rename to m4/parse-datetime.m4. * lib/get_date.y: Rename to lib/parse-datetime.y. * tests/test-get_date.c: Rename to tests/test-parse-datetime.c. * doc/get_date.texi: Rename to doc/parse-datetime.texi. * doc/getdate.texi: Provide fallback wrapper. * lib/getdate.h: Move guts, and wrap... * lib/parse-datetime.h: ...new file. * lib/parse-datetime.y (get_date): Rename... (parse_datetime): ...to this. * m4/parse-datetime.m4 (gl_GET_DATE): Rename... (gl_PARSE_DATETIME): ...to this. * doc/posix-functions/getdate.texi (get_date): Provide fallback documentation. * modules/getdate (Files): Provide fallback docs and header. (Notice, Depends-on): Update references. * tests/test-parse-datetime.c: Likewise. * DEPENDENCIES: Likewise. * MODULES.html.sh (Date and time <time.h>): Likewise. * doc/parse-datetime.texi (Date input formats) (Authors of parse_datetime): Likewise. * modules/parse-datetime (Files, configure.ac, Makefile.am) (Include): Likewise. * modules/parse-datetime-tests (Files, Makefile.am): Likewise. * gnulib-tool: Likewise. * m4/bison.m4 (gl_BISON): Likewise. Suggested by Bruno Haible. Signed-off-by: Eric Blake <eblake@redhat.com>