texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[6875] run gnulib --add-import


From: Gavin D. Smith
Subject: [6875] run gnulib --add-import
Date: Sat, 19 Dec 2015 16:24:11 +0000

Revision: 6875
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6875
Author:   gavin
Date:     2015-12-19 16:24:09 +0000 (Sat, 19 Dec 2015)
Log Message:
-----------
run gnulib --add-import

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/gnulib/lib/Makefile.am
    trunk/gnulib/lib/intprops.h
    trunk/gnulib/lib/xalloc-oversized.h
    trunk/gnulib/m4/gnulib-cache.m4
    trunk/gnulib/m4/mbrtowc.m4

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2015-12-19 16:18:37 UTC (rev 6874)
+++ trunk/ChangeLog     2015-12-19 16:24:09 UTC (rev 6875)
@@ -1,5 +1,9 @@
 2015-12-19  Gavin Smith  <address@hidden>
 
+       * (gnulib): Run gnulib --add-import.
+
+2015-12-19  Gavin Smith  <address@hidden>
+
        * doc/texinfo.tex (\begindoublecolumns): Remove \global 
        qualifier from an assignment to \vsize.
        (\enddoublecolumns): Some comments updated to reflect the fact 

Modified: trunk/gnulib/lib/Makefile.am
===================================================================
--- trunk/gnulib/lib/Makefile.am        2015-12-19 16:18:37 UTC (rev 6874)
+++ trunk/gnulib/lib/Makefile.am        2015-12-19 16:24:09 UTC (rev 6875)
@@ -21,7 +21,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu 
--source-base=gnulib/lib --m4-base=gnulib/m4 --doc-base=doc --tests-base=tests 
--aux-dir=build-aux --conditional-dependencies --no-libtool --macro-prefix=gl 
--no-vc-files argz getopt-gnu gettext iconv mbchar mbiter mbscasecmp mbschr 
mbslen mbsncasecmp mbsstr mbswidth memmem memrchr mkstemp regex stdarg 
strcasestr strdup-posix strerror vasprintf xalloc
+# Reproduce by: gnulib-tool --import --lib=libgnu --source-base=gnulib/lib 
--m4-base=gnulib/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux 
--conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files argz 
getopt-gnu gettext iconv mbchar mbiter mbscasecmp mbschr mbslen mbsncasecmp 
mbsstr mbswidth memmem memrchr mkstemp regex stdarg strcasestr strdup-posix 
strerror vasprintf xalloc
 
 AUTOMAKE_OPTIONS = 1.9.6 gnits subdir-objects
 

Modified: trunk/gnulib/lib/intprops.h
===================================================================
--- trunk/gnulib/lib/intprops.h 2015-12-19 16:18:37 UTC (rev 6874)
+++ trunk/gnulib/lib/intprops.h 2015-12-19 16:24:09 UTC (rev 6875)
@@ -22,8 +22,7 @@
 
 #include <limits.h>
 
-/* Return an integer value, converted to the same type as the integer
-   expression E after integer type promotion.  V is the unconverted value.  */
+/* Return a value with the common real type of E and V and the value of V.  */
 #define _GL_INT_CONVERT(e, v) (0 * (e) + (v))
 
 /* Act like _GL_INT_CONVERT (E, -V) but work around a bug in IRIX 6.5 cc; see
@@ -48,12 +47,12 @@
 /* True if the signed integer expression E uses two's complement.  */
 #define _GL_INT_TWOS_COMPLEMENT(e) (~ _GL_INT_CONVERT (e, 0) == -1)
 
-/* True if the arithmetic type T is signed.  */
+/* True if the real type T is signed.  */
 #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
 
-/* Return 1 if the integer expression E, after integer promotion, has
-   a signed type.  */
-#define _GL_INT_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0)
+/* Return 1 if the real expression E, after promotion, has a
+   signed or floating type.  */
+#define EXPR_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0)
 
 
 /* Minimum and maximum values for integer types and expressions.  These
@@ -76,11 +75,11 @@
 /* The maximum and minimum values for the type of the expression E,
    after integer promotion.  E should not have side effects.  */
 #define _GL_INT_MINIMUM(e)                                              \
-  (_GL_INT_SIGNED (e)                                                   \
+  (EXPR_SIGNED (e)                                                      \
    ? - _GL_INT_TWOS_COMPLEMENT (e) - _GL_SIGNED_INT_MAXIMUM (e)         \
    : _GL_INT_CONVERT (e, 0))
 #define _GL_INT_MAXIMUM(e)                                              \
-  (_GL_INT_SIGNED (e)                                                   \
+  (EXPR_SIGNED (e)                                                      \
    ? _GL_SIGNED_INT_MAXIMUM (e)                                         \
    : _GL_INT_NEGATE_CONVERT (e, 1))
 #define _GL_SIGNED_INT_MAXIMUM(e)                                       \
@@ -263,23 +262,30 @@
     : (a) % - (b))                                                      \
    == 0)
 
