summaryrefslogtreecommitdiff
path: root/m4
Commit message (Collapse)AuthorAgeFilesLines
...
* largefile: Simplify.Bruno Haible2017-05-131-7/+2
| | | | | * m4/sys_stat_h.m4 (gl_HEADER_SYS_STAT_H): Remove unused definition of _GL_WINDOWS_64_BIT_ST_SIZE.
* largefile: Improve and document.Bruno Haible2017-05-131-3/+18
| | | | | | | | | * m4/largefile.m4 (gl_LARGEFILE): Set WINDOWS_64_BIT_ST_SIZE to 0 if the mingw headers already define 'stat' appropriately. * modules/largefile (Description): Clarify. * doc/largefile.texi: New file. * doc/gnulib.texi: Include it. * doc/posix-headers/sys_types.texi: Update.
* truncate: New module.Bruno Haible2017-05-132-3/+39
| | | | | | | | | | | | | | * lib/unistd.in.h (truncate): New declaration. * lib/truncate.c: New file. * m4/truncate.m4: New file. * m4/unistd_h.m4 (gl_UNISTD_H): Test whether 'truncate' is declared. (gl_UNISTD_H_DEFAULTS): Initialize GNULIB_TRUNCATE, HAVE_TRUNCATE, REPLACE_TRUNCATE. * modules/unistd (Makefile.am): Substitute GNULIB_TRUNCATE, HAVE_TRUNCATE, REPLACE_TRUNCATE. * modules/truncate: New file. * tests/test-unistd-c++.cc (truncate): Test signature. * doc/posix-functions/truncate.texi: Mention the new module.
* windows-stat-timespec: New module.Bruno Haible2017-05-132-1/+25
| | | | | | | | | | | | | | | | | | | | | | | | * modules/windows-stat-timespec: New file. * m4/windows-stat-timespec.m4: New file. * m4/sys_stat_h.m4 (gl_HEADER_SYS_STAT_H): Set WINDOWS_STAT_TIMESPEC. * modules/sys_stat (Makefile.am): Substitute WINDOWS_STAT_TIMESPEC. * lib/sys_stat.in.h (struct stat) [WINDOWS_STAT_TIMESPEC]: Declare with fields st_atim, st_mtim, st_ctim. (st_atime, st_mtime, st_ctime): Define as macros. (_GL_WINDOWS_STAT_TIMESPEC): New macro. * lib/stat-w32.h (_gl_convert_FILETIME_to_timespec) [_GL_WINDOWS_STAT_TIMESPEC]: New declaration. * lib/stat-w32.c (_gl_convert_FILETIME_to_timespec) [_GL_WINDOWS_STAT_TIMESPEC]: New function. (_gl_convert_FILETIME_to_POSIX): Adjust coding style. (_gl_fstat_by_handle): If _GL_WINDOWS_STAT_TIMESPEC, convert the FILETIME to 'struct timespec', not 'time_t'. * lib/stat.c (rpl_stat): If _GL_WINDOWS_STAT_TIMESPEC, convert the FILETIME to 'struct timespec', not 'time_t'. * lib/stat-time.h (STAT_TIMESPEC): Define also if _GL_WINDOWS_STAT_TIMESPEC. * doc/windows-stat-timespec.texi: New file. * doc/gnulib.texi: Include it.
* windows-stat-override: New module.Bruno Haible2017-05-131-1/+2
| | | | | | | | | | | | | | | * lib/sys_stat.in.h (stat) [GNULIB_OVERRIDES_STRUCT_STAT]: Provide own definition. Define GNULIB_defined_struct_stat. (fstat, fstatat, lstat, stat) [GNULIB_OVERRIDES_STRUCT_STAT]: Provoke link error if this symbol is used and the corresponding module is not in use. (_stat64, _stat32i64, _stati64, _stat32, _stat64i32): Don't redefine if GNULIB_OVERRIDES_STRUCT_STAT. * m4/sys_stat_h.m4 (gl_SYS_STAT_H_DEFAULTS): Initialize GNULIB_OVERRIDES_STRUCT_STAT. * modules/sys_stat (Makefile.am): Substitute GNULIB_OVERRIDES_STRUCT_STAT. * modules/windows-stat-override: New file.
* gettimeofday: Increase precision on mingw.Bruno Haible2017-05-111-2/+8
| | | | | | | | | * m4/gettimeofday.m4 (gl_FUNC_GETTIMEOFDAY): Require AC_CANONICAL_HOST. Set REPLACE_GETTIMEOFDAY to 1 on mingw. * lib/gettimeofday.c (gettimeofday): On native Windows, use the GetSystemTimePreciseAsFileTime based implementation always. * doc/posix-functions/gettimeofday.texi: Mention precision problem on mingw.
* time: Fix missing initialization of HAVE_TIMEZONE_T.Bruno Haible2017-05-113-4/+5
| | | | | | | | | | * m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS): Initialize HAVE_TIMEZONE_T here... * m4/sys_time_h.m4 (gl_HEADER_SYS_TIME_H_DEFAULTS): ... not here. * m4/time_rz.m4 (gl_TIME_RZ): Require gl_HEADER_TIME_H_DEFAULTS, not gl_HEADER_SYS_TIME_H_DEFAULTS. * modules/time_rz (Depends-on): Add 'time'. Remove useless quoting. (configure.ac): Remove useless quoting.
* Implement a way to opt out from MSVC support.Bruno Haible2017-05-106-30/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is useful for Emacs. * modules/msvc-nothrow (configure.ac): Invoke gl_MODULE_INDICATOR. * lib/accept4.c: Include <io.h> as an alternative to msvc-nothrow.h. * lib/error.c: Likewise. * lib/fcntl.c: Likewise. * lib/flock.c: Likewise. * lib/fstat.c: Likewise. * lib/fsync.c: Likewise. * lib/ioctl.c: Likewise. * lib/isapipe.c: Likewise. * lib/lseek.c: Likewise. * lib/nonblocking.c: Likewise. * lib/poll.c: Likewise. * lib/select.c: Likewise. * lib/sockets.h: Likewise. * lib/sockets.c: Likewise. * lib/stdio-read.c: Likewise. * lib/stdio-write.c: Likewise. * lib/utimens.c: Likewise. * lib/w32sock.h: Likewise. * lib/w32spawn.h: Likewise. * tests/test-cloexec.c: Likewise. * tests/test-dup-safer.c: Likewise. * tests/test-dup2.c: Likewise. * tests/test-dup3.c: Likewise. * tests/test-fcntl.c: Likewise. * tests/test-pipe.c: Likewise. * tests/test-pipe2.c: Likewise. * lib/ftruncate.c: Likewise. (chsize_nothrow): Renamed from chsize. * lib/msvc-nothrow.c: Don't include msvc-inval.h if HAVE_MSVC_INVALID_PARAMETER_HANDLER is not defined. * lib/close.c: Likewise. * lib/dup.c: Likewise. * lib/fclose.c: Likewise. * lib/raise.c: Likewise. * tests/test-fgetc.c: Likewise. * tests/test-fputc.c: Likewise. * tests/test-fread.c: Likewise. * tests/test-fwrite.c: Likewise. * lib/getdtablesize.c: Likewise. (_setmaxstdio_nothrow): Renamed from _setmaxstdio. * lib/isatty.c: Don't include msvc-inval.h if HAVE_MSVC_INVALID_PARAMETER_HANDLER is not defined. Include <io.h> as an alternative to msvc-nothrow.h. * lib/read.c: Likewise. * lib/write.c: Likewise. * lib/dup2.c: Likewise. (dup2_nothrow): New function. (ms_windows_dup2): Use it. * m4/close.m4 (gl_FUNC_CLOSE): Invoke gl_MSVC_INVAL and test HAVE_MSVC_INVALID_PARAMETER_HANDLER only if gl_MSVC_INVAL is defined. * m4/dup.m4 (gl_FUNC_DUP): Likewise. * m4/fdopen.m4 (gl_FUNC_FDOPEN): Likewise. * m4/raise.m4 (gl_FUNC_RAISE): Likewise. * m4/read.m4 (gl_FUNC_READ): Likewise. * m4/write.m4 (gl_FUNC_WRITE): Likewise. * doc/windows-without-msvc.texi: New file. * doc/gnulib.texi (Native Windows Support without MSVC Support): New section.
* tzset: Work around TZ problem on native Windows.Bruno Haible2017-05-012-4/+5
| | | | | | | | | | | | * m4/tzset.m4 (gl_FUNC_TZSET): Require AC_CANONICAL_HOST. On native Windows, set REPLACE_TZSET to 1. * lib/tzset.c (tzset): On native Windows, fix TZ if necessary, and invoke '_tzset' instead of 'tzset'. * doc/posix-functions/tzset.texi: Mention the native Windows workaround. * modules/time_rz (Depends-on): Add tzset. * lib/time_rz.c (tzset): Remove fallback definition. * m4/time_rz.m4 (gl_TIME_RZ): Don't test for tzset.
* New module 'localtime-buffer', split off from module 'gettimeofday'.Bruno Haible2017-05-014-23/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/localtime-buffer.h: New file. * lib/localtime-buffer.c: New file, extracted from lib/gettimeofday.c. * lib/time.in.h (tzset): New declaration. (localtime, gmtime): Don't test GNULIB_GETTIMEOFDAY. * lib/tzset.c: New file, extracted from lib/gettimeofday.c. * lib/gettimeofday.c: Include localtime-buffer.h. Remove code that was moved to lib/localtime-buffer.c or lib/tzset.c. * m4/localtime-buffer.m4: New file. * m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS): Initialize GNULIB_TZSET, HAVE_TZSET, REPLACE_TZSET. * m4/tzset.m4 (gl_FUNC_TZSET): Move code from m4/gettimeofday.m4 to here, with modifications. Set HAVE_TZSET, REPLACE_TZSET. Invoke gl_LOCALTIME_BUFFER_NEEDED. (gl_FUNC_TZSET_CLOBBER): Don't require gl_HEADER_SYS_TIME_H; not needed since 2007-01-18. * m4/gettimeofday.m4 (gl_FUNC_GETTIMEOFDAY): Remove code that deals with tzset. (gl_FUNC_GETTIMEOFDAY_CLOBBER): Require gl_LOCALTIME_BUFFER_DEFAULTS. Invoke gl_LOCALTIME_BUFFER_NEEDED instead of gl_GETTIMEOFDAY_REPLACE_LOCALTIME. (gl_GETTIMEOFDAY_REPLACE_LOCALTIME): Remove macro. * modules/localtime-buffer: New file. * modules/time (Depends-on): Remove 'gettimeofday'. (Makefile.am): Substitute GNULIB_TZSET, HAVE_TZSET, REPLACE_TZSET. Don't substitute GNULIB_GETTIMEOFDAY. * modules/tzset (Description): Enable hyperlink to POSIX spec. (Files): Add lib/tzset.c. (Depends-on): Remove gettimeofday. Add localtime-buffer, time. (configure.ac): Arrange to conditionally compile lib/tzset.c. Invoke gl_TIME_MODULE_INDICATOR. * modules/gettimeofday (Depends-on): Add localtime-buffer.
* copy-file: Preserve sub-second time stamps.Bruno Haible2017-05-011-2/+2
| | | | | | | | | | * lib/copy-file.c: Include stat-time.h, utimens.h instead of <utime.h>. (qcopy_file_preserving): Use 'struct timespec' and utimens() to transport the time stamps from the original file to the destination file. * m4/copy-file.m4 (gl_COPY_FILE): Don't test for utime, utimes. * modules/copy-file (Depends-on): Add stat-time, utimns instead of utime-h.
* wchar: Fix compilation error with the original mingw.org mingw.Bruno Haible2017-05-013-11/+19
| | | | | | | | | | | | * lib/wchar.in.h (rpl_wint_t): If <crtdefs.h> does not exist, include <stddef.h> instead. * m4/wint_t.m4 (gl_TYPE_WINT_T_PREREQ): New macro, extracted from gl_WCTYPE_H. * m4/wctype_h.m4 (gl_WCTYPE_H): Don't set HAVE_CRTDEFS_H here; require gl_TYPE_WINT_T_PREREQ instead. * m4/wchar_h.m4 (gl_WCHAR_H): Require gl_TYPE_WINT_T_PREREQ. * modules/wchar (Makefile.am): Substitute HAVE_CRTDEFS_H. Reported by Eli Zaretskii <eliz@gnu.org>.
* wcsftime: New module.Bruno Haible2017-04-302-2/+24
| | | | | | | | | | | | | * lib/wchar.in.h (wcsftime): New declaration. * lib/wcsftime.c: New file. * m4/wcsftime.m4: New file. * m4/wchar_h.m4 (gl_WCHAR_H): Test for wcsftime declaration. (gl_HEADER_TIME_H_DEFAULTS): Initialize GNULIB_WCSFTIME, HAVE_WCSFTIME, REPLACE_WCSFTIME. * modules/wchar (Makefile.am): Substitute GNULIB_WCSFTIME, HAVE_WCSFTIME, REPLACE_WCSFTIME. * modules/wcsftime: New file. * doc/posix-functions/wcsftime.texi: Mention the new module.
* strftime-fixes: New module.Bruno Haible2017-04-303-7/+18
| | | | | | | | | | | | | | * lib/time.in.h (strftime): New declaration. * lib/strftime-fixes.c: New file. * m4/strftime.m4 (gl_FUNC_GNU_STRFTIME): Inline gl_FUNC_STRFTIME macro. (gl_FUNC_STRFTIME): Remove macro. * m4/strftime-fixes.m4: New file. * m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS): Initialize GNULIB_STRFTIME, REPLACE_STRFTIME. * modules/time (Makefile.am): Substitute GNULIB_STRFTIME, REPLACE_STRFTIME. * modules/strftime-fixes: New file. * doc/posix-functions/strftime.texi: Mention the new module.
* mktime: Work around TZ problem on native Windows.Bruno Haible2017-04-302-22/+43
| | | | | | | | | | | | | | | | | | | | * lib/mktime.c: Add #ifs to make the algorithmic workaround independent from the native Windows workaround. * m4/mktime.m4 (gl_FUNC_MKTIME_WORKS): New macro, extracted from gl_FUNC_MKTIME. If guessing, set gl_cv_func_working_mktime to 'guessing no'. (gl_FUNC_MKTIME): Require it. Require AC_CANONICAL_HOST. Set REPLACE_MKTIME to 1 on native Windows. Define NEED_MKTIME_WORKING, NEED_MKTIME_WINDOWS. (gl_FUNC_MKTIME_INTERNAL): Require gl_FUNC_MKTIME_WORKS, not gl_FUNC_MKTIME. Set WANT_MKTIME_INTERNAL, not REPLACE_MKTIME. Define NEED_MKTIME_INTERNAL. * m4/timegm.m4 (gl_FUNC_TIMEGM): Require gl_FUNC_MKTIME_WORKS, not gl_FUNC_MKTIME. Cope with 'guessing yes' value. * modules/mktime-internal (configure.ac): Test WANT_MKTIME_INTERNAL, not REPLACE_MKTIME. * doc/posix-functions/mktime.texi: Mention the native Windows workaround.
* localtime: New module.Bruno Haible2017-04-302-0/+15
| | | | | | | | | | | * lib/time.in.h (localtime): Declare also if requested by module 'localtime'. * lib/localtime.c: New file. * m4/localtime.m4: New file. * m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS): Initialize GNULIB_LOCALTIME. * modules/time (Makefile.am): Substitute GNULIB_LOCALTIME. * modules/localtime: New file. * doc/posix-functions/localtime.texi: Mention the new module.
* ctime: New module.Bruno Haible2017-04-302-1/+18
| | | | | | | | | | | * lib/time.in.h (ctime): New declaration. * lib/ctime.c: New file. * m4/ctime.m4: New file. * m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS): Initialize GNULIB_CTIME, REPLACE_CTIME. * modules/time (Makefile.am): Substitute GNULIB_CTIME, REPLACE_CTIME. * modules/ctime: New file. * doc/posix-functions/ctime.texi: Mention the new module.
* gettimeofday: Provide higher resolution on native Windows.Bruno Haible2017-04-301-5/+2
| | | | | | | | | | * lib/gettimeofday.c: Don't include <sys/timeb.h>. (GetSystemTimePreciseAsFileTimeFuncType): New variable. (initialize): Initialize it. (gettimeofday) [WINDOWS_NATIVE]: Use it, and convert from FILETIME to 'struct timeval'. Don't use _ftime(). * m4/gettimeofday.m4 (gl_PREREQ_GETTIMEOFDAY): Don't test for <sys/timeb.h> and _ftime.
* utime: New module.Bruno Haible2017-04-302-0/+35
| | | | | | | | | | | | | | | * lib/utime.in.h: Add comment for snippets. (utime): New declaration. * lib/utime.c: New file. * m4/utime.m4: New file. * m4/utime_h.m4 (gl_UTIME_H): Test for utime declaration. (gl_UTIME_H_DEFAULTS): Initialize GNULIB_UTIME, HAVE_UTIME, REPLACE_UTIME. * modules/utime-h (Depends-on): Add snippets. (Makefile.am): Substitute GNULIB_UTIME, HAVE_UTIME, REPLACE_UTIME. Insert snippets. * modules/utime: New file. * doc/posix-functions/utime.texi: Mention the new module.
* utime-h: Modernize handling of 'struct utimbuf'.Bruno Haible2017-04-303-42/+33
| | | | | | | | | | | | | | | | | * lib/utime.in.h: Include next <utime.h> if it exists. (utimbuf): Define to _utimbuf on native Windows. * m4/utime-h.m4 (gl_UTIME_H): Check for prerequisites of include_next. Set UTIME_H on native Windows. (gl_UTIME_MODULE_INDICATOR, gl_HEADER_UTIME_H_DEFAULTS): New macros. * modules/utime-h (Depends-on): Add include_next. (Makefile.am): Substitute also HAVE_UTIME_H, INCLUDE_NEXT, PRAGMA_SYSTEM_HEADER, PRAGMA_COLUMNS, NEXT_UTIME_H. * lib/utimens.c (utimbuf): Remove fallback definition. * m4/utimens.m4 (gl_UTIMENS): Don't require gl_CHECK_TYPE_STRUCT_UTIMBUF. * m4/utimbuf.m4: Remove file. * modules/utimens (Files): Remove m4/utimbuf.m4.
* Make use of module 'utime-h'.Bruno Haible2017-04-301-2/+2
| | | | | | | | | * modules/copy-file (Depends-on): Add utime-h. * lib/copy-file.c: Assume that <utime.h> exists. * m4/copy-file.m4 (gl_COPY_FILE): Don't test for <utime.h>. * modules/utimens (Depends-on): Add utime-h. * lib/utimens.c: Assume that <utime.h> exists.
* utime-h: New module.Bruno Haible2017-04-301-0/+19
| | | | | | | | | | * m4/utime_h.m4: New file. * lib/utime.in.h: New file. * modules/utime-h: New file. * doc/posix-headers/utime.texi: Mention the new module. * tests/test-utime-h.c: New file. * modules/utime-h-tests: New file.
* Fix a few typos.Bruno Haible2017-04-303-3/+5
| | | | | | | | * m4/fstat.m4 (gl_FUNC_FSTAT): Require AC_CANONICAL_HOST. * m4/stat.m4 (gl_FUNC_STAT): Fix comment. * doc/posix-functions/fstat.texi: Fix a plural typo. * doc/posix-functions/stat.texi: Likewise. * m4/include_next.m4: Update comments.
* stat: Fix time_t values and other problems on native Windows platforms.Bruno Haible2017-04-291-53/+49
| | | | | | | | | | | | | | | | * doc/posix-functions/stat.texi: Mention the problem with the Microsoft implementations of stat(). * lib/stat.c: Include filename.h instead of dosname.h. Include malloca.h, stat-w32.h. (is_unc_root): New function. (rpl_stat): New implementation for native Windows. Remove REPLACE_FUNC_STAT_DIR code. * m4/stat.m4 (gl_FUNC_STAT): On native Windows, set REPLACE_STAT always. Don't define REPLACE_FUNC_STAT_DIR. (gl_PREREQ_STAT): Require gl_HEADER_SYS_STAT_H. * modules/stat (Files): Add lib/stat-w32.h, lib/stat-w32.c. (Depends-on): Remove dosname. Add filename, malloca. (configure.ac): Also compile lib/stat-w32.c.
* fstat: Fix time_t values on native Windows platforms.Bruno Haible2017-04-291-12/+13
| | | | | | | | | | | | | | | | * doc/posix-functions/fstat.texi: Mention the problem with st_*time. * lib/stat-w32.h: New file. * lib/stat-w32.c: New file. * lib/fstat.c: Don't include msvc-inval.h. Include msvc-nothrow.h, stat-w32.h instead. (fstat_nothrow): Remove function. (rpl_fstat): Implement by means of _gl_fstat_by_handle. * m4/fstat.m4 (gl_FUNC_FSTAT): On native Windows, set REPLACE_FSTAT always. (gl_PREREQ_FSTAT): Require gl_HEADER_SYS_STAT_H. * modules/fstat (Files): Add lib/stat-w32.h, lib/stat-w32.c. (Depends-on): Remove msvc-inval. Add pathmax, msvc-nothrow. (configure.ac): Also compile lib/stat-w32.c.
* wctype-h: Fix compilation error with the original mingw.org mingw.Bruno Haible2017-04-271-1/+9
| | | | | | | | | * m4/wctype_h.m4 (gl_WCTYPE_H): Test for <crtdefs.h>. Set HAVE_CRTDEFS_H. * modules/wctype-h (Makefile.am): Substitute HAVE_CRTDEFS_H. * lib/wctype.in.h (rpl_wint_t): If <crtdefs.h> does not exist, include <stddef.h> instead. Reported and proposed by Eli Zaretskii <eliz@gnu.org>.
* strerror_r-posix: Revert commits from 2016-10-16,2016-11-04,2016-11-14.Bruno Haible2017-04-251-20/+6
| | | | | * m4/strerror_r.m4: Revert changes since 2016-10-16. * lib/strerror_r.c: Likewise.
* getlogin_r: Work around bug in Mac OS X 10.12.Bruno Haible2017-04-231-13/+17
| | | | | | | | | * m4/getlogin_r.m4 (gl_FUNC_GETLOGIN_R): Test also against the Mac OS X bug. * lib/getlogin_r.c (getlogin_r): When getlogin_r returns a string of the given size minus 1, call getlogin_r a second time, on a larger buffer. * modules/getlogin_r (Depends-on): Add malloca. * doc/posix-functions/getlogin_r.texi: Mention the Mac OS X bug.
* *printf: Work around rounding bug on Mac OS X.Bruno Haible2017-04-221-1/+8
| | | | | | | * m4/printf.m4 (gl_PRINTF_DIRECTIVE_A): Test for Mac OS X 10.12 bug. * doc/posix-functions/*printf.texi: Mention the rounding bugs of Mac OS X and FreeBSD. * doc/glibc-functions/*printf.texi: Likewise.
* 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.
* getopt-gnu: Add comments.Bruno Haible2017-04-191-0/+9
| | | | | * m4/getopt.m4 (gl_FUNC_GETOPT_GNU): Add comments. * modules/getopt-gnu (configure.ac): Likewise.
* getopt: prefer - to _ in new file namesPaul Eggert2017-04-091-2/+2
| | | | | | | | | * lib/getopt-cdefs.in.h: Rename from lib/getopt_cdefs.in.h. * lib/getopt-core.h: Rename from lib/getopt_core.h. * lib/getopt-ext.h: Rename from lib/getopt_ext.h. * lib/getopt-pfx-core.h: Rename from lib/getopt_pfx_core.h. * lib/getopt-pfx-ext.h: Rename from lib/getopt_pfx_ext.h. All uses changed.
* getopt-gnu: omit some duplicate codePaul Eggert2017-04-061-3/+1
| | | | | | | | * m4/getopt.m4 (gl_FUNC_GETOPT_GNU): Don’t require gl_FUNC_GETOPT_POSIX, as the configure.ac code generated by gnulib-tool already does this. * modules/getopt-gnu (configure.ac): Omit code duplicated from getopt-posix, which we depend on.
* getopt: split up getopt.in.h and eliminate __need_getoptZack Weinberg2017-04-061-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Over in glibc, all of the __need macros are being phased out in favor of small headers that declare only the necessary components, as this is much simpler and less prone to bugs. As getopt is shared with glibc, gnulib needs to do the same for __need_getopt. __need_getopt is misnamed; what it really means is "we want only the getopt features specified in POSIX, not the GNU extensions". glibc placed the "meat" of getopt.h into getopt_core.h and getopt_ext.h; these files can be shared verbatim with gnulib. The portability wrapper, on the other hand, they have renounced altogether; glibc's getopt.h will no longer be shared with gnulib at all. In exchange, certain glibc-specific quirks (having to do with __posix_getopt) no longer need appear in gnulib's headers at all. This patch merges getopt_core.h and getopt_ext.h from glibc, and splits up the current gnulib-side portability wrapper into three additional headers: getopt_pfx_core.h and getopt_pfx_ext.h handle __GETOPT_PREFIX for their respective headers, getopt_cdefs.in.h handles things like __BEGIN_DECLS and __THROW, and getopt.in.h and unistd.in.h just use them. All new files are clearly marked with whether they are shared with glibc. * lib/getopt.in.h: Eliminate __need_getopt. Break up into ... * lib/getopt_core.h, lib/getopt_ext.h: ... these new files shared with glibc, and ... * lib/getopt_cdefs.in.h, lib/getopt_pfx_core.h * lib/getopt_pfx_ext.h: ... these new files not shared with glibc. * lib/unistd.in.h: Include getopt_cdefs.h and getopt_pfx_core.h, instead of defining __need_getopt and including the full getopt.h. * m4/getopt.m4 (gl_GETOPT_SUBSTITUTE_HEADER): Check for sys/cdefs.h. Define substitution variables GETOPT_CDEFS_H and HAVE_SYS_CDEFS_H. * modules/getopt-posix (Files): Add new headers and sort list. (Depends-on): No longer need snippet/arg-nonnull. (Makefile.am): Generate getopt_cdefs.h.
* getopt: clean up getopt.c and getopt1.c file headersZack Weinberg2017-04-061-6/+0
| | | | | | | | | | | | | | | | | | | In getopt.c, there is no need to include wchar.h at all, and it is safe nowadays to assume that stdlib.h does declare getenv (several other gnulib modules make this assumption). In getopt1.c, the #ifdef _LIBC block at the top can be simplified by using "" inclusions consistently, and there is no actual need to include stdlib.h (except in the #ifdef TEST block, where it should be unconditional), nor to provide a backup definition of NULL at all. * lib/getopt1.c: Simplify #ifdeffage at top of file. Move inclusion of stdlib.h to #ifdef TEST block and make unconditional. Do not define NULL. * lib/getopt.c: Don't include wchar.h. No need to declare getenv. * m4/getopt.m4 (gl_PREREQ_GETENV): Delete. * modules/getopt-gnu, modules/getopt-posix: Don't call gl_PREREQ_GETENV.
* stdalign: tweak version# and test for HP-UX IA64Paul Eggert2017-03-191-1/+1
| | | | | | | | | | | Problems reported by Bruno Haible in: http://lists.gnu.org/archive/html/bug-gnulib/2017-03/msg00078.html * lib/stdalign.in.h (_Alignas): * m4/stdalign.m4 (gl_STDALIGN_H): Use octal, not decimal, for __HP_cc version. Perhaps HP formerly used octal (as that is how they document it), but it is decimal in practice now and the ancient implementations no longer matter. * tests/test-stdalign.c (main) [__HP_cc && __ia64]: Skip test.
* stdalign: restore previous behavior for HP-UX IA64Paul Eggert2017-03-181-2/+2
| | | | | | | | | See Bruno Haible's email in: http://lists.gnu.org/archive/html/bug-gnulib/2017-03/msg00066.html which cites p 150 of a manual saying that 'aligned' works on Itanium. * lib/stdalign.in.h (_Alignas): Assume the '061200' applies to Itanium, not to PA-RISC. * m4/stdalign.m4 (gl_STDALIGN_H): Adjust to match stdalign.in.h.
* stdalign: Make it work with HP-UX cc.Bruno Haible2017-03-171-1/+1
| | | | | | * lib/stdalign.in.h (_Alignas): Don't define for HP-UX cc. * m4/stdalign.m4 (gl_STDALIGN_H): No need to enable the extra test for HP-UX cc.
* flexmember: try to detect HP-UX 11.31 cc bugPaul Eggert2017-03-171-2/+5
| | | | | | | Problem reported by Bruno Haible in: http://lists.gnu.org/archive/html/bug-gnulib/2017-03/msg00066.html * m4/flexmember.m4 (AC_C_FLEXIBLE_ARRAY_MEMBER): Attempt to detect bug in HP-UX 11.31 cc.
* gnulib-common.m4: avoid aclocal.m4 bloatPaul Eggert2017-03-111-3/+6
| | | | | | * m4/gnulib-common.m4 (gl_PROG_AR_RANLIB): Hide AM_PROG_AR from aclocal, so that aclocal does not install irrelevant macro definitions into aclocal.m4.
* Fix value of LD for 64-bit compilers on AIX.Bruno Haible2017-03-051-56/+84
| | | | | * m4/lib-ld.m4 (AC_LIB_PROG_LD): For 64-bit compilers on AIX ("gcc -maix64" and "xlc -q64"), add option -b64 to $LD.
* maintainer-makefile: Fix AC_PROG_SED with autoconf cache.Bruno Haible2017-02-251-2/+4
| | | | * m4/gnulib-common.m4 (AC_PROG_SED): Fix AC_CACHE_CHECK invocation.
* havelib: Prefer the search path of /usr/bin/gcc over the one of $CC.Bruno Haible2017-02-191-1/+10
|
* havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.Bruno Haible2017-02-191-45/+53
| | | | * m4/lib-prefix.m4 (AC_LIB_PREPARE_MULTILIB): Use AC_CACHE_CHECK.
* host-cpu-c-abi: Support for 64-bit AIX, 32-bit armhf on arm64, hppa64.Bruno Haible2017-02-111-20/+50
| | | | | | | | | * m4/host-cpu-c-abi.m4 (gl_HOST_CPU_C_ABI): Define also HOST_CPU. For the x32 ABI on x86_64, set HOST_CPU_C_ABI to 'x86_64-x32' and define both __x86_64__ and __x86_64_x32__. For the ELFv2 ABI on powerpc64, define both __powerpc64__ and __powerpc64_elfv2__. Recognize 64-bit compilation on AIX. Recognize 32-bit compilation on arm64/Linux. Distinguish hppa64 from hppa.
* search: Don't assume that tsearch() exists if 'VISIT' is defined.Bruno Haible2017-02-111-1/+22
| | | | | | * m4/search_h.m4 (gl_SEARCH_H): Determine HAVE_TYPE_VISIT. * modules/search (Makefile.am): Substitute HAVE_TYPE_VISIT. * lib/search.in.h (VISIT): Define if HAVE_TYPE_VISIT is 0.
* host-cpu-c-abi: Add support for armhf, arm64, x32, s390x.Bruno Haible2017-01-161-11/+63
| | | | | | | | | * m4/host-cpu-c-abi.m4 (gl_HOST_CPU_C_ABI): Require gl_C_ASM. On x86_64 systems, distinguish x86_64 and x32. On arm systems, distinguish arm, armhf, arm64, and no longer distinguish arm and armel. On s390x systems, distinguish s390 and s390x. * modules/host-cpu-c-abi (Files): Add m4/asm-underscore.m4. * NEWS: Mention the change regarding 'armel'.
* lock: Provide guarantee to avoid writer starvation for rwlocks.Bruno Haible2017-01-052-2/+170
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The rationale is: 1) Read-preferring read-write locks are prone to writer starvation if the number of reader threads multiplied by the percentage of time they have the lock held is too high. 2) Write- preferring read-write locks are the only reliable way to avoid this. 3) There have been reports of 'test-lock' hanging on glibc systems http://lists.gnu.org/archive/html/bug-gnulib/2017-01/msg00009.html, and glibc indeed implements read-preferring rwlocks by default, see http://man7.org/linux/man-pages/man3/pthread_rwlockattr_setkind_np.3.html and https://sourceware.org/bugzilla/show_bug.cgi?id=13701 . * m4/pthread_rwlock_rdlock.m4: New file. * m4/lock.m4 (gl_LOCK): Invoke gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER. * lib/glthread/lock.h [USE_POSIX_THREADS]: Test HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER. Use a different implementation of rwlock initialization on glibc systems without HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER. Use a different implementation of rwlocks altogether on non-glibc systems without HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER. [USE_PTH_THREADS]: Use a different implementation of rwlocks altogether. * lib/glthread/lock.c [USE_POSIX_THREADS] (glthread_rwlock_init_for_glibc): New function. [USE_POSIX_THREADS] (glthread_rwlock_rdlock_multithreaded): Update comment. [USE_PTH_THREADS]: New implementation of rwlocks. [USE_WINDOWS_THREADS] (glthread_rwlock_rdlock_func): Prefer writers over readers. * modules/lock (Files): Add m4/pthread_rwlock_rdlock.m4. (Depends-on): Add 'extensions'. * tests/test-rwlock1.c: New file. * lock-tests (Files): Add it. (Depends-on): Add usleep. (Makefile.am): Add test-rwlock1 to the tests.
* Revert copyright-year change to synced filesPaul Eggert2017-01-029-11/+10
| | | | | Problem reported by Karl Berry in: http://lists.gnu.org/archive/html/bug-gnulib/2017-01/msg00019.html
* version-etc: new yearPaul Eggert2017-01-01757-758/+759
| | | | | | | | | | * 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'.