Paul Eggert [Mon, 8 May 2017 17:37:48 +0000 (10:37 -0700)]
intprops: don’t depend on ‘verify’
Problem reported by Ævar Arnfjörð Bjarmason in:
http://lists.gnu.org/archive/html/bug-gnulib/2017-05/msg00054.html
* lib/intprops.h: Do not include verify.h, and move compile-time
checks from here ...
* tests/test-intprops.c (main): ... to here, if they’re not here
already. Check widths of other standard integer types.
* modules/intprops (Depends-on): Remove ‘verify’.
Bruno Haible [Sun, 7 May 2017 19:50:30 +0000 (21:50 +0200)]
utimens: On native Windows, support 100ns resolution also if fd < 0.
* lib/utime.in.h: Include <time.h>.
(_gl_utimens_windows): New declaration.
* lib/utime.c (_gl_utimens_windows): New function, based on utime.
(utime): Invoke it.
* lib/utimens.c (fdutimens): On native Windows, call _gl_utimens_windows
instead of utime.
* modules/utime (Depends-on): Add 'time'.
* lib/rijndael-api-fst.c (rijndaelBlockEncrypt): Declare 'block' as a
union.
(rijndaelPadEncrypt, rijndaelBlockDecrypt): Likewise.
(rijndaelPadDecrypt): Likewise. Use local variable 'iv' to cache the
value of cipher->IV.
Bruno Haible [Fri, 5 May 2017 19:50:57 +0000 (21:50 +0200)]
inttypes-c++-tests: New module.
* tests/test-inttypes-c++.cc: New file.
(strtoimax): Declare, missing since 2012-01-05.
(strtoumax): Declare, missing since 2012-01-05.
* modules/inttypes-c++-tests: New file.
Paul Eggert [Tue, 2 May 2017 07:40:41 +0000 (00:40 -0700)]
utimens: port to Emacs + MS-Windows
Skip the new MS-Windows-specific code if Emacs.
* lib/utimens.c [EMACS_CONFIGUATION]:
Avoid new MS-Windows-specific code.
(USE_SETFILETIME): New macro.
(fdutimens): Use it.
Bruno Haible [Mon, 1 May 2017 15:27:53 +0000 (17:27 +0200)]
tzset: Work around TZ problem on native Windows.
* 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.
Bruno Haible [Mon, 1 May 2017 11:27:57 +0000 (13:27 +0200)]
copy-file: Preserve sub-second time stamps.
* 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.
Bruno Haible [Mon, 1 May 2017 10:36:02 +0000 (12:36 +0200)]
wchar: Fix compilation error with the original mingw.org mingw.
* 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>.
Bruno Haible [Mon, 1 May 2017 09:50:08 +0000 (11:50 +0200)]
utimens: Add support for native Windows.
* lib/utimens.c: Include <windows.h>, msvc-nothrow.h.
(fdutimens): Provide a native Windows implementation, like utime.c with
added tv_nsec support.
* modules/utimens (Depends-on): Add msvc-nothrow, utime.
Suggested by Tim Rühsen <tim.ruehsen@gmx.de>.
Bruno Haible [Sun, 30 Apr 2017 14:34:54 +0000 (16:34 +0200)]
mktime: Work around TZ problem on native Windows.
* 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.
Bruno Haible [Sun, 30 Apr 2017 11:32:40 +0000 (13:32 +0200)]
localtime: New module.
* 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.
Bruno Haible [Sun, 30 Apr 2017 10:15:08 +0000 (12:15 +0200)]
gettimeofday: Provide higher resolution on native Windows.
* 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.
Bruno Haible [Sat, 29 Apr 2017 23:26:05 +0000 (01:26 +0200)]
utime-h: Modernize handling of 'struct utimbuf'.
* 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.
Bruno Haible [Sat, 29 Apr 2017 13:05:15 +0000 (15:05 +0200)]
stat: Fix time_t values and other problems on native Windows platforms.
* 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.
Bruno Haible [Sat, 29 Apr 2017 12:55:22 +0000 (14:55 +0200)]
fstat: Fix time_t values on native Windows platforms.
* 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.
Paul Eggert [Sat, 29 Apr 2017 18:09:39 +0000 (11:09 -0700)]
getopt: port to Solaris 10 with circa-1997 glibc getopt.h
Problem reported by Assaf Gordon and Gavin Smith in:
http://lists.gnu.org/archive/html/bug-gnulib/2017-04/msg00157.html
* lib/getopt-pfx-ext.h (_getopt_internal) [__GETOPT_PREFIX]:
#define this, too.
Bruno Haible [Sat, 29 Apr 2017 11:23:28 +0000 (13:23 +0200)]
strerror_r-posix: Fixes for MSVC 14.
* lib/strerror_r.c: Include <stdarg.h>.
(strerror_r): Provide error messages for errno values 100...140.
* doc/posix-functions/strerror_r.texi: Mention the MSVC 14 problem.
Bruno Haible [Wed, 26 Apr 2017 21:25:11 +0000 (23:25 +0200)]
noreturn: New module.
* lib/noreturn.h: New file.
* modules/noreturn: New file.
* tests/test-noreturn.c: New file.
* modules/noreturn-tests: New file.
* tests/test-noreturn-c++.cc: New file.
* modules/noreturn-c++-tests: New file.
Bruno Haible [Thu, 27 Apr 2017 16:59:24 +0000 (18:59 +0200)]
wctype-h: Fix compilation error with the original mingw.org mingw.
* 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>.
This issue has been assigned CVE-2017-7476 and was
detected with American Fuzzy Lop 2.41b run on the
coreutils date(1) program with ASAN enabled.
ERROR: AddressSanitizer: heap-buffer-overflow on address 0x...
WRITE of size 8 at 0x60d00000cff8 thread T0
#1 0x443020 in extend_abbrs lib/time_rz.c:88
#2 0x443356 in save_abbr lib/time_rz.c:155
#3 0x44393f in localtime_rz lib/time_rz.c:290
#4 0x41e4fe in parse_datetime2 lib/parse-datetime.y:1798
A minimized reproducer is the following 120 byte TZ value,
which goes beyond the value of ABBR_SIZE_MIN (119) on x86_64.
Extend the aa...b portion to overwrite more of the heap.
localtime_rz and mktime_z were affected since commit 4bc76593.
parse_datetime was affected since commit 4e6e16b3f.
* lib/time_rz.c (save_abbr): Rearrange the calculation determining
whether there is enough buffer space available. The rearrangement
ensures we're only dealing with positive numbers, thus avoiding
the problematic promotion of signed to unsigned causing an invalid
comparison when zone_copy is more than ABBR_SIZE_MIN bytes beyond
the start of the buffer.
* tests/test-parse-datetime.c (main): Add a test case written by
Paul Eggert, which overwrites enough of the heap so that
standard glibc will fail with "free(): invalid pointer"
without the patch applied.
Reported and analyzed at https://bugzilla.redhat.com/1444774
Paul Eggert [Tue, 25 Apr 2017 18:58:30 +0000 (11:58 -0700)]
parse-datetime: make it standalone
* lib/parse-datetime.y: Include <stdarg.h>, for va_start etc.
(_GL_ATTRIBUTE_FORMAT): New macro.
These are needed to get './gnulib-tool --test parse-datetime' to work.
Bruno Haible [Sun, 23 Apr 2017 17:19:35 +0000 (19:19 +0200)]
nap.h: Port to native Windows.
* tests/nap.h (nap_get_stat): Renamed from get_stat. Remove argument fd;
use nap_fd instead. On native Windows, close and reopen nap_fd.
(nap_works): Don't compare the ctimes, because on native Windows, these
are the creation times.
(nap): Update.
Paul Eggert [Mon, 24 Apr 2017 03:54:35 +0000 (20:54 -0700)]
Target a C99 subset, not a C89 subset
For many years Gnulib has targeted C89 and has resisted using C99
features, as some Gnulib-using programs still wanted to target
C89. As this no longer seems to be the case, relax the porting
requirements to allow some C99 features. This is merely a change
to the documentation, to give other Gnulib developers a chance to
weigh in on the topic.
* doc/extern-inline.texi (extern inline):
* doc/gnulib-readme.texi (Portability guidelines):
* doc/gnulib-tool.texi (Initial import):
* doc/gnulib.texi (Header files):
Modernize to talk about C99 and C11 instead of C89 and C99.
* doc/gnulib-readme.texi (Portability guidelines):
Now a section, not merely a subsection, so that it
can be split up. Modernize a bit.
(C language versions, C99 features assumed)
(C99 features avoided):
New sections.
Paul Eggert [Sun, 23 Apr 2017 01:48:39 +0000 (18:48 -0700)]
poll: improve fast check for out-of-range NFD
* lib/poll.c: Do not include intprops.h.
(poll): Compare NFD to INT_MAX, not to TYPE_MAXIMUM (nfds_t) / 2.
* modules/poll (Depends-on): Remove intprops.
Bruno Haible [Sun, 23 Apr 2017 00:45:19 +0000 (02:45 +0200)]
getlogin_r: Work around bug in Mac OS X 10.12.
* 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.
Paul Eggert [Sat, 22 Apr 2017 22:13:24 +0000 (15:13 -0700)]
parse-datetime: fix %z and prefer signed int
%z problem reported by Pádraig Brady in:
http://lists.gnu.org/archive/html/bug-gnulib/2017-04/msg00103.html
While fixing it, I decided to prefer signed ints to size_t, as
they are less error-prone (e.g., ubsan catches overflow).
* lib/parse-datetime.y (textint, parser_control, lookup_word, yylex)
(parse_datetime2): Prefer ptrdiff_t to size_t for sizes and object
counts, since signed integers make for better debugging.
(date): Don’t assume %z works in printf formats.
(debug_strfdatetime, debug_strfdate, debug_strftime): Use int for
sizes of buffers known to be small, e.g., because we’re using snprintf.
(parse_datetime2): Simplify call to debug_mktime_not_ok.
Bruno Haible [Sat, 22 Apr 2017 14:27:45 +0000 (16:27 +0200)]
*printf: Work around rounding bug on Mac OS X.
* 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.
Bruno Haible [Sat, 22 Apr 2017 11:51:02 +0000 (13:51 +0200)]
get-rusage-data: Avoid warnings on Mac OS X.
* lib/get-rusage-data.c: On Mac OS X, don't define
get_rusage_data_via_setrlimit nor get_rusage_data_via_iterator.
(get_rusage_data) [Mac OS X]: Just return 0.
Bruno Haible [Sat, 22 Apr 2017 10:02:38 +0000 (12:02 +0200)]
xbinary-io: Fix build error.
* modules/xbinary-io (Depends-on): Add gettext-h.
* lib/xbinary-io.c: Include gettext.h and define _().
Reported by Gisle Vanem <gisle.vanem@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2017-04/msg00089.html>.
Paul Eggert [Sat, 22 Apr 2017 09:11:26 +0000 (02:11 -0700)]
parse-datetime: overflow and debug cleanups
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.
Bruno Haible [Fri, 21 Apr 2017 23:37:22 +0000 (01:37 +0200)]
gettext-h: Avoid -Wundef warning.
* lib/gettext.h: Test the value of ENABLE_NLS only if it is defined.
Reported by Tim Rühsen <tim.ruehsen@gmx.de> in
<https://lists.gnu.org/archive/html/bug-gnulib/2017-04/msg00022.html>.
Bruno Haible [Fri, 21 Apr 2017 15:24:48 +0000 (17:24 +0200)]
vasnprintf: Fix for MSVC 14.
* lib/vasnprintf.c (USE_MSVC__SNPRINTF): New macro.
Everywhere, use !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF instead
of !HAVE_SNPRINTF_RETVAL_C99.
Bruno Haible [Fri, 21 Apr 2017 14:43:01 +0000 (16:43 +0200)]
mbsinit: Fix for MSVC 14.
* lib/mbsinit.c (mbsinit): If GNULIB_defined_mbstate_t, provide an
implementation that is in sync with mbrtowc.c. On other platforms, use
an adequate ad-hoc implementation.
Bruno Haible [Thu, 20 Apr 2017 19:27:40 +0000 (21:27 +0200)]
verify tests: Fix spurious failure with parallel make.
* gnulib-tool (func_emit_tests_Makefile_am): Emit initialization of
EXTRA_PROGRAMS.
* tests/test-verify.sh: Build test-verify-try.o, not test-verify.o.
* tests/test-verify-try.c: New file.
* modules/verify-tests (Files): Add it.
(EXTRA_PROGRAMS): Add test-verify-try.
(MOSTLYCLEANFILES): Update accordingly.
Reported by Adam James Stewart <ajstewart@anl.gov>.
Bruno Haible [Tue, 18 Apr 2017 23:03:34 +0000 (01:03 +0200)]
vma-iter: Fix conflict with module 'largefile' on 32-bit Solaris 9.
* modules/vma-iter (configure.ac): Test whether <sys/procfs.h> can be
included.
* lib/vma-iter.c: On Solaris, test HAVE_SYS_PROCFS_H before including
<sys/procfs.h>.
* lib/vma-iter.h (VMA_ITERATE_SUPPORTED): Don't define on Solaris when
<sys/procfs.h> cannot be included.
Reported by Tom G. Christensen <tgc@jupiterrise.com>.
Paul Eggert [Sun, 16 Apr 2017 19:43:20 +0000 (12:43 -0700)]
regex: port better to Solaris 10
Solaris 10 <locale.h> includes <libintl.h>, which #defines
gettext, and this causes a double #define.
Problem reported by Gavin Smith in:
http://lists.gnu.org/archive/html/bug-gnulib/2017-04/msg00056.html
* lib/regex_internal.h (gettext): #undef before #defining.
Paul Eggert [Sat, 15 Apr 2017 21:27:11 +0000 (14:27 -0700)]
intprops: improve comments
* lib/intprops.h: Improve and shorten commentary.
For the record, if we ever run into a pedantic compiler that
behaves differently from GCC when converting an out-of-range value
to a signed integer, we can work around the problem with something
like the following code, where UCT is the signed counterpart of T
(UCT is sometimes narrower than UT) and all callers are changed
accordingly:
((t) ((ut) (a) op (ut) (b)))
(TYPE_MINIMUM (t) <= (uct) ((ut) (a) op (ut) (b)) \
? ((t) (uct) (((ut) (a) op (ut) (b)) - TYPE_MINIMUM (t)) \
+ TYPE_MINIMUM (t)) \
: (t) (uct) ((ut) (a) op (ut) (b)))
Paul Eggert [Sat, 15 Apr 2017 01:55:42 +0000 (18:55 -0700)]
intprops: try to avoid tickling similar bugs
* lib/intprops.h (_GL_INT_OP_CALC): Document that UT no longer
needs to be the same width as T; it can be wider.
Change callers so that UT is at least as wide as unsigned int,
as I suspect that this is less likely to run into compiler bugs.
Paul Eggert [Sat, 15 Apr 2017 00:38:58 +0000 (17:38 -0700)]
intprops: port to Oracle Studio 12.3 x86
Problem reported by Gavin Smith in:
http://lists.gnu.org/archive/html/bug-gnulib/2017-04/msg00049.html
* lib/intprops.h (_GL_INT_OP_WRAPV_VIA_UNSIGNED):
Convert unsigned to signed via the usual rather than the standard way,
to avoid a compiler bug in Oracle Studio 12.3 x86.
Paul Eggert [Sun, 9 Apr 2017 06:48:02 +0000 (23:48 -0700)]
getopt: prefer - to _ in new file names
* 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.