+/* Check for integer overflow, and report low order bits of answer.
 
-/* Integer overflow checks.
-
    The INT_<op>_OVERFLOW macros return 1 if the corresponding C operators
    might not yield numerically correct answers due to arithmetic overflow.
-   They work correctly on all known practical hosts, and do not rely
+   The INT_<op>_WRAPV macros also store the low-order bits of the answer.
+   These macros work correctly on all known practical hosts, and do not rely
    on undefined behavior due to signed arithmetic overflow.
 
-   Example usage:
+   Example usage, assuming A and B are long int:
 
-     long int i = ...;
-     long int j = ...;
-     if (INT_MULTIPLY_OVERFLOW (i, j))
-       printf ("multiply would overflow");
+     if (INT_MULTIPLY_OVERFLOW (a, b))
+       printf ("result would overflow\n");
      else
-       printf ("product is %ld", i * j);
+       printf ("result is %ld (no overflow)\n", a * b);
 
+   Example usage with WRAPV flavor:
+
+     long int result;
+     bool overflow = INT_MULTIPLY_WRAPV (a, b, &result);
+     printf ("result is %ld (%s)\n", result,
+             overflow ? "after overflow" : "no overflow");
+
+   Restrictions on these macros:
+
    These macros do not check for all possible numerical problems or
    undefined or unspecified behavior: they do not check for division
    by zero, for bad shift counts, or for shifting negative numbers.
@@ -287,6 +293,9 @@
    These macros may evaluate their arguments zero or multiple times, so the
    arguments should not have side effects.
 
+   The WRAPV macros are not constant expressions.  They support only
+   +, binary -, and *.  The result type must be signed.
+
    These macros are tuned for their last argument being a constant.
 
    Return 1 if the integer expressions A * B, A - B, -A, A * B, A / B,
@@ -317,4 +326,104 @@
                       _GL_INT_MINIMUM (0 * (b) + (a)),          \
                       _GL_INT_MAXIMUM (0 * (b) + (a)))
 
+/* Compute A + B, A - B, A * B, respectively, storing the result into *R.
+   Return 1 if the result overflows.  See above for restrictions.  */
+#define INT_ADD_WRAPV(a, b, r) \
+  _GL_INT_OP_WRAPV (a, b, r, +, __builtin_add_overflow, INT_ADD_OVERFLOW)
+#define INT_SUBTRACT_WRAPV(a, b, r) \
+  _GL_INT_OP_WRAPV (a, b, r, -, __builtin_sub_overflow, INT_SUBTRACT_OVERFLOW)
+#define INT_MULTIPLY_WRAPV(a, b, r) \
+  _GL_INT_OP_WRAPV (a, b, r, *, __builtin_mul_overflow, INT_MULTIPLY_OVERFLOW)
+
+#ifndef __has_builtin
+# define __has_builtin(x) 0
+#endif
+
+/* Nonzero if this compiler has GCC bug 68193 or Clang bug 25390.  See:
+   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68193
+   https://llvm.org/bugs/show_bug.cgi?id=25390
+   For now, assume all versions of GCC-like compilers generate bogus
+   warnings for _Generic.  This matters only for older compilers that
+   lack __builtin_add_overflow.  */
+#if __GNUC__
+# define _GL__GENERIC_BOGUS 1
+#else
+# define _GL__GENERIC_BOGUS 0
+#endif
+
+/* Store A <op> B into *R, where OP specifies the operation.
+   BUILTIN is the builtin operation, and OVERFLOW the overflow predicate.
+   See above for restrictions.  */
+#if 5 <= __GNUC__ || __has_builtin (__builtin_add_overflow)
+# define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) builtin (a, b, r)
+#elif 201112 <= __STDC_VERSION__ && !_GL__GENERIC_BOGUS
+# define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) \
+   (_Generic \
+    (*(r), \
+     signed char: \
+       _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned char, \
+                        signed char, SCHAR_MIN, SCHAR_MAX), \
+     short int: \
+       _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned short int, \
+                        short int, SHRT_MIN, SHRT_MAX), \
+     int: \
+       _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
+                        int, INT_MIN, INT_MAX), \
+     long int: \
+       _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \
+                        long int, LONG_MIN, LONG_MAX), \
+     long long int: \
+       _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \
+                        long long int, LLONG_MIN, LLONG_MAX)))
+#else
+# define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) \
+   (sizeof *(r) == sizeof (signed char) \
+    ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned char, \
+                       signed char, SCHAR_MIN, SCHAR_MAX) \
+    : sizeof *(r) == sizeof (short int) \
+    ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned short int, \
+                       short int, SHRT_MIN, SHRT_MAX) \
+    : sizeof *(r) == sizeof (int) \
+    ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
+                       int, INT_MIN, INT_MAX) \
+    : _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow))
+# ifdef LLONG_MAX
+#  define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \
+    (sizeof *(r) == sizeof (long int) \
+     ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \
+                        long int, LONG_MIN, LONG_MAX) \
+     : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \
+                        long long int, LLONG_MIN, LLONG_MAX))
+# else
+#  define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \
+    _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \
+                     long int, LONG_MIN, LONG_MAX))
+# endif
+#endif
+
+/* Store the low-order bits of A <op> B into *R, where the operation
+   is given by OP.  Use the unsigned type UT for calculation to avoid
+   overflow problems.  *R's type is T, with extremal values TMIN and
+   TMAX.  T must be a signed integer type.  */
+#define _GL_INT_OP_CALC(a, b, r, op, overflow, ut, t, tmin, tmax) \
+  (sizeof ((a) op (b)) < sizeof (t) \
+   ? _GL_INT_OP_CALC1 ((t) (a), (t) (b), r, op, overflow, ut, t, tmin, tmax) \
+   : _GL_INT_OP_CALC1 (a, b, r, op, overflow, ut, t, tmin, tmax))
+#define _GL_INT_OP_CALC1(a, b, r, op, overflow, ut, t, tmin, tmax) \
+  ((overflow (a, b) \
+    || (EXPR_SIGNED ((a) op (b)) && ((a) op (b)) < (tmin)) \
+    || (tmax) < ((a) op (b))) \
+   ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t, tmin, tmax), 1) \
+   : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t, tmin, tmax), 0))
+
+/* Return A <op> B, where the operation is given by OP.  Use the
+   unsigned type UT for calculation to avoid overflow problems.
+   Convert the result to type T without overflow by subtracting TMIN
+   from large values before converting, and adding it afterwards.
+   Compilers can optimize all the operations except OP.  */
+#define _GL_INT_OP_WRAPV_VIA_UNSIGNED(a, b, op, ut, t, tmin, tmax) \
+  (((ut) (a) op (ut) (b)) <= (tmax) \
+   ? (t) ((ut) (a) op (ut) (b)) \
+   : ((t) (((ut) (a) op (ut) (b)) - (tmin)) + (tmin)))
+
 #endif /* _GL_INTPROPS_H */

