diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2015-03-24 08:37:35 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2015-03-24 08:38:35 +0100 |
commit | 03b3dac9d247bcf607e52c5cbbf8609de21a453b (patch) | |
tree | c259dfd6dead8a3f51062fb68b3c03ff02774b6c /gl | |
parent | eac44b665c0924fa950195a2b6d890638b41fc7d (diff) | |
download | gnutls-03b3dac9d247bcf607e52c5cbbf8609de21a453b.tar.gz |
gnulib: removed u64 module
Diffstat (limited to 'gl')
-rw-r--r-- | gl/Makefile.am | 11 | ||||
-rw-r--r-- | gl/m4/gnulib-cache.m4 | 3 | ||||
-rw-r--r-- | gl/m4/gnulib-comp.m4 | 5 | ||||
-rw-r--r-- | gl/m4/ld-version-script.m4 | 45 | ||||
-rw-r--r-- | gl/m4/printf.m4 | 47 | ||||
-rw-r--r-- | gl/m4/stdio_h.m4 | 20 | ||||
-rw-r--r-- | gl/m4/time_h.m4 | 19 | ||||
-rw-r--r-- | gl/m4/ungetc.m4 | 5 | ||||
-rw-r--r-- | gl/stdio-impl.h | 5 | ||||
-rw-r--r-- | gl/stdio.in.h | 7 | ||||
-rw-r--r-- | gl/tests/Makefile.am | 8 | ||||
-rw-r--r-- | gl/tests/init.sh | 21 | ||||
-rw-r--r-- | gl/tests/test-u64.c | 47 | ||||
-rw-r--r-- | gl/time.in.h | 2 | ||||
-rw-r--r-- | gl/u64.c | 3 | ||||
-rw-r--r-- | gl/u64.h | 179 | ||||
-rw-r--r-- | gl/vasnprintf.c | 8 |
17 files changed, 114 insertions, 321 deletions
diff --git a/gl/Makefile.am b/gl/Makefile.am index 0851edc1eb..9b51325ef4 100644 --- a/gl/Makefile.am +++ b/gl/Makefile.am @@ -21,7 +21,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files alloca base64 byteswap c-ctype extensions func gendocs getline gettext gettimeofday hash-pjw-bare havelib iconv intprops lib-msvc-compat lib-symbol-versions maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html read-file snprintf stdint strcase strndup strtok_r strverscmp sys_socket sys_stat time_r u64 unistd valgrind-tests vasprintf vsnprintf warnings +# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files alloca base64 byteswap c-ctype extensions func gendocs getline gettext gettimeofday hash-pjw-bare havelib iconv intprops lib-msvc-compat lib-symbol-versions maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html read-file snprintf stdint strcase strndup strtok_r strverscmp sys_socket sys_stat time_r unistd valgrind-tests vasprintf vsnprintf warnings AUTOMAKE_OPTIONS = 1.9.6 gnits @@ -1330,6 +1330,7 @@ time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( -e 's|@''PTHREAD_H_DEFINES_STRUCT_TIMESPEC''@|$(PTHREAD_H_DEFINES_STRUCT_TIMESPEC)|g' \ -e 's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ -e 's|@''TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ + -e 's|@''UNISTD_H_DEFINES_STRUCT_TIMESPEC''@|$(UNISTD_H_DEFINES_STRUCT_TIMESPEC)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ @@ -1351,14 +1352,6 @@ EXTRA_libgnu_la_SOURCES += time_r.c ## end gnulib module time_r -## begin gnulib module u64 - -libgnu_la_SOURCES += u64.c - -EXTRA_DIST += u64.h - -## end gnulib module u64 - ## begin gnulib module unistd BUILT_SOURCES += unistd.h diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4 index fc55eab134..2d41057ac8 100644 --- a/gl/m4/gnulib-cache.m4 +++ b/gl/m4/gnulib-cache.m4 @@ -27,7 +27,7 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files alloca base64 byteswap c-ctype extensions func gendocs getline gettext gettimeofday hash-pjw-bare havelib iconv intprops lib-msvc-compat lib-symbol-versions maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html read-file snprintf stdint strcase strndup strtok_r strverscmp sys_socket sys_stat time_r u64 unistd valgrind-tests vasprintf vsnprintf warnings +# gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files alloca base64 byteswap c-ctype extensions func gendocs getline gettext gettimeofday hash-pjw-bare havelib iconv intprops lib-msvc-compat lib-symbol-versions maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html read-file snprintf stdint strcase strndup strtok_r strverscmp sys_socket sys_stat time_r unistd valgrind-tests vasprintf vsnprintf warnings # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([gl/override]) @@ -65,7 +65,6 @@ gl_MODULES([ sys_socket sys_stat time_r - u64 unistd valgrind-tests vasprintf diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4 index 893041c095..263bce28b5 100644 --- a/gl/m4/gnulib-comp.m4 +++ b/gl/m4/gnulib-comp.m4 @@ -168,8 +168,6 @@ AC_DEFUN([gl_EARLY], # Code from module time: # Code from module time-tests: # Code from module time_r: - # Code from module u64: - # Code from module u64-tests: # Code from module unistd: # Code from module unistd-tests: # Code from module useless-if-before-free: @@ -644,8 +642,6 @@ AC_DEFUN([gl_FILE_LIST], [ lib/sys_uio.in.h lib/time.in.h lib/time_r.c - lib/u64.c - lib/u64.h lib/unistd.c lib/unistd.in.h lib/vasnprintf.c @@ -824,7 +820,6 @@ AC_DEFUN([gl_FILE_LIST], [ tests/test-sys_uio.c tests/test-sys_wait.h tests/test-time.c - tests/test-u64.c tests/test-unistd.c tests/test-vasnprintf.c tests/test-vasprintf.c diff --git a/gl/m4/ld-version-script.m4 b/gl/m4/ld-version-script.m4 index f6fe6b88e0..211d67b963 100644 --- a/gl/m4/ld-version-script.m4 +++ b/gl/m4/ld-version-script.m4 @@ -1,4 +1,4 @@ -# ld-version-script.m4 serial 3 +# ld-version-script.m4 serial 4 dnl Copyright (C) 2008-2015 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -18,20 +18,18 @@ dnl From Simon Josefsson AC_DEFUN([gl_LD_VERSION_SCRIPT], [ AC_ARG_ENABLE([ld-version-script], - AS_HELP_STRING([--enable-ld-version-script], - [enable linker version script (default is enabled when possible)]), - [have_ld_version_script=$enableval], []) - if test -z "$have_ld_version_script"; then - AC_MSG_CHECKING([if LD -Wl,--version-script works]) - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map" - cat > conftest.map <<EOF -foo -EOF - AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], - [accepts_syntax_errors=yes], [accepts_syntax_errors=no]) - if test "$accepts_syntax_errors" = no; then - cat > conftest.map <<EOF + [AS_HELP_STRING([--enable-ld-version-script], + [enable linker version script (default is enabled when possible)])], + [have_ld_version_script=$enableval], + [AC_CACHE_CHECK([if LD -Wl,--version-script works], + [gl_cv_sys_ld_version_script], + [gl_cv_sys_ld_version_script=no + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map" + echo foo >conftest.map + AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], + [], + [cat > conftest.map <<EOF VERS_1 { global: sym; }; @@ -40,14 +38,11 @@ VERS_2 { global: sym; } VERS_1; EOF - AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], - [have_ld_version_script=yes], [have_ld_version_script=no]) - else - have_ld_version_script=no - fi - rm -f conftest.map - LDFLAGS="$save_LDFLAGS" - AC_MSG_RESULT($have_ld_version_script) - fi - AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes") + AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], + [gl_cv_sys_ld_version_script=yes])]) + rm -f conftest.map + LDFLAGS=$save_LDFLAGS]) + have_ld_version_script=$gl_cv_sys_ld_version_script]) + AM_CONDITIONAL([HAVE_LD_VERSION_SCRIPT], + [test "$have_ld_version_script" = yes]) ]) diff --git a/gl/m4/printf.m4 b/gl/m4/printf.m4 index ffbb235c6a..d06746aae7 100644 --- a/gl/m4/printf.m4 +++ b/gl/m4/printf.m4 @@ -1,4 +1,4 @@ -# printf.m4 serial 51 +# printf.m4 serial 52 dnl Copyright (C) 2003, 2007-2015 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -365,66 +365,51 @@ int main () { /* Pseudo-NaN. */ static union { unsigned int word[4]; long double value; } x = { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) + if (sprintf (buf, "%Lf", x.value) <= 0) result |= 4; - if (sprintf (buf, "%Le", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) + if (sprintf (buf, "%Le", x.value) <= 0) result |= 4; - if (sprintf (buf, "%Lg", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) + if (sprintf (buf, "%Lg", x.value) <= 0) result |= 4; } { /* Pseudo-Infinity. */ static union { unsigned int word[4]; long double value; } x = { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) + if (sprintf (buf, "%Lf", x.value) <= 0) result |= 8; - if (sprintf (buf, "%Le", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) + if (sprintf (buf, "%Le", x.value) <= 0) result |= 8; - if (sprintf (buf, "%Lg", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) + if (sprintf (buf, "%Lg", x.value) <= 0) result |= 8; } { /* Pseudo-Zero. */ static union { unsigned int word[4]; long double value; } x = { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) + if (sprintf (buf, "%Lf", x.value) <= 0) result |= 16; - if (sprintf (buf, "%Le", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) + if (sprintf (buf, "%Le", x.value) <= 0) result |= 16; - if (sprintf (buf, "%Lg", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) + if (sprintf (buf, "%Lg", x.value) <= 0) result |= 16; } { /* Unnormalized number. */ static union { unsigned int word[4]; long double value; } x = { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) + if (sprintf (buf, "%Lf", x.value) <= 0) result |= 32; - if (sprintf (buf, "%Le", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) + if (sprintf (buf, "%Le", x.value) <= 0) result |= 32; - if (sprintf (buf, "%Lg", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) + if (sprintf (buf, "%Lg", x.value) <= 0) result |= 32; } { /* Pseudo-Denormal. */ static union { unsigned int word[4]; long double value; } x = { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) + if (sprintf (buf, "%Lf", x.value) <= 0) result |= 64; - if (sprintf (buf, "%Le", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) + if (sprintf (buf, "%Le", x.value) <= 0) result |= 64; - if (sprintf (buf, "%Lg", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) + if (sprintf (buf, "%Lg", x.value) <= 0) result |= 64; } #endif diff --git a/gl/m4/stdio_h.m4 b/gl/m4/stdio_h.m4 index 42173387af..e0c4bde1f8 100644 --- a/gl/m4/stdio_h.m4 +++ b/gl/m4/stdio_h.m4 @@ -1,4 +1,4 @@ -# stdio_h.m4 serial 43 +# stdio_h.m4 serial 44 dnl Copyright (C) 2007-2015 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -12,6 +12,24 @@ AC_DEFUN([gl_STDIO_H], AC_REQUIRE([gl_STDIO_H_DEFAULTS]) gl_NEXT_HEADERS([stdio.h]) + dnl Determine whether __USE_MINGW_ANSI_STDIO makes printf and + dnl inttypes.h behave like gnu instead of system; we must give our + dnl printf wrapper the right attribute to match. + AC_CACHE_CHECK([whether inttypes macros match system or gnu printf], + [gl_cv_func_printf_attribute_flavor], + [AC_EGREP_CPP([findme .(ll|j)d. findme], + [#define __STDC_FORMAT_MACROS 1 + #include <stdio.h> + #include <inttypes.h> + findme PRIdMAX findme + ], [gl_cv_func_printf_attribute_flavor=gnu], + [gl_cv_func_printf_attribute_flavor=system])]) + if test "$gl_cv_func_printf_attribute_flavor" = gnu; then + AC_DEFINE([GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU], [1], + [Define to 1 if printf and friends should be labeled with + attribute "__gnu_printf__" instead of "__printf__"]) + fi + dnl No need to create extra modules for these functions. Everyone who uses dnl <stdio.h> likely needs them. GNULIB_FSCANF=1 diff --git a/gl/m4/time_h.m4 b/gl/m4/time_h.m4 index 0f0b7d9a2a..d9c41a48f3 100644 --- a/gl/m4/time_h.m4 +++ b/gl/m4/time_h.m4 @@ -2,7 +2,7 @@ # Copyright (C) 2000-2001, 2003-2007, 2009-2015 Free Software Foundation, Inc. -# serial 8 +# serial 9 # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -26,7 +26,7 @@ AC_DEFUN([gl_HEADER_TIME_H_BODY], ]) dnl Check whether 'struct timespec' is declared -dnl in time.h, sys/time.h, or pthread.h. +dnl in time.h, sys/time.h, pthread.h, or unistd.h. AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC], [ @@ -44,6 +44,7 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC], TIME_H_DEFINES_STRUCT_TIMESPEC=0 SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=0 PTHREAD_H_DEFINES_STRUCT_TIMESPEC=0 + UNISTD_H_DEFINES_STRUCT_TIMESPEC=0 if test $gl_cv_sys_struct_timespec_in_time_h = yes; then TIME_H_DEFINES_STRUCT_TIMESPEC=1 else @@ -70,12 +71,26 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC], [gl_cv_sys_struct_timespec_in_pthread_h=no])]) if test $gl_cv_sys_struct_timespec_in_pthread_h = yes; then PTHREAD_H_DEFINES_STRUCT_TIMESPEC=1 + else + AC_CACHE_CHECK([for struct timespec in <unistd.h>], + [gl_cv_sys_struct_timespec_in_unistd_h], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <unistd.h> + ]], + [[static struct timespec x; x.tv_sec = x.tv_nsec;]])], + [gl_cv_sys_struct_timespec_in_unistd_h=yes], + [gl_cv_sys_struct_timespec_in_unistd_h=no])]) + if test $gl_cv_sys_struct_timespec_in_unistd_h = yes; then + UNISTD_H_DEFINES_STRUCT_TIMESPEC=1 + fi fi fi fi AC_SUBST([TIME_H_DEFINES_STRUCT_TIMESPEC]) AC_SUBST([SYS_TIME_H_DEFINES_STRUCT_TIMESPEC]) AC_SUBST([PTHREAD_H_DEFINES_STRUCT_TIMESPEC]) + AC_SUBST([UNISTD_H_DEFINES_STRUCT_TIMESPEC]) ]) AC_DEFUN([gl_TIME_MODULE_INDICATOR], diff --git a/gl/m4/ungetc.m4 b/gl/m4/ungetc.m4 index c5c90f6d9c..2a34b3019f 100644 --- a/gl/m4/ungetc.m4 +++ b/gl/m4/ungetc.m4 @@ -29,8 +29,9 @@ AC_DEFUN_ONCE([gl_FUNC_UNGETC_WORKS], fclose (f); remove ("conftest.tmp");])], [gl_cv_func_ungetc_works=yes], [gl_cv_func_ungetc_works=no], [case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_ungetc_works="guessing yes" ;; + # Guess yes on glibc and bionic systems. + *-gnu*|*-android*) + gl_cv_func_ungetc_works="guessing yes" ;; # If we don't know, assume the worst. *) gl_cv_func_ungetc_works="guessing no" ;; esac diff --git a/gl/stdio-impl.h b/gl/stdio-impl.h index f819b2e550..bf6e7c828b 100644 --- a/gl/stdio-impl.h +++ b/gl/stdio-impl.h @@ -28,7 +28,8 @@ #include <errno.h> /* For detecting Plan9. */ -#if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */ +#if defined __sferror || defined __DragonFly__ || defined __ANDROID__ + /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */ # if defined __DragonFly__ /* DragonFly */ /* See <http://www.dragonflybsd.org/cvsweb/src/lib/libc/stdio/priv_stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>. */ @@ -66,7 +67,7 @@ /* More fields, not relevant here. */ }; # define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub -# else /* FreeBSD, NetBSD <= 1.5Z, DragonFly, Mac OS X, Cygwin */ +# else /* FreeBSD, NetBSD <= 1.5Z, DragonFly, Mac OS X, Cygwin, Android */ # define fp_ub fp_->_ub # endif diff --git a/gl/stdio.in.h b/gl/stdio.in.h index 212c30655f..7c57a01265 100644 --- a/gl/stdio.in.h +++ b/gl/stdio.in.h @@ -84,8 +84,13 @@ except that it indicates to GCC that the supported format string directives are the ones of the system printf(), rather than the ones standardized by ISO C99 and POSIX. */ -#define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \ +#if GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU +# define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \ + _GL_ATTRIBUTE_FORMAT_PRINTF (formatstring_parameter, first_argument) +#else +# define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \ _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument)) +#endif /* _GL_ATTRIBUTE_FORMAT_SCANF indicates to GCC that the function takes a format string and arguments, diff --git a/gl/tests/Makefile.am b/gl/tests/Makefile.am index bfb5d1c385..306d637d29 100644 --- a/gl/tests/Makefile.am +++ b/gl/tests/Makefile.am @@ -622,14 +622,6 @@ EXTRA_DIST += test-time.c ## end gnulib module time-tests -## begin gnulib module u64-tests - -TESTS += test-u64 -check_PROGRAMS += test-u64 -EXTRA_DIST += test-u64.c - -## end gnulib module u64-tests - ## begin gnulib module unistd-tests TESTS += test-unistd diff --git a/gl/tests/init.sh b/gl/tests/init.sh index 37fc7b62ee..9f403c51d2 100644 --- a/gl/tests/init.sh +++ b/gl/tests/init.sh @@ -93,6 +93,27 @@ skip_ () { warn_ "$ME_: skipped test: $@"; Exit 77; } fatal_ () { warn_ "$ME_: hard error: $@"; Exit 99; } framework_failure_ () { warn_ "$ME_: set-up failure: $@"; Exit 99; } +# This is used to simplify checking of the return value +# which is useful when ensuring a command fails as desired. +# I.e., just doing `command ... &&fail=1` will not catch +# a segfault in command for example. With this helper you +# instead check an explicit exit code like +# returns_ 1 command ... || fail +returns_ () { + # Disable tracing so it doesn't interfere with stderr of the wrapped command + { set +x; } 2>/dev/null + + local exp_exit="$1" + shift + "$@" + test $? -eq $exp_exit && ret_=0 || ret_=1 + + if test "$VERBOSE" = yes && test "$gl_set_x_corrupts_stderr_" = false; then + set -x + fi + { return $ret_; } 2>/dev/null +} + # Sanitize this shell to POSIX mode, if possible. DUALCASE=1; export DUALCASE if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then diff --git a/gl/tests/test-u64.c b/gl/tests/test-u64.c deleted file mode 100644 index 4b77a7fdd9..0000000000 --- a/gl/tests/test-u64.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Test of <u64.h> - Copyright (C) 2009-2015 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Simon Josefsson <simon@josefsson.org>, 2009. */ - -#include <config.h> - -#include <u64.h> - -int -main (void) -{ - u64 i = u64init (42, 4711); - u64 j, k, l; - - j = u64hilo (42, 4711); - - if (u64lt (i, j) || u64lt (j, i)) - return 1; - - i = u64hilo (0, 42); - j = u64hilo (0, 43); - - if (!u64lt (i, j)) - return 1; - - k = u64plus (i, j); - l = u64hilo (0, 42 + 43); - - if (u64lt (k, l) || u64lt (l, k)) - return 1; - - return 0; -} diff --git a/gl/time.in.h b/gl/time.in.h index e0e8383d51..a2343daf55 100644 --- a/gl/time.in.h +++ b/gl/time.in.h @@ -55,6 +55,8 @@ # include <sys/time.h> # elif @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@ # include <pthread.h> +# elif @UNISTD_H_DEFINES_STRUCT_TIMESPEC@ +# include <unistd.h> # else # ifdef __cplusplus diff --git a/gl/u64.c b/gl/u64.c deleted file mode 100644 index 04cf7a2994..0000000000 --- a/gl/u64.c +++ /dev/null @@ -1,3 +0,0 @@ -#include <config.h> -#define _GL_U64_INLINE _GL_EXTERN_INLINE -#include "u64.h" diff --git a/gl/u64.h b/gl/u64.h deleted file mode 100644 index b26486e22b..0000000000 --- a/gl/u64.h +++ /dev/null @@ -1,179 +0,0 @@ -/* uint64_t-like operations that work even on hosts lacking uint64_t - - Copyright (C) 2006, 2009-2015 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 2.1 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Paul Eggert. */ - -#include <stdint.h> - -#ifndef _GL_INLINE_HEADER_BEGIN - #error "Please include config.h first." -#endif -_GL_INLINE_HEADER_BEGIN -#ifndef _GL_U64_INLINE -# define _GL_U64_INLINE _GL_INLINE -#endif - -/* Return X rotated left by N bits, where 0 < N < 64. */ -#define u64rol(x, n) u64or (u64shl (x, n), u64shr (x, 64 - n)) - -#ifdef UINT64_MAX - -/* Native implementations are trivial. See below for comments on what - these operations do. */ -typedef uint64_t u64; -# define u64hilo(hi, lo) ((u64) (((u64) (hi) << 32) + (lo))) -# define u64init(hi, lo) u64hilo (hi, lo) -# define u64lo(x) ((u64) (x)) -# define u64size(x) u64lo (x) -# define u64lt(x, y) ((x) < (y)) -# define u64and(x, y) ((x) & (y)) -# define u64or(x, y) ((x) | (y)) -# define u64xor(x, y) ((x) ^ (y)) -# define u64plus(x, y) ((x) + (y)) -# define u64shl(x, n) ((x) << (n)) -# define u64shr(x, n) ((x) >> (n)) - -#else - -/* u64 is a 64-bit unsigned integer value. - u64init (HI, LO), is like u64hilo (HI, LO), but for use in - initializer contexts. */ -# ifdef WORDS_BIGENDIAN -typedef struct { uint32_t hi, lo; } u64; -# define u64init(hi, lo) { hi, lo } -# else -typedef struct { uint32_t lo, hi; } u64; -# define u64init(hi, lo) { lo, hi } -# endif - -/* Given the high and low-order 32-bit quantities HI and LO, return a u64 - value representing (HI << 32) + LO. */ -_GL_U64_INLINE u64 -u64hilo (uint32_t hi, uint32_t lo) -{ - u64 r; - r.hi = hi; - r.lo = lo; - return r; -} - -/* Return a u64 value representing LO. */ -_GL_U64_INLINE u64 -u64lo (uint32_t lo) -{ - u64 r; - r.hi = 0; - r.lo = lo; - return r; -} - -/* Return a u64 value representing SIZE. */ -_GL_U64_INLINE u64 -u64size (size_t size) -{ - u64 r; - r.hi = size >> 31 >> 1; - r.lo = size; - return r; -} - -/* Return X < Y. */ -_GL_U64_INLINE int -u64lt (u64 x, u64 y) -{ - return x.hi < y.hi || (x.hi == y.hi && x.lo < y.lo); -} - -/* Return X & Y. */ -_GL_U64_INLINE u64 -u64and (u64 x, u64 y) -{ - u64 r; - r.hi = x.hi & y.hi; - r.lo = x.lo & y.lo; - return r; -} - -/* Return X | Y. */ -_GL_U64_INLINE u64 -u64or (u64 x, u64 y) -{ - u64 r; - r.hi = x.hi | y.hi; - r.lo = x.lo | y.lo; - return r; -} - -/* Return X ^ Y. */ -_GL_U64_INLINE u64 -u64xor (u64 x, u64 y) -{ - u64 r; - r.hi = x.hi ^ y.hi; - r.lo = x.lo ^ y.lo; - return r; -} - -/* Return X + Y. */ -_GL_U64_INLINE u64 -u64plus (u64 x, u64 y) -{ - u64 r; - r.lo = x.lo + y.lo; - r.hi = x.hi + y.hi + (r.lo < x.lo); - return r; -} - -/* Return X << N. */ -_GL_U64_INLINE u64 -u64shl (u64 x, int n) -{ - u64 r; - if (n < 32) - { - r.hi = (x.hi << n) | (x.lo >> (32 - n)); - r.lo = x.lo << n; - } - else - { - r.hi = x.lo << (n - 32); - r.lo = 0; - } - return r; -} - -/* Return X >> N. */ -_GL_U64_INLINE u64 -u64shr (u64 x, int n) -{ - u64 r; - if (n < 32) - { - r.hi = x.hi >> n; - r.lo = (x.hi << (32 - n)) | (x.lo >> n); - } - else - { - r.hi = 0; - r.lo = x.hi >> (n - 32); - } - return r; -} - -#endif - -_GL_INLINE_HEADER_END diff --git a/gl/vasnprintf.c b/gl/vasnprintf.c index 791f674094..c291be1f9a 100644 --- a/gl/vasnprintf.c +++ b/gl/vasnprintf.c @@ -1886,7 +1886,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, else { do - result[length++] = (unsigned char) *cp++; + result[length++] = *cp++; while (--n > 0); } } @@ -4793,7 +4793,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, { const FCHAR_T *mp = dp->width_start; do - *fbp++ = (unsigned char) *mp++; + *fbp++ = *mp++; while (--n > 0); } } @@ -4814,7 +4814,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, { const FCHAR_T *mp = dp->precision_start; do - *fbp++ = (unsigned char) *mp++; + *fbp++ = *mp++; while (--n > 0); } } @@ -5382,7 +5382,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, tmpsrc += count; tmpdst += count; for (n = count; n > 0; n--) - *--tmpdst = (unsigned char) *--tmpsrc; + *--tmpdst = *--tmpsrc; } } #endif |