bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] manywarnings: port to GCC on 64-bit MS-Windows


From: Paul Eggert
Subject: [PATCH] manywarnings: port to GCC on 64-bit MS-Windows
Date: Sat, 16 Sep 2017 23:24:26 -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          |  7 +++++++
 m4/manywarnings.m4 | 17 +++++++++++------
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 24d86f6c5..6a0b49632 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2017-09-16  Paul Eggert  <address@hidden>
+
+       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  <address@hidden>
 
        all: Replace many more http URLs by https URLs. Update stale URLs.
diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4
index eb8932551..604573ad4 100644
--- a/m4/manywarnings.m4
+++ b/m4/manywarnings.m4
@@ -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"
-- 
2.13.5




reply via email to

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