]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
diffseq: pacify gcc -Wusless-cast
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 25 May 2026 18:31:06 +0000 (11:31 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 25 May 2026 21:30:45 +0000 (14:30 -0700)
* lib/diffseq.h (OFFSET_MAX): Pacify when OFFSET is int.

ChangeLog
lib/diffseq.h

index 0611c6c7a15db762f5d7d3dffde1bc8895552423..80bca2cba3b35eaf52b92eecd3ecf3a91815f51f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2026-05-25  Paul Eggert  <eggert@cs.ucla.edu>
+
+       diffseq: pacify gcc -Wusless-cast
+       * lib/diffseq.h (OFFSET_MAX): Pacify when OFFSET is int.
+
 2026-05-25  Bruno Haible  <bruno@clisp.org>
 
        trim tests: Enhance tests.
index cf710a316f835ef4df8733d77194ce1d848034ac..73fa47b42e160259f8efd59a56030d33e0b67507 100644 (file)
  #error "Please include config.h first."
 #endif
 
-/* Maximum value of type OFFSET.  */
+/* Maximum value of type OFFSET.  The 1u pacifies -Wuseless-cast, and
+   unlike a compound literal can appear in an integer constant expression.  */
 #ifndef OFFSET_MAX
 # define OFFSET_MAX \
-   ((((OFFSET) 1 << (sizeof (OFFSET) * CHAR_BIT - 2)) - 1) * 2 + 1)
+   ((((OFFSET) 1u << (sizeof (OFFSET) * CHAR_BIT - 2)) - 1) * 2 + 1)
 #endif
 
 /* Default to no early abort.  */