Modified: trunk/gnulib/lib/xalloc-oversized.h
===================================================================
--- trunk/gnulib/lib/xalloc-oversized.h 2015-12-19 16:18:37 UTC (rev 6874)
+++ trunk/gnulib/lib/xalloc-oversized.h 2015-12-19 16:24:09 UTC (rev 6875)
@@ -16,10 +16,14 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef XALLOC_OVERSIZED_H_
-# define XALLOC_OVERSIZED_H_
+#define XALLOC_OVERSIZED_H_
 
-# include <stddef.h>
+#include <stddef.h>
 
+#ifndef __has_builtin
+# define __has_builtin(x) 0
+#endif
+
 /* Return 1 if an array of N objects, each of size S, cannot exist due
    to size arithmetic overflow.  S must be positive and N must be
    nonnegative.  This is a macro, not a function, so that it
@@ -32,7 +36,12 @@
    sizeof (ptrdiff_t) <= sizeof (size_t), so do not bother to test for
    exactly-SIZE_MAX allocations on such hosts; this avoids a test and
    branch when S is known to be 1.  */
+#if 5 <= __GNUC__ || __has_builtin (__builtin_mul_overflow)
 # define xalloc_oversized(n, s) \
+    ({ size_t __xalloc_size; __builtin_mul_overflow (n, s, &__xalloc_size); })
+#else
+# define xalloc_oversized(n, s) \
     ((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n))
+#endif
 
 #endif /* !XALLOC_OVERSIZED_H_ */

Modified: trunk/gnulib/m4/gnulib-cache.m4
===================================================================
--- trunk/gnulib/m4/gnulib-cache.m4     2015-12-19 16:18:37 UTC (rev 6874)
+++ trunk/gnulib/m4/gnulib-cache.m4     2015-12-19 16:24:09 UTC (rev 6875)
@@ -27,7 +27,7 @@
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib/lib 
--m4-base=gnulib/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux 
--conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files argz 
getopt-gnu gettext iconv mbchar mbiter mbscasecmp mbschr mbslen mbsncasecmp 
mbsstr mbswidth memmem memrchr mkstemp regex stdarg strcasestr strdup-posix 
strerror vasprintf xalloc
+#   gnulib-tool --import --lib=libgnu --source-base=gnulib/lib 
--m4-base=gnulib/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux 
--conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files argz 
getopt-gnu gettext iconv mbchar mbiter mbscasecmp mbschr mbslen mbsncasecmp 
mbsstr mbswidth memmem memrchr mkstemp regex stdarg strcasestr strdup-posix 
strerror vasprintf xalloc
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([])

Modified: trunk/gnulib/m4/mbrtowc.m4
===================================================================
--- trunk/gnulib/m4/mbrtowc.m4  2015-12-19 16:18:37 UTC (rev 6874)
+++ trunk/gnulib/m4/mbrtowc.m4  2015-12-19 16:24:09 UTC (rev 6875)
@@ -569,10 +569,10 @@
            int
            main (void)
            {
-             return mbrtowc (&wc, "", 0, &mbs) == (size_t) -2;
+             return ! mbrtowc (&wc, "", 0, &mbs) == (size_t) -2;
            }]])],
+        [gl_cv_func_mbrtowc_empty_input=yes],
         [gl_cv_func_mbrtowc_empty_input=no],
-        [gl_cv_func_mbrtowc_empty_input=yes],
         [:])
     ])
 ])




reply via email to

[Prev in Thread] Current Thread [Next in Thread]