summaryrefslogtreecommitdiff
path: root/tests/test-intprops.c
Commit message (Collapse)AuthorAgeFilesLines
* maint: run 'make update-copyright'Simon Josefsson2023-01-011-1/+1
|
* assert-h: prefer to ‘verify’Paul Eggert2022-09-131-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Where it’s easy, prefer ‘static_assert’ to ‘verify’, as this simplifies the source by removing the need to include verify.h. Keep using ‘verify’ if verify.h is used for other reasons, or if code is shared with glibc. * lib/alignalloc.c, lib/argmatch.h, lib/c32is-impl.h: * lib/c32snrtombs.c, lib/c32srtombs.c, lib/exclude.c: * lib/filevercmp.c, lib/fma.c, lib/i-ring.h, lib/ino-map.c: * lib/localeinfo.c, lib/malloca.c, lib/mbrtoc32.c, lib/mbrtowc.c: * lib/mbsinit.c, lib/mbsnrtoc32s.c, lib/mbsrtoc32s.c: * lib/nanosleep.c, lib/parse-datetime.y, lib/pipe2.c: * lib/rawmemchr.c, lib/relocwrapper.c, lib/sleep.c: * lib/stat-w32.c, lib/strerror.c, lib/strtoimax.c: * lib/utimecmp.c, lib/vasnprintf.c, tests/test-alignof.c: * tests/test-intprops.c, tests/test-libgmp.c: * tests/test-limits-h.c, tests/test-locale.c: * tests/test-pthread.c, tests/test-round2.c: * tests/test-stdalign.c, tests/test-stddef.c, tests/test-stdio.c: * tests/test-stdlib.c, tests/test-string.c, tests/test-sys_stat.c: * tests/test-time.c, tests/test-uchar.c, tests/test-unistd.c: * tests/test-wchar.c: Prefer static_assert to verify, and stop including verify.h. * lib/stat.c: Don’t include verify.h (this include was unnecessary). * modules/alignalloc, modules/alignof-tests, modules/argmatch: * modules/c-vasnprintf, modules/c32isalnum, modules/c32isalpha: * modules/c32isblank, modules/c32iscntrl, modules/c32isdigit: * modules/c32isgraph, modules/c32islower, modules/c32isprint: * modules/c32ispunct, modules/c32isspace, modules/c32isupper: * modules/c32isxdigit, modules/c32snrtombs, modules/c32srtombs: * modules/exclude, modules/filevercmp, modules/fma, modules/fmaf: * modules/fmal, modules/fstat, modules/i-ring, modules/ino-map: * modules/intprops-tests, modules/libgmp-tests: * modules/limits-h-tests, modules/locale-tests, modules/malloca: * modules/mbrtoc32, modules/mbrtowc, modules/mbsinit: * modules/mbsnrtoc32s, modules/mbsrtoc32s, modules/nanosleep: * modules/parse-datetime, modules/pipe2, modules/pthread-h-tests: * modules/rawmemchr, modules/relocatable-prog-wrapper: * modules/round-tests, modules/roundf-tests, modules/sleep: * modules/stat, modules/stdalign-tests, modules/stdckdint-tests: * modules/stddef-tests, modules/stdio-tests, modules/stdlib-tests: * modules/strerror, modules/string-tests, modules/strtoimax: * modules/strtoumax, modules/sys_stat-tests, modules/time-tests: * modules/uchar-tests, modules/unistd-tests: * modules/unistdio/u16-u16-vasnprintf: * modules/unistdio/u16-vasnprintf: * modules/unistdio/u32-u32-vasnprintf: * modules/unistdio/u32-vasnprintf: * modules/unistdio/u8-u8-vasnprintf: * modules/unistdio/u8-vasnprintf, modules/unistdio/ulc-vasnprintf: * modules/utimecmp, modules/vasnprintf, modules/wchar-tests: Depend on assert-h, not verify.
* Rely on new stdbool behaviorPaul Eggert2022-09-101-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prefer the C23 style to the C99 style, since the stdbool module now supports C23. * lib/acl-internal.h, lib/acl.h, lib/argmatch.c, lib/argmatch.h: * lib/argp-help.c, lib/argv-iter.h, lib/asyncsafe-spin.c: * lib/backup-internal.h, lib/backupfile.c, lib/base32.h: * lib/base64.h, lib/basename-lgpl.c, lib/bitset/base.h: * lib/c-ctype.h, lib/c-strcasestr.c, lib/canonicalize-lgpl.c: * lib/canonicalize.c, lib/chdir-long.c, lib/chown.c: * lib/classpath.h, lib/clean-temp-private.h: * lib/clean-temp-simple.c, lib/clean-temp-simple.h: * lib/clean-temp.c, lib/clean-temp.h, lib/cloexec.h: * lib/close-stream.c, lib/closein.c, lib/closeout.c, lib/closeout.h: * lib/csharpcomp.h, lib/csharpexec.h, lib/cycle-check.c: * lib/cycle-check.h, lib/des.h, lib/dfa.h, lib/diffseq.h: * lib/dirname.h, lib/exclude.c, lib/exclude.h, lib/execute.c: * lib/execute.h, lib/execvpe.c, lib/fatal-signal.c, lib/fchdir.c: * lib/file-set.h, lib/filevercmp.c, lib/findprog-in.c: * lib/findprog.c, lib/findprog.h, lib/fma.c, lib/fnmatch.c: * lib/fopen.c, lib/freadable.h, lib/freading.h, lib/freopen-safer.c: * lib/fstrcmp.c, lib/fsusage.h, lib/fts.c, lib/fwritable.h: * lib/fwriteerror.c, lib/fwriting.h, lib/gen-uni-tables.c: * lib/getaddrinfo.c, lib/getcwd.c, lib/getloadavg.c: * lib/getndelim2.c, lib/getpass.c, lib/getrandom.c: * lib/git-merge-changelog.c, lib/gl_list.h, lib/gl_map.h: * lib/gl_omap.h, lib/gl_oset.h, lib/gl_set.h, lib/glob.c: * lib/glthread/cond.h, lib/hamt.h, lib/hard-locale.h: * lib/hash-triple.h, lib/hash.h, lib/human.h, lib/i-ring.h: * lib/isapipe.c, lib/javacomp.h, lib/javaexec.h, lib/javaversion.c: * lib/lchown.c, lib/localeinfo.h, lib/localename.c: * lib/long-options.h, lib/malloc/dynarray.h, lib/mbchar.h: * lib/mbfile.h, lib/mbiter.h, lib/mbmemcasecoll.h, lib/mbscasestr.c: * lib/mbsstr.c, lib/mbuiter.h, lib/mkdir-p.h, lib/modechange.h: * lib/mountlist.h, lib/nanosleep.c, lib/nonblocking.h: * lib/nstrftime.c, lib/openat.c, lib/openat.h, lib/os2-spawn.c: * lib/parse-datetime.h, lib/pipe-filter-aux.c, lib/pipe-filter-gi.c: * lib/pipe-filter-ii.c, lib/pipe-filter.h, lib/posixtm.h: * lib/priv-set.c, lib/progreloc.c, lib/propername.c: * lib/pthread-spin.c, lib/quotearg.c, lib/readtokens.c: * lib/readtokens0.h, lib/readutmp.c, lib/regex-quote.h: * lib/regex_internal.h, lib/relocwrapper.c, lib/rename.c: * lib/renameatu.c, lib/rpmatch.c, lib/same.c, lib/same.h: * lib/save-cwd.c, lib/savewd.c, lib/savewd.h, lib/spawn-pipe.h: * lib/spawni.c, lib/stack.h, lib/stat.c, lib/stdckdint.in.h: * lib/strcasestr.c, lib/strfmon_l.c, lib/striconveh.c: * lib/striconveha.h, lib/string-buffer.h, lib/strptime.c: * lib/strstr.c, lib/strtod.c, lib/supersede.h, lib/system-quote.c: * lib/tempname.c, lib/term-style-control.c: * lib/term-style-control.h, lib/textstyle.in.h, lib/time_rz.c: * lib/tmpdir.c, lib/tmpdir.h, lib/tmpfile.c, lib/unicase.in.h: * lib/unicase/caseprop.h, lib/unicase/invariant.h: * lib/unicase/u16-casemap.c, lib/unicase/u16-ct-totitle.c: * lib/unicase/u16-is-invariant.c, lib/unicase/u32-casemap.c: * lib/unicase/u32-ct-totitle.c, lib/unicase/u32-is-invariant.c: * lib/unicase/u8-casemap.c, lib/unicase/u8-ct-totitle.c: * lib/unicase/u8-is-invariant.c, lib/unictype.in.h: * lib/unigbrk.in.h, lib/unigbrk/u16-grapheme-breaks.c: * lib/unigbrk/u32-grapheme-breaks.c: * lib/unigbrk/u8-grapheme-breaks.c: * lib/unigbrk/uc-grapheme-breaks.c, lib/uniname/uniname.c: * lib/unistr.in.h, lib/unlinkdir.h, lib/userspec.h, lib/utime.c: * lib/utimecmp.c, lib/utimens.c, lib/wait-process.h: * lib/windows-cond.c, lib/windows-spawn.c, lib/windows-spawn.h: * lib/windows-timedrwlock.c, lib/write-any-file.h, lib/xbinary-io.c: * lib/xstrtod.h, lib/yesno.h: * tests/nap.h, tests/qemu.h, tests/test-areadlink-with-size.c: * tests/test-areadlink.c, tests/test-areadlinkat-with-size.c: * tests/test-areadlinkat.c, tests/test-base32.c: * tests/test-base64.c, tests/test-ceil2.c, tests/test-ceilf2.c: * tests/test-chown.c, tests/test-dirname.c, tests/test-dup-safer.c: * tests/test-dup3.c, tests/test-exclude.c: * tests/test-execute-child.c, tests/test-execute-main.c: * tests/test-execute-script.c, tests/test-explicit_bzero.c: * tests/test-fchownat.c, tests/test-fcntl-safer.c: * tests/test-fcntl.c, tests/test-fdutimensat.c: * tests/test-filenamecat.c, tests/test-floor2.c: * tests/test-floorf2.c, tests/test-fstatat.c, tests/test-fstrcmp.c: * tests/test-futimens.c, tests/test-getlogin.h, tests/test-getopt.h: * tests/test-hard-locale.c, tests/test-hash.c: * tests/test-idpriv-drop.c, tests/test-idpriv-droptemp.c: * tests/test-immutable.c, tests/test-intprops.c: * tests/test-lchown.c, tests/test-link.c, tests/test-linkat.c: * tests/test-lstat.c, tests/test-mbmemcasecmp.c: * tests/test-mbmemcasecoll.c, tests/test-mkdir.c: * tests/test-mkdirat.c, tests/test-mkfifo.c, tests/test-mkfifoat.c: * tests/test-mknod.c, tests/test-nonblocking-pipe-child.c: * tests/test-nonblocking-pipe-main.c: * tests/test-nonblocking-socket-child.c: * tests/test-nonblocking-socket-main.c, tests/test-open.c: * tests/test-openat.c, tests/test-pipe.c, tests/test-pipe2.c: * tests/test-poll.c, tests/test-posix_spawn-chdir.c: * tests/test-posix_spawn-dup2-stdin.c: * tests/test-posix_spawn-dup2-stdout.c: * tests/test-posix_spawn-fchdir.c, tests/test-posix_spawn-open1.c: * tests/test-posix_spawn-open2.c, tests/test-quotearg-simple.c: * tests/test-quotearg.c, tests/test-readlink.c: * tests/test-readlinkat.c, tests/test-readtokens.c: * tests/test-rename.c, tests/test-renameat.c: * tests/test-renameatu.c, tests/test-rmdir.c, tests/test-round2.c: * tests/test-select.h, tests/test-spawn-pipe-child.c: * tests/test-spawn-pipe-main.c, tests/test-spawn-pipe-script.c: * tests/test-stack.c, tests/test-stat.c, tests/test-supersede.c: * tests/test-symlink.c, tests/test-symlinkat.c: * tests/test-system-quote-main.c: * tests/test-term-style-control-hello.c: * tests/test-term-style-control-yes.c, tests/test-timespec.c: * tests/test-trunc2.c, tests/test-truncf2.c, tests/test-unlink.c: * tests/test-unlinkat.c, tests/test-userspec.c, tests/test-utime.c: * tests/test-utimens.c, tests/test-utimensat.c: * tests/unictype/test-categ_byname.c: * tests/unigbrk/test-uc-is-grapheme-break.c: Don’t include stdbool.h. * modules/acl, modules/xgetcwd: Don’t depend on stdbool, as these modules don’t use bool. * modules/argp, modules/bitset, modules/diffseq, modules/file-has-acl: * modules/gen-uni-tables, modules/getrandom: * modules/hash-triple-simple, modules/posix_spawn-internal: * modules/strcasestr, modules/supersede, modules/system-quote: * modules/uniconv/base, modules/uniname/uniname, modules/utime: * modules/windows-timedrwlock: Depend on stdbool, as these modules use bool.
* stdckdint-h: new modulePaul Eggert2022-08-101-2/+11
| | | | | | | | | | | | | | | | | | | | | | | 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.
* license: fix GPLv3 texts to use a comma instead of semicolon.Bernhard Voelker2022-01-051-1/+1
| | | | | | | | | See: https://www.gnu.org/licenses/gpl-3.0.html#howto Run: $ git grep -l 'Foundation; either version 3' \ | xargs sed -i '/Foundation; either version 3/ s/n; e/n, e/' * All files using GPLv3: Adjust via the above command.
* maint: run 'make update-copyright'Paul Eggert2022-01-011-1/+1
|
* maint: run 'make update-copyright'Paul Eggert2020-12-311-1/+1
|
* intprops test: Strengthen on clang.Bruno Haible2020-08-161-1/+1
| | | | * tests/test-intprops.c (VERIFY): Use verify_stmt.
* maint: Run 'make update-copyright'Paul Eggert2019-12-311-1/+1
|
* intprops tests: Fix compilation errors on HP-UX/ia64 with cc.Bruno Haible2019-10-121-1/+3
| | | | | * tests/test-intprops.c (main): Disable two more tests when using HP-UX cc.
* intprops tests: Avoid build failure with HP-UX cc.Bruno Haible2019-09-151-0/+2
| | | | | * tests/test-intprops.c: Disable a check that makes HP cc choke with "error 4018: Macro param too large after substitution - use -H option.".
* intprops: support unsigned *_WRAPV resultsPaul Eggert2019-08-141-19/+59
| | | | | | | | | | | | | | | | | | | | | 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.
* maint: Run 'make update-copyright'Paul Eggert2019-01-011-1/+1
|
* intprops tests: Fix compilation error with pre-C99 compiler.Bruno Haible2018-09-061-14/+20
| | | | | * tests/test-intprops.c (verify_stmt): New macro. (VERIFY, main): Use it.
* maint: Run 'make update-copyright'Paul Eggert2018-01-011-1/+1
|
* maint: shorten https://lists.gnu.org/archive/html/... linksJim Meyering2017-11-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* all: Replace many more http URLs by https URLs. Update stale URLs.Bruno Haible2017-09-141-1/+1
| | | | | * users.txt: Remove mention of 'newts'. * lib/localename.c: Update comment about LANG_SOTHO.
* all: prefer https: URLsPaul Eggert2017-09-131-1/+1
|
* intprops: don’t depend on ‘verify’Paul Eggert2017-05-081-0/+21
| | | | | | | | | | 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’.
* 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'.
* intprops-test: port to GCC 6Paul Eggert2016-06-231-6/+3
| | | | | * tests/test-intprops.c: Ignore -Woverflow if any GCC version, since the bug is not fixed in GCC 6.1.
* intprops, mktime, strtol: assume two's complementPaul Eggert2016-04-131-19/+9
| | | | | | | | | | | | | | | | | | These macros were not portable to every conforming C11 ones' complement platform. It's not worth the hassle of porting to some platforms that use ones' complement or signed magnitude, as such platforms are almost purely theoretical nowadays and porting even to some of them makes the code harder to review for little practical benefit. Problem reported by Florian Weimer in: https://sourceware.org/ml/libc-alpha/2016-04/msg00295.html * lib/intprops.h (TYPE_TWOS_COMPLEMENT, TYPE_ONES_COMPLEMENT) (TYPE_SIGNED_MAGNITUDE, _GL_INT_TWOS_COMPLEMENT): * lib/mktime.c (TYPE_TWOS_COMPLEMENT): * lib/strtol.c (TYPE_TWOS_COMPLEMENT, TYPE_ONES_COMPLEMENT) (TYPE_SIGNED_MAGNITUDE): Remove. All uses rewritten to assume two's complement, which is all we can reasonably test nowadays anyway. * top/maint.mk (_intprops_names): Remove the removed macros.
* 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'.
* intprops-test: work around GCC bug 68971Paul Eggert2015-12-171-0/+21
| | | | | | | Problem reported by Pádraig Brady in: http://lists.gnu.org/archive/html/bug-gnulib/2015-12/msg00011.html * tests/test-intprops.c: Ignore -Woverflow in GCC 6 and earlier. (main): Add a case that better tests 64-bit long in this area.
* intprops-test: suppress -Woverlength-stringsPaul Eggert2015-11-051-3/+4
| | | | | | | | Problem reported by Pádraig Brady in: http://lists.gnu.org/archive/html/bug-gnulib/2015-11/msg00008.html It is not worth the hassle to port this test to compilers that cannot handle long strings in diagnostics. * tests/test-intprops.c [__GNUC__]: Ignore -Woverlength-strings.
* intprops: revise _WRAPV macros, revert _OVERFLOWPaul Eggert2015-11-041-127/+158
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The incompatible changes to the _OVERFLOW macros were too much of a hassle in practice, so revert them. Instead, change the new _WRAPV macros to make them closer in behavior to GCC 5's new builtin_add_overflow etc. functions. No other software was using these newly-added macros yet, so this should be OK. * NEWS: Revert previous change, since the incompatible change has been reverted, and nobody used the incompatible version. * doc/intprops.texi (Wraparound Arithmetic, Integer Type Overflow): Document revised behavior. (Integer Range Overflow): Adjust example to match above revisions. * lib/intprops.h (INT_ADD_OVERFLOW, INT_SUBTRACT_OVERFLOW) (INT_MULTIPLY_OVERFLOW): Revert previous change, so that these can be used in integer constant expressions again. (INT_CONST_ADD_OVERFLOW, INT_CONST_SUBTRACT_OVERFLOW) (INT_CONST_MULTIPLY_OVERFLOW): Remove, as these are no longer needed. (INT_CONST_ADD_WRAPV, INT_CONST_SUBTRACT_WRAPV) (INT_NEGATE_WRAPV, INT_CONST_MULTIPLY_WRAPV, INT_DIVIDE_WRAPV) (INT_REMAINDER_WRAPV, INT_LEFT_SHIFT_WRAPV): Remove, as they did not seem that useful. (INT_ADD_WRAPV, INT_SUBTRACT_WRAPV, INT_MULTIPLY_WRAPV) (_GL_INT_OP_WRAPV, _GL_INT_OP_WRAPV_LONGISH) (_GL_INT_OP_WRAPV_VIA_UNSIGNED): Support new semantics. (__has_builtin): New macro, if not alreay defined. (_GL__GENERIC_BOGUS, _GL_INT_OP_CALC, _GL_INT_OP_CALC1): New macros. * tests/test-intprops.c (INT_CONST_DIVIDE_OVERFLOW) (INT_CONST_REMAINDER_OVERFLOW, INT_CONST_LEFT_SHIFT_OVERFLOW) (INT_CONST_DIVIDE_WRAPV, INT_CONST_REMAINDER_WRAPV) (INT_CONST_LEFT_SHIFT_WRAPV): Remove. (CHECK_SBINOP, CHECK_SSUM, CHECK_SUM1, CHECK_SSUM1) (CHECK_SDIFFERENCE, CHECK_SPRODUCT, CHECK_PRODUCT1, CHECK_SPRODUCT1): New macros. (CHECK_BINOP, CHECK_UNOP, main, CHECK_SUM): Test new behavior.
* intprops: add WRAPV and const flavors for GCC 5Paul Eggert2015-10-301-139/+194
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If available, use GCC 5's builtin functions for efficient integer overflow checking. Also, add macros like INT_ADD_WRAPV that efficently and safely compute the low-order bits of the correct answer. A downside of these efficient functions is that they cannot be used in constant expressions, so add macros like INT_CONST_ADD_OVERFLOW and INT_CONST_ADD_WRAPV that can be used even in constant expressions. * NEWS: Document the incompatible changes to INT_ADD_OVERFLOW etc. * doc/intprops.texi (Integer Properties, Integer Type Overflow): Document the changes. (Wraparound Arithmetic): New section. (Integer Range Overflow): Put this subsection last, since it's least useful. * lib/intprops.h (INT_CONST_ADD_OVERFLOW) (INT_CONST_SUBTRACT_OVERFLOW, INT_CONST_MULTIPLY_OVERFLOW): New macros, with the meaning that INT_ADD_OVERFLOW etc. used to have. (INT_CONST_ADD_WRAPV, INT_CONST_SUBTRACT_WRAPV) (INT_NEGATE_WRAPV, INT_CONST_MULTIPLY_WRAPV, INT_DIVIDE_WRAPV) (INT_REMAINDER_WRAPV, _GL_INT_OP_WRAPV, _GL_EXPR_CAST) (_GL_INT_OP_WRAPV_LONGISH, INT_ADD_WRAPV, INT_SUBTRACT_WRAPV) (INT_MULTIPLY_WRAPV, _GL_OP_OVERFLOW, _GL_OP_WRAPV, _GL_OP_WRAPV_GENSYM): New macros. (INT_ADD_OVERFLOW, INT_SUBTRACT_OVERFLOW, INT_MULTIPLY_OVERFLOW): Generate calls to GCC builtins if available, for speed. * tests/test-intprops.c (INT_CONST_DIVIDE_OVERFLOW) (INT_CONST_REMAINDER_OVERFLOW, INT_CONST_LEFT_SHIFT_OVERFLOW) (INT_CONST_DIVIDE_WRAPV, INT_CONST_REMAINDER_WRAPV) (INT_CONST_LEFT_SHIFT_WRAPV): New macros. (main, CHECK_BINOP, CHECK_UNOP, CHECK_SUM, CHECK_PRODUCT) (CHECK_QUOTIENT, CHECK_REMAINDER): Test WRAPV and CONST flavors (when available) too.
* 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>
* maint: update all copyright year number rangesJim Meyering2012-01-011-1/+1
| | | | Run "make update-copyright".
* test-intprops: disable -Wtype-limits diagnosticsPaul Eggert2011-05-241-0/+6
| | | | | | | * tests/test-intprops.c: Use a pragma to ignore -Wtype-limits diagnostics. Otherwise, the integer overflow macros generate many diagnostics. Reported by Jim Meyering in <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00528.html>.
* intprops-tests: work around HP-UX 11.23 cc bug with constantsPaul Eggert2011-05-191-201/+211
| | | | | | * tests/test-intprops.c (VERIFY): New macro. (main): Use it, instead of verify, to work around the compiler bug; see <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00401.html>.
* intprops-tests: revert unsigned part of previous changePaul Eggert2011-05-191-57/+45
| | | | | | | * tests/test-intprops.c (UINT_MAX, ULONG_MAX, UINTMAX_MAX, U0, U1): Remove; they weren't actually needed. All uses of U0 and U1 removed, and other casts to 'unsigned int' reverted to 'u' suffixes. See <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00406.html>.
* intprop-tests: port to older and more-pedantic compilersPaul Eggert2011-05-191-64/+82
| | | | | | | | | | | | | | | * modules/intprops-tests (Files): Add tests/macros.h. * tests/test-intprops.c: Include macros.h. (TYPE_IS_INTEGER): Use ASSERT, not verify, to test this macro, as it's no longer documented to expand to an integer constant expression. (TYPE_SIGNED): Use ASSERT, not verify, to test this macro when the argument is floating point, as it's no longer documented to expand to an integer constant expression in that case. (UINT_MAX, ULONG_MAX, UINTMAX_MAX): Redefine to work around compiler bugs reported by Bruno Haible. See <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00401.html>. (U0, U1): New constants, to work around the same bugs. Also, in tests, use e.g., "(unsigned int) 39" rather than "39u".
* intprops-tests: new modulePaul Eggert2011-05-151-0/+253
* modules/intprops-tests, tests/test-intprops.c: New files.