| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
| |
* lib/intprops.h (INT_ADD_OK, INT_SUBTRACT_OK, INT_MULTIPLY_OK):
* lib/pipe-filter-ii.c (GetLastError):
* lib/thread-optim.h (gl_multithreaded): Parenthesize
function-like macro definiens beginning with a unary operator;
needed for weird invocations like ‘m (...)[p]’.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This supports draft C23 <stdckdint.h>.
* doc/posix-headers/stdckdint.texi:
* lib/stdckdint.in.h, modules/stdckdint:
* modules/stdckdint-tests, tests/test-stdckdint.c:
New files.
* MODULES.html.sh, doc/gnulib.texi: Update for new module.
* lib/intprops-internal.h: Include <stdckdint.h> if C23 and
its macros would help and our substitute has not already
started to be included.
(_GL_INT_ADD_WRAPV, _GL_INT_SUBTRACT_WRAPV)
(_GL_INT_MULTIPLY_WRAPV): Use ckd_add, ckd_sub, ckd_mul
if they are defined and would help.
* lib/intprops-internal.h, lib/intprops.h: Improve comments.
The C23 restrictions on stdckdint macros already mostly applied to
intprops.h, so these are clarifications, not further restrictions.
* tests/test-intprops.c: If TEST_STDCKDINT is defined,
include <stdckdint.h> instead of "intprops.h", and test
it instead.
(VERIFY) [TEST_STDCKDINT]: Ignore the arg in this case.
(main) [TEST_STDCKDINT]: Skip tests irrelevant to stdckdint.h.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib/intprops.h: Include new file intprops-internal.h.
(_GL_INT_CONVERT, _GL_INT_NEGATE_CONVERT, _GL_INT_MINIMUM)
(_GL_INT_MAXIMUM, _GL_SIGNED_INT_MAXIMUM, LLONG_MAX, LLONG_MIN)
(_GL_HAVE___TYPEOF__, _GL_SIGNED_TYPE_OR_EXPR)
(_GL_HAS_BUILTIN_ADD_OVERFLOW, _GL_HAS_BUILTIN_MUL_OVERFLOW)
(_GL_HAS_BUILTIN_OVERFLOW_P, _GL__GENERIC_BOGUS)
(_GL_INT_OP_WRAPV, _GL_INT_OP_WRAPV_LONGISH, _GL_INT_OP_CALC)
(_GL_INT_OP_WRAPV_VIA_UNSIGNED, _GL_INT_ADD_RANGE_OVERFLOW)
(_GL_INT_SUBTRACT_RANGE_OVERFLOW)
(_GL_INT_MULTIPLY_RANGE_OVERFLOW):
Move to intprops-internal.h.
(TYPE_SIGNED, EXPR_SIGNED, TYPE_WIDTH, INT_NEGATE_RANGE_OVERFLOW)
(INT_NEGATE_OVERFLOW, INT_ADD_WRAPV, INT_SUBTRACT_WRAPV)
(INT_MULTIPLY_WRAPV): Rename to _GL_ prefix, move to
intprops-internal.h, and define here in terms of the _GL_ name.
* lib/intprops-internal.h: New file, containing the above.
* modules/intprops (Files): Add lib/intprops-internal.h.
|
|
|
|
|
|
|
| |
* lib/intprops.h (_GL_HAS_BUILTIN_OVERFLOW_P)
[_GL_HAS_BUILTIN_OVERFLOW_P]: Use __builtin_sub_overflow_p
directly rather than indirectly via INT_SUBTRACT_OVERFLOW.
This simplifies future changes, and doesn’t change the generated code.
|
|
|
|
|
|
|
| |
Problem reported by Olivier Cessenat (Bug#53256).
* lib/intprops.h (_GL_HAS_BUILTIN_ADD_OVERFLOW) [__EDG__]:
Define to 0, since __builtin_add_overflow doesn’t work
on NVIDIA HPC SDK 22.1.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
The intprops.h typo fix should fix a bug in Emacs on Debian testing
with clang <https://bugs.gnu.org/52711>.
* lib/asyncsafe-spin.c, lib/intprops.h, lib/pthread-spin.c:
Fix some misspellings of ‘__clang_major__’.
I left one misspelling alone, in lib/cdefs.h,
and instead reported that bug upstream here:
https://sourceware.org/pipermail/libc-alpha/2021-December/134512.html
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib/intprops.h (_GL_HAS_BUILTIN_ADD_OVERFLOW):
Rely on __has_builtin first, since GCC didn’t introduce it until
GCC 9 so we don’t need to special-case GCC first.
(_GL_HAS_BUILTIN_ADD_OVERFLOW, _GL_HAS_BUILTIN_OVERFLOW_P):
Look at __EDG__ rather than __ICC, since icc defines __EDG__ too.
(_GL_HAS_BUILTIN_MUL_OVERFLOW): Define to 1 in Clang 14 and later,
as a bug fix is scheduled for Clang 14.
(_GL_HAS_BUILTIN_OVERFLOW_P): Do not bother to special-case
__clang__, since __has_builtin should do the right thing anyway.
|
|
|
|
|
|
|
|
| |
Reported by Ilya Kurdyukov <ilyakurdyukov@altlinux.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2021-12/msg00028.html>.
* lib/intprops.h (_GL_HAS_BUILTIN_OVERFLOW_P): Define to 0 on EDG-based
compilers.
|
|
|
|
|
|
| |
* config/srclist.txt: Uncomment-out posix/regex.c and related
files, as the Gnulib versions have now been copied to glibc.
* lib/intprops.h: Remove authorship comment, as per glibc guidelines.
|
|
|
|
| |
* lib/intprops.h: Improve comments about promotion etc.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
* lib/intprops.h (_GL_HAS_BUILTIN_OVERFLOW_P):
Port to ICC 2021.1, which has a non-working __builtin_mul_overflow_p.
Add a clause for other compilers that claim to support
__builtin_mul_overflow_p, since we might as well find out about
slackers other than Clang and ICC.
(INT_MULTIPLY_WRAPV): ICC 2021 has GCC bug 91450, so treat it
like older GCCs even when it claims to be a newer one.
|
|
|
|
|
|
|
|
|
|
| |
Reported by Stefan Liebler <stli@linux.ibm.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-12/msg00152.html>.
* lib/intprops.h (_GL_HAS_BUILTIN_ADD_OVERFLOW): Don't define for
GCC 5.x and 6.x.
* lib/glob.c (size_add_wrapv): Don't use __builtin_add_overflow for
GCC 5.x and 6.x.
|
|
|
|
|
|
|
| |
* doc/intprops.texi (Checking Integer Overflow): New section.
* lib/intprops.h: From a suggestion by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2020-12/msg00051.html
(SAFE_INT_ADD, SAFE_INT_SUBTRACT, SAFE_INT_MULTIPLY): New macros.
|
|
|
|
|
|
|
|
|
| |
Problem reported by Nelson H. F. Beebe for clang 9.0.1 in:
https://lists.gnu.org/r/grep-devel/2020-09/msg00028.html
* lib/intprops.h (_GL_HAS_BUILTIN_OVERFLOW_P) [__clang__]:
Define to 0.
* lib/xalloc-oversized.h (xalloc_oversized) [__clang__]:
Do not use __builtin_mul_overflow_p.
|
|
|
|
| |
* lib/intprops.h (_GL_SIGNED_INT_MAXIMUM): Simplify.
|
|
|
|
|
|
|
|
|
|
| |
The bug occurs when using INT_MULTIPLY_WRAPV (a, b, c) where B
is a bit-field, on older GCC or non-GCC compilers where we do
things ourselves instead of using __builtin_mul_overflow.
Without this fix, INT_MULTIPLY_WRAPV would not compile, due
to applying sizeof to a bit-field.
* lib/intprops.h (_GL_INT_MULTIPLY_RANGE_OVERFLOW):
Promote B before giving it to TYPE_WIDTH, in case B is a bit-field.
|
|
|
|
| |
* lib/intprops.h (_GL__GENERIC_BOGUS): Define to 1 on clang.
|
|
|
|
| |
* config/srclist.txt: Mark intprops.h as needing sync with glibc.
|
| |
|
|
|
|
|
|
|
|
| |
* m4/stdint.m4 (gl_STDINT_H): Check for SIZE_MAX also on
"clang -std=gnu99".
* lib/intprops.h (_GL_HAVE___TYPEOF__): Define to 1 also on clang.
* tests/test-stdint.c (verify_same_types): Enable the check also on
clang.
|
|
|
|
| |
* lib/intprops.h (_GL_HAS_BUILTIN_OVERFLOW_P): Fix typo in comment.
|
| |
|
|
|
|
|
|
| |
* lib/intprops.h (INT_MULTIPLY_WRAPV): If GCC 8.x where 4 <= x,
remove workaround for GCC bug 91450 as the bug should be fixed
there too.
|
| |
|
|
|
|
|
| |
* lib/intprops.h (INT_MULTIPLY_WRAPV): If GCC 9.3 or later, do not
work around GCC bug 91450 as the bug should be fixed there.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Work around macOS header that has ‘#define __has_builtin(x) 0’
when compiled by GCC. Apple really, really doesn’t want you to
use GCC, apparently. Rroblem reported by Akim Demaille in:
https://lists.gnu.org/r/bug-bison/2019-10/msg00071.html
The fix is to not trust __has_builtin when being compiled by
recent-enough GCC.
* lib/intprops.h (__has_builtin)
(_GL_HAS___builtin_add_overflow, _GL_TEMPDEF___has_builtin):
* lib/verify.h (__has_builtin, _GL_HAS___builtin_unreachable)
(_GL_HAS___builtin_trap, _GL_TEMPDEF___has_builtin):
Remove. All uses removed.
* lib/intprops.h (_GL_HAS_BUILTIN_ADD_OVERFLOW): Use __has_builtin
directly, if defined and if not newer GCC.
* lib/verify.h (_GL_HAS_BUILTIN_TRAP, _GL_HAS_BUILTIN_UNREACHABLE):
New macro, that use __has_builtin directly, if defined and if
not newer GCC.
(assume): Use them.
|
|
|
|
|
|
|
|
| |
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2019-08/msg00076.html
* lib/intprops.h (_GL_HAS___builtin_mul_overflow): Remove.
(_GL_HAS_BUILTIN_MUL_OVERFLOW):
Go back to working around the Clang bug on macOS.
|
|
|
|
|
|
|
|
|
|
| |
Assume that __builtin_mul_overflow works OK with Clang on macOS.
Mattias Engdegård says it’s safe to assume the relevant library
is always available there.
* lib/intprops.h (_GL_HAS___builtin_mul_overflow):
New temporary internal macro.
(_GL_HAS_BUILTIN_MUL_OVERFLOW):
No need to work around the Clang bug on macOS.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Improve code generated by INT_ADD_WRAPV and INT_SUBTRACT_WRAPV
with Clang. Problem reported privately by Mattias Engdegård.
Also, insulate intprops.h and verify.h better against each other’s
definitions of __has_builtin on non-Clang hosts.
* lib/intprops.h (__has_builtin): Define a temporary substitute
if __has_builtin is not already defined.
(_GL_HAS___builtin_add_overflow, _GL_TEMPDEF___has_builtin):
New temporary internal macros.
(_GL_HAS_BUILTIN_ADD_OVERFLOW, _GL_HAS_BUILTIN_MUL_OVERFLOW):
Now two separate macros, replacing the old
_GL_HAS_BUILTIN_OVERFLOW, since we no longer assume that
__builtin_mul_overflow is like the rest. All uses changed.
(INT_ADD_WRAPV, INT_SUBTRACT_WRAPV, INT_MULTIPLY_WRAPV):
Adjust to above changes.
(_GL_INT_OP_WRAPV): Remove ‘builtin’ arg, since it’s no
longer relevant. All uses changed.
* lib/verify.h (__has_builtin): Treat like intprops.h,
so that the two .h files do not collide with each other.
(_GL_HAS___builtin_unreachable, _GL_HAS___builtin_trap)
(_GL_TEMPDEF___has_builtin): New temporary internal macros.
|
|
|
|
|
|
| |
* lib/intprops.h (_GL_HAS_BUILTIN_OVERFLOW):
Mention Clang in comment, responding to a query from
Mattias Engdegård.
|
|
|
|
|
| |
* lib/intprops.h (_GL_INT_OP_WRAPV): Fix recently-introduced
typos that were in a section not compiled by GCC.
|
|
|
|
|
|
|
|
| |
* lib/intprops.h (_GL_INT_OP_WRAPV_SMALLISH): New macro, defined
when __builtin_add_overflow etc. and _Generic are not used.
(_GL_INT_OP_WRAPV): Use it to support destinations that
are unsigned char or unsigned short, even in compilers
that lack __typeof__ and are not C11-compatible.
|
|
|
|
|
|
|
|
| |
* lib/intprops.h (_GL_BUILTIN_MUL_OVERFLOW):
Pacify GCC’s complaints about ignoring __builtin_mul_overflow’s
possibly-incorrect result.
(_GL_INT_MULTIPLY_RANGE_OVERFLOW): Pacify GCC’s complaints
about (A) used as a boolean, when A is an expression like 3 * 4.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add support for unsigned, unsigned long, and unsigned long long
results to INT_ADD_WRAPV, INT_SUBTRACT_WRAPV, and
INT_MULTIPLY_WRAPV. Also, work around GCC bug 91450, and fix a
bug with unsigned inputs reported by Eli Zaretskii in:
https://lists.gnu.org/r/bug-gnulib/2019-08/msg00012.html
* config/srclist.txt: Break the glibc connection for intprops.h
temporarily, while more testing is done in Gnulib-using apps.
* lib/intprops.h (INT_ADD_WRAPV, INT_SUBTRACT_WRAPV)
(INT_MULTIPLY_WRAPV, _GL_INT_OP_WRAPV, _GL_INT_OP_WRAPV_LONGISH):
Support unsigned results no narrower than unsigned int. Report
overflow correctly if some arguments are unsigned.
(_GL_BUILTIN_MUL_OVERFLOW): New macro, to work around GCC bug 91450.
(_GL_INT_OP_CALC): Simplify now that the OVERFLOW argument does
the right thing with narrow args.
(_GL_INT_OP_CALC1): Remove. All callers removed.
(_GL_INT_ADD_RANGE_OVERFLOW, _GL_INT_SUBTRACT_RANGE_OVERFLOW)
(_GL_INT_MULTIPLY_RANGE_OVERFLOW): New macros.
* tests/test-intprops.c: Check for bugs and test new behavior.
|
| |
|
|
|
|
|
| |
* lib/intprops.h (_GL_BINARY_OP_OVERFLOW):
Use _GL_INT_CONVERT rather than reinventing it.
|
|
|
|
|
|
|
|
|
| |
This makes EXPR_SIGNED (e) easier to use, as it no longer
evaluates the expression E. Formerly, E was required to be free
of side effects.
* lib/intprops.h (_GL_INT_CONVERT, _GL_INT_NEGATE_CONVERT)
(EXPR_SIGNED, TYPE_WIDTH, _GL_INT_MINIMUM, _GL_INT_MAXIMUM)
(_GL_SIGNED_INT_MAXIMUM): Do not evaluate the expression arg.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Each /archive/html/ part can be replace with /r/.
Run this to induce the change:
git grep -l archive/html|xargs perl -pi -e 's,/archive/html/,/r/,g'
* ChangeLog: Perform that substitution.
* Makefile: Likewise.
* STATUS-libposix: Likewise.
* build-aux/bootstrap: Likewise.
* doc/maintain.texi: Likewise.
* gnulib-tool: Likewise.
* lib/allocator.h: Likewise.
* lib/argp-ba.c: Likewise.
* lib/argp-pv.c: Likewise.
* lib/canon-host.c: Likewise.
* lib/canonicalize-lgpl.c: Likewise.
* lib/float.in.h: Likewise.
* lib/fstat.c: Likewise.
* lib/getdelim.c: Likewise.
* lib/getprogname.c: Likewise.
* lib/glthread/thread.h: Likewise.
* lib/intprops.h: Likewise.
* lib/mbsrtowcs-state.c: Likewise.
* lib/safe-read.c: Likewise.
* lib/signal.in.h: Likewise.
* lib/stat.c: Likewise.
* lib/stdbool.in.h: Likewise.
* lib/stdio-impl.h: Likewise.
* lib/stdio.in.h: Likewise.
* lib/sysexits.in.h: Likewise.
* lib/timespec.h: Likewise.
* lib/wcsrtombs-state.c: Likewise.
* m4/alloca.m4: Likewise.
* m4/extern-inline.m4: Likewise.
* m4/fstatat.m4: Likewise.
* m4/gnulib-common.m4: Likewise.
* m4/lib-ignore.m4: Likewise.
* m4/printf.m4: Likewise.
* m4/regex.m4: Likewise.
* m4/stat-size.m4: Likewise.
* m4/std-gnu11.m4: Likewise.
* m4/stdbool.m4: Likewise.
* m4/sys_types_h.m4: Likewise.
* m4/threadlib.m4: Likewise.
* m4/vararrays.m4: Likewise.
* pygnulib/GLImport.py: Likewise.
* tests/test-exp.h: Likewise.
* tests/test-exp2.h: Likewise.
* tests/test-expm1.h: Likewise.
* tests/test-fflush2.c: Likewise.
* tests/test-getopt_long.h: Likewise.
* tests/test-intprops.c: Likewise.
* tests/test-log.h: Likewise.
* tests/test-log10.h: Likewise.
* tests/test-log1p.h: Likewise.
* tests/test-log2.h: Likewise.
* tests/test-printf-posix.h: Likewise.
* tests/test-regex.c: Likewise.
* tests/test-snprintf-posix.h: Likewise.
* tests/test-sprintf-posix.h: Likewise.
* tests/test-stdalign.c: Likewise.
* tests/test-stdbool.c: Likewise.
* tests/test-vasnprintf-posix.c: Likewise.
* tests/test-vasprintf-posix.c: Likewise.
* top/maint.mk: Likewise.
|
|
|
|
|
| |
* users.txt: Remove mention of 'newts'.
* lib/localename.c: Update comment about LANG_SOTHO.
|
| |
|
|
|
|
|
|
|
| |
Port to icc (ICC) 17.0.4 20170411, which defines __GNUC__ to be 5
but does not support __builtin_add_overflow etc.
* lib/intprops.h (_GL_HAS_BUILTIN_OVERFLOW) [__ICC]:
Define to 0.
|
|
|
|
|
|
|
|
|
|
| |
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’.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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)))
|
| |
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
| |
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.
|