Forwarding patch to gnulib where it would be adjusted/applied.

cheers,
Pádraig
--- coreutils-8.28/configure.ac.omv~    2017-10-30 17:14:36.543445080 +0100
+++ coreutils-8.28/configure.ac 2017-10-30 17:27:19.273190455 +0100
@@ -330,6 +330,18 @@ if test $ac_cv_func_syslog = no; then
   done
 fi
 
+AC_CACHE_CHECK([for gcc 7-compatible __builtin_mul_overflow_p],
+  [utils_cv_builtin_mul_overflow_p],
+  [AC_COMPILE_IFELSE(
+    [AC_LANG_PROGRAM(
+      [[]],
+      [[return __builtin_mul_overflow_p(1, 2, 3);]])],
+    [utils_cv_builtin_mul_overflow_p=yes],
+    [utils_cv_builtin_mul_overflow_p=no])])
+if test $utils_cv_builtin_mul_overflow_p = yes; then
+  AC_DEFINE([HAVE_BUILTIN_MUL_OVERFLOW_P], [1], [Define if your compiler 
supports __builtin_mul_overflow_p])
+fi
+
 AC_CACHE_CHECK([for 3-argument setpriority function],
   [utils_cv_func_setpriority],
   [AC_LINK_IFELSE(
--- coreutils-8.28/lib/intprops.h.omv~  2017-10-30 17:18:59.757654086 +0100
+++ coreutils-8.28/lib/intprops.h       2017-10-30 17:30:42.752601713 +0100
@@ -225,14 +225,11 @@
 # define _GL_HAS_BUILTIN_OVERFLOW 0
 #endif
 
-/* True if __builtin_add_overflow_p (A, B, C) works.  */
-#define _GL_HAS_BUILTIN_OVERFLOW_P (7 <= __GNUC__)
-
 /* The _GL*_OVERFLOW macros have the same restrictions as the
    *_RANGE_OVERFLOW macros, except that they do not assume that operands
    (e.g., A and B) have the same type as MIN and MAX.  Instead, they assume
    that the result (e.g., A + B) has that type.  */
-#if _GL_HAS_BUILTIN_OVERFLOW_P
+#ifdef HAVE_BUILTIN_MUL_OVERFLOW_P
 # define _GL_ADD_OVERFLOW(a, b, min, max)                               \
    __builtin_add_overflow_p (a, b, (__typeof__ ((a) + (b))) 0)
 # define _GL_SUBTRACT_OVERFLOW(a, b, min, max)                          \
--- coreutils-8.28/lib/xalloc-oversized.h.omv~  2017-10-30 17:19:47.020513923 
+0100
+++ coreutils-8.28/lib/xalloc-oversized.h       2017-10-30 17:31:11.728518085 
+0100
@@ -41,7 +41,7 @@ typedef size_t __xalloc_count_type;
    positive and N must be nonnegative.  This is a macro, not a
    function, so that it works correctly even when SIZE_MAX < N.  */
 
-#if 7 <= __GNUC__
+#ifdef HAVE_BUILTIN_MUL_OVERFLOW_P
 # define xalloc_oversized(n, s) \
    __builtin_mul_overflow_p (n, s, (__xalloc_count_type) 1)
 #elif 5 <= __GNUC__ && !defined __ICC && !__STRICT_ANSI__
--- coreutils-8.28/lib/fts.c.omv~       2017-10-30 17:37:28.365434308 +0100
+++ coreutils-8.28/lib/fts.c    2017-10-30 17:39:33.481075235 +0100
@@ -199,7 +199,7 @@ enum Fts_stat
 #endif
 
 #ifndef FALLTHROUGH
-# if __GNUC__ < 7
+# if __GNUC__ < 7 || !__has_attribute(__fallthrough__)
 #  define FALLTHROUGH ((void) 0)
 # else
 #  define FALLTHROUGH __attribute__ ((__fallthrough__))

Reply via email to