]> Savannah Git Hosting - gnulib.git/commitdiff
manywarnings: port to GCC on 64-bit MS-Windows
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 17 Sep 2017 06:21:43 +0000 (23:21 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 17 Sep 2017 06:23:51 +0000 (23:23 -0700)
* m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC): Work better if
LONG_MAX < PTRDIFF_MAX.  Problem reported by Richard Copley in:
https://lists.gnu.org/archive/html/emacs-devel/2017-09/msg00392.html

ChangeLog
m4/manywarnings.m4

index 24d86f6c5c77ff1305985decb57bfc28cb4c2ebf..6a0b4963221a3c98a4010a62a639a140090c2554 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2017-09-16  Paul Eggert  <eggert@cs.ucla.edu>
+
+       manywarnings: port to GCC on 64-bit MS-Windows
+       * m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC): Work better if
+       LONG_MAX < PTRDIFF_MAX.  Problem reported by Richard Copley in:
+       https://lists.gnu.org/archive/html/emacs-devel/2017-09/msg00392.html
+
 2017-09-13  Bruno Haible  <bruno@clisp.org>
 
        all: Replace many more http URLs by https URLs. Update stale URLs.
index eb89325519c93c77d7f1df900b4f3fe4dbebe22a..604573ad4802d7f1ffd5b4329b5f7cc8b85b5b29 100644 (file)
@@ -1,4 +1,4 @@
-# manywarnings.m4 serial 12
+# manywarnings.m4 serial 13
 dnl Copyright (C) 2008-2017 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -267,18 +267,23 @@ m4_defun([gl_MANYWARN_ALL_GCC(C)],
 
   # gcc --help=warnings outputs an unusual form for these options; list
   # them here so that the above 'comm' command doesn't report a false match.
-  # Would prefer "min (PTRDIFF_MAX, SIZE_MAX)", but it must be a literal
-  # and AC_COMPUTE_INT requires it to fit in a long:
+  # Would prefer "min (PTRDIFF_MAX, SIZE_MAX)", but it must be a literal.
+  # Also, AC_COMPUTE_INT requirs it to fit in a long; it is 2**63 on
+  # the only platforms where it does not fit in a long, so make that
+  # a special case.
   AC_MSG_CHECKING([max safe object size])
   AC_COMPUTE_INT([gl_alloc_max],
-    [(LONG_MAX < PTRDIFF_MAX ? LONG_MAX : PTRDIFF_MAX) < (size_t) -1
-     ? (LONG_MAX < PTRDIFF_MAX ? LONG_MAX : PTRDIFF_MAX)
-     : (size_t) -1],
+    [LONG_MAX < (PTRDIFF_MAX < (size_t) -1 ? PTRDIFF_MAX : (size_t) -1)
+     ? -1
+     : PTRDIFF_MAX < (size_t) -1 ? (long) PTRDIFF_MAX : (long) (size_t) -1],
     [[#include <limits.h>
       #include <stddef.h>
       #include <stdint.h>
     ]],
     [gl_alloc_max=2147483647])
+  case $gl_alloc_max in
+    -1) gl_alloc_max=9223372036854775807;;
+  esac
   AC_MSG_RESULT([$gl_alloc_max])
   gl_manywarn_set="$gl_manywarn_set -Walloc-size-larger-than=$gl_alloc_max"
   gl_manywarn_set="$gl_manywarn_set -Warray-bounds=2"