]> Savannah Git Hosting - gnulib.git/commitdiff
intprops: pacify GCC < 10 -Wsign-compare
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 29 Mar 2024 22:56:45 +0000 (15:56 -0700)
committerBruno Haible <bruno@clisp.org>
Mon, 8 Apr 2024 11:09:28 +0000 (13:09 +0200)
Problem reported by Martin Dorey in:
https://savannah.gnu.org/bugs/index.php?65537
* lib/intprops-internal.h (_GL_INT_MULTIPLY_WRAPV):
When working around GCC bug 91450, pacify -Wsign-compare by
casting 0 to the result type.

ChangeLog
lib/intprops-internal.h

index 86b75a14de5a0eeef110ff72231c24c202f5ebf9..b30518785c430176fbf89aa31d64a0159aa5b19a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-03-29  Paul Eggert  <eggert@cs.ucla.edu>
+
+       intprops: pacify GCC < 10 -Wsign-compare
+       Problem reported by Martin Dorey in:
+       https://savannah.gnu.org/bugs/index.php?65537
+       * lib/intprops-internal.h (_GL_INT_MULTIPLY_WRAPV):
+       When working around GCC bug 91450, pacify -Wsign-compare by
+       casting 0 to the result type.
+
 2024-03-29  Bruno Haible  <bruno@clisp.org>
 
        attribute: Work around compiler bug of Oracle cc 12.6.
index 0467a9ca8f2f10a896a67c726794b1eb76ed7a2e..69b401fda1b56075e6cff830663a84cbd63bf150 100644 (file)
@@ -1,6 +1,6 @@
 /* intprops-internal.h -- properties of integer types not visible to users
 
-   Copyright (C) 2001-2023 Free Software Foundation, Inc.
+   Copyright (C) 2001-2024 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
    /* Work around GCC bug 91450.  */
 #  define _GL_INT_MULTIPLY_WRAPV(a, b, r) \
     ((!_GL_SIGNED_TYPE_OR_EXPR (*(r)) && _GL_EXPR_SIGNED (a) && _GL_EXPR_SIGNED (b) \
-      && _GL_INT_MULTIPLY_RANGE_OVERFLOW (a, b, 0, (__typeof__ (*(r))) -1)) \
+      && _GL_INT_MULTIPLY_RANGE_OVERFLOW (a, b, \
+                                          (__typeof__ (*(r))) 0, \
+                                          (__typeof__ (*(r))) -1)) \
      ? ((void) __builtin_mul_overflow (a, b, r), 1) \
      : __builtin_mul_overflow (a, b, r))
 # endif