]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
Pacify -Wuseless-cast via compound literals in lib
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 8 May 2026 19:12:07 +0000 (12:12 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 9 May 2026 03:25:25 +0000 (20:25 -0700)
* lib/bitset.c (bitset_print):
* lib/bitset/list.c (LBITSET_ELT_BITS, debug_lbitset):
* lib/bitset/table.c (TBITSET_ELT_BITS):
* lib/bitsetv.c (bitsetv_dump, debug_bitsetv)
(bitsetv_matrix_dump):
* lib/gettext.h (gettext, ngettext, textdomain, bindtextdomain)
(bind_textdomain_codeset):
* lib/gl_anyavltree_list2.h (gl_tree_nx_add_first)
(gl_tree_nx_add_last, gl_tree_nx_add_before)
(gl_tree_nx_add_after):
* lib/gl_anylinked_list2.h (gl_linked_nx_create)
(gl_linked_node_nx_set_value, gl_linked_nx_set_at)
(gl_linked_search_from_to, gl_linked_indexof_from_to)
(gl_linked_nx_add_first, gl_linked_nx_add_last)
(gl_linked_nx_add_before, gl_linked_nx_add_after)
(gl_linked_nx_add_at):
* lib/gl_anyrbtree_list2.h (gl_tree_nx_add_first)
(gl_tree_nx_add_last, gl_tree_nx_add_before)
(gl_tree_nx_add_after):
* lib/gl_anytree_list2.h (gl_tree_node_nx_set_value)
(gl_tree_nx_set_at):
* lib/gl_anytreehash_list1.h (add_nodes_to_buckets):
* lib/gl_anytreehash_list2.h (gl_tree_search_from_to):
* lib/gl_array_list.c, lib/gl_carray_list.c, lib/gl_sublist.c:
(INDEX_TO_NODE):
* lib/gl_hash_map.c (gl_hash_search, gl_hash_nx_getput)
(gl_hash_getremove):
* lib/gl_hash_set.c (gl_hash_search, gl_hash_nx_add)
(gl_hash_remove):
* lib/gl_linkedhash_map.c (gl_linkedhash_search)
(gl_linkedhash_nx_getput, gl_linkedhash_getremove):
* lib/gl_linkedhash_set.c (gl_linkedhash_search)
(gl_linkedhash_nx_add, gl_linkedhash_remove):
* lib/isnand-nolibm.h (isnand):
* lib/isnanf-nolibm.h (isnanf):
* lib/isnanl-nolibm.h (isnanl):
* lib/math.in.h (isnand, _gl_isnand, isnan):
* lib/md4.c, lib/sha1.c:
(rol):
* lib/pagealign_alloc.c (pagealign_alloc, pagealign_free):
* lib/ssfmalloc.h (allocate_block_from_pool):
* lib/u64.h (u64hilo, u64lo, u64getlo) [INT_MAX < UINT64_MAX]:
Use compound literal when it is safer than a cast
and it pacifies -Wuseless-cast.
* lib/fsusage.c (PROPAGATE_ALL_ONES):
* lib/glthread/thread.h (glthread_atfork, glthread_sigmask):
Parenthesize more.
* lib/gettext.h (dgettext, dcgettext, dngettext, dcngettext)
(bindtextdomain, bind_textdomain_codeset):
Check types of unused args.

31 files changed:
ChangeLog
lib/bitset.c
lib/bitset/list.c
lib/bitset/table.c
lib/bitsetv.c
lib/fsusage.c
lib/gettext.h
lib/gl_anyavltree_list2.h
lib/gl_anylinked_list2.h
lib/gl_anyrbtree_list2.h
lib/gl_anytree_list2.h
lib/gl_anytreehash_list1.h
lib/gl_anytreehash_list2.h
lib/gl_array_list.c
lib/gl_carray_list.c
lib/gl_hash_map.c
lib/gl_hash_set.c
lib/gl_linkedhash_map.c
lib/gl_linkedhash_set.c
lib/gl_sublist.c
lib/glthread/thread.h
lib/isnand-nolibm.h
lib/isnanf-nolibm.h
lib/isnanl-nolibm.h
lib/malloca.h
lib/math.in.h
lib/md4.c
lib/pagealign_alloc.c
lib/sha1.c
lib/ssfmalloc.h
lib/u64.h

index 654e73b3e72b5408ee54b4627d7df35b3b11adf5..2d26bbcd89edd028c9d835d5a93fdc684cd54816 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,57 @@
 2026-05-08  Paul Eggert  <eggert@cs.ucla.edu>
 
+       Pacify -Wuseless-cast via compound literals in lib
+       * lib/bitset.c (bitset_print):
+       * lib/bitset/list.c (LBITSET_ELT_BITS, debug_lbitset):
+       * lib/bitset/table.c (TBITSET_ELT_BITS):
+       * lib/bitsetv.c (bitsetv_dump, debug_bitsetv)
+       (bitsetv_matrix_dump):
+       * lib/gettext.h (gettext, ngettext, textdomain, bindtextdomain)
+       (bind_textdomain_codeset):
+       * lib/gl_anyavltree_list2.h (gl_tree_nx_add_first)
+       (gl_tree_nx_add_last, gl_tree_nx_add_before)
+       (gl_tree_nx_add_after):
+       * lib/gl_anylinked_list2.h (gl_linked_nx_create)
+       (gl_linked_node_nx_set_value, gl_linked_nx_set_at)
+       (gl_linked_search_from_to, gl_linked_indexof_from_to)
+       (gl_linked_nx_add_first, gl_linked_nx_add_last)
+       (gl_linked_nx_add_before, gl_linked_nx_add_after)
+       (gl_linked_nx_add_at):
+       * lib/gl_anyrbtree_list2.h (gl_tree_nx_add_first)
+       (gl_tree_nx_add_last, gl_tree_nx_add_before)
+       (gl_tree_nx_add_after):
+       * lib/gl_anytree_list2.h (gl_tree_node_nx_set_value)
+       (gl_tree_nx_set_at):
+       * lib/gl_anytreehash_list1.h (add_nodes_to_buckets):
+       * lib/gl_anytreehash_list2.h (gl_tree_search_from_to):
+       * lib/gl_array_list.c, lib/gl_carray_list.c, lib/gl_sublist.c:
+       (INDEX_TO_NODE):
+       * lib/gl_hash_map.c (gl_hash_search, gl_hash_nx_getput)
+       (gl_hash_getremove):
+       * lib/gl_hash_set.c (gl_hash_search, gl_hash_nx_add)
+       (gl_hash_remove):
+       * lib/gl_linkedhash_map.c (gl_linkedhash_search)
+       (gl_linkedhash_nx_getput, gl_linkedhash_getremove):
+       * lib/gl_linkedhash_set.c (gl_linkedhash_search)
+       (gl_linkedhash_nx_add, gl_linkedhash_remove):
+       * lib/isnand-nolibm.h (isnand):
+       * lib/isnanf-nolibm.h (isnanf):
+       * lib/isnanl-nolibm.h (isnanl):
+       * lib/math.in.h (isnand, _gl_isnand, isnan):
+       * lib/md4.c, lib/sha1.c:
+       (rol):
+       * lib/pagealign_alloc.c (pagealign_alloc, pagealign_free):
+       * lib/ssfmalloc.h (allocate_block_from_pool):
+       * lib/u64.h (u64hilo, u64lo, u64getlo) [INT_MAX < UINT64_MAX]:
+       Use compound literal when it is safer than a cast
+       and it pacifies -Wuseless-cast.
+       * lib/fsusage.c (PROPAGATE_ALL_ONES):
+       * lib/glthread/thread.h (glthread_atfork, glthread_sigmask):
+       Parenthesize more.
+       * lib/gettext.h (dgettext, dcgettext, dngettext, dcngettext)
+       (bindtextdomain, bind_textdomain_codeset):
+       Check types of unused args.
+
        fstrcmp: pacify -Wuseless-cast
        * lib/fstrcmp.c (fstrcmp_bounded): Omit unnecessary cast
        of uintptr_t to uintptr_t.
index caff36950abeed7a2c4e992b5126785fbe4b5edb..7716aa405e9aeb10c44ebadd9a493df99415c7c9 100644 (file)
@@ -273,7 +273,7 @@ bitset_print (FILE *file, bitset bset, bool verbose)
   if (verbose)
     fprintf (file, "%s{n_bits = %lu, set = {",
              bitset_type_name_get (bset),
-             (unsigned long) bitset_size (bset));
+             (unsigned long) {bitset_size (bset)});
 
   unsigned pos = 30;
   bitset_bindex i;
@@ -286,7 +286,7 @@ bitset_print (FILE *file, bitset bset, bool verbose)
         pos = 0;
       }
 
-    fprintf (file, "%lu ", (unsigned long) i);
+    fprintf (file, "%lu ", (unsigned long) {i});
     pos += 1 + (i >= 10) + (i >= 100);
   }
 
index f567edda33b9b233bee2a996aa421c74a0bc0b58..9eeab77ab69378b301e85a7cc4fcd1f52c071f51 100644 (file)
@@ -55,7 +55,7 @@ typedef bitset_word lbitset_word;
 
 /* Number of bits stored in each element.  */
 #define LBITSET_ELT_BITS \
-  ((unsigned) (LBITSET_ELT_WORDS * LBITSET_WORD_BITS))
+  ((unsigned) {LBITSET_ELT_WORDS * LBITSET_WORD_BITS})
 
 /* Lbitset element.   We use an array of bits for each element.
    These are linked together in a doubly-linked list.  */
@@ -1272,7 +1272,7 @@ debug_lbitset (bitset bset)
 
   for (lbitset_elt *elt = LBITSET_HEAD (bset); elt; elt = elt->next)
     {
-      fprintf (stderr, "Elt %lu\n", (unsigned long) elt->index);
+      fprintf (stderr, "Elt %lu\n", (unsigned long) {elt->index});
       for (unsigned i = 0; i < LBITSET_ELT_WORDS; i++)
         {
           bitset_word word = elt->words[i];
index 0a28406ee6c7bf41c987ca55229b0c31878dd73b..866af8d817948a880845f5f89f32a4ce0ffca315 100644 (file)
@@ -53,7 +53,7 @@
 
 /* Number of bits stored in each element.  */
 #define TBITSET_ELT_BITS \
-  ((unsigned) (TBITSET_ELT_WORDS * BITSET_WORD_BITS))
+  ((unsigned) {TBITSET_ELT_WORDS * BITSET_WORD_BITS})
 
 /* Tbitset element.  We use an array of bits.  */
 typedef struct tbitset_elt_struct
index 7c91b29f30088036ef82f43ec2e9b32699c4990f..0edcece393eb72e4197db7b5ef0ea028ec537e35 100644 (file)
@@ -132,7 +132,7 @@ bitsetv_dump (FILE *file, char const *title, char const *subtitle,
   fprintf (file, "%s\n", title);
   for (bitset_windex i = 0; bsetv[i]; i++)
     {
-      fprintf (file, "%s %lu\n", subtitle, (unsigned long) i);
+      fprintf (file, "%s %lu\n", subtitle, (unsigned long) {i});
       bitset_dump (file, bsetv[i]);
     }
 
@@ -145,7 +145,7 @@ debug_bitsetv (bitsetv bsetv)
 {
   for (bitset_windex i = 0; bsetv[i]; i++)
     {
-      fprintf (stderr, "%lu: ", (unsigned long) i);
+      fprintf (stderr, "%lu: ", (unsigned long) {i});
       debug_bitset (bsetv[i]);
     }
 
@@ -184,7 +184,7 @@ bitsetv_matrix_dump (FILE *out, const char *title, bitsetv bset)
   /* Contents. */
   for (bitset_bindex i = 0; bset[i]; ++i)
     {
-      fprintf (out, "%2lu|", (unsigned long) i);
+      fprintf (out, "%2lu|", (unsigned long) {i});
       for (bitset_bindex j = 0; j < hsize; ++j)
         fputs (bitset_test (bset[i], j) ? "1" : " ", out);
       fputs ("|\n", out);
index 7c8c34f574c0d026fc3d102759337e3efea7815a..fbb38d7ab08d026d62f8a9cb000f43cd83cf0aa0 100644 (file)
@@ -57,7 +57,7 @@
     && (~ (x) == (sizeof (x) < sizeof (int) \
                   ? - (1 << (sizeof (x) * CHAR_BIT)) \
                   : 0))) \
-   ? UINTMAX_MAX : (uintmax_t) {x})
+   ? UINTMAX_MAX : (uintmax_t) {(x)})
 
 /* Extract the top bit of X as an uintmax_t value.  */
 #define EXTRACT_TOP_BIT(x) ((x) \
index 894d4d965253635e4011a390d090a429879838fd..af84cbbf09818fdd32dd8657fa09e430728ca5f6 100644 (file)
@@ -119,35 +119,37 @@ dcgettext (const char *domain, const char *msgid, int category)
 #   pragma GCC diagnostic pop
 #  endif
 # else
-/* The casts to 'const char *' serve the purpose of producing warnings
+/* The 'const char *' compound literals produce warnings
    for invalid uses of the value returned from these functions.  */
 #  undef gettext
-#  define gettext(Msgid) ((const char *) (Msgid))
+#  define gettext(Msgid) ((const char *) {(Msgid)})
 #  undef dgettext
-#  define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid))
+#  define dgettext(Domainname, Msgid) \
+     ((void) (const char *) {(Domainname)}, gettext (Msgid))
 #  undef dcgettext
 #  define dcgettext(Domainname, Msgid, Category) \
-     ((void) (Category), dgettext (Domainname, Msgid))
+     ((void) (const char *) {(Category)}, dgettext (Domainname, Msgid))
 # endif
 # undef ngettext
 # define ngettext(Msgid1, Msgid2, N) \
     ((N) == 1 \
-     ? ((void) (Msgid2), (const char *) (Msgid1)) \
-     : ((void) (Msgid1), (const char *) (Msgid2)))
+     ? ((void) (Msgid2), (const char *) {(Msgid1)}) \
+     : ((void) (Msgid1), (const char *) {(Msgid2)}))
 # undef dngettext
 # define dngettext(Domainname, Msgid1, Msgid2, N) \
-    ((void) (Domainname), ngettext (Msgid1, Msgid2, N))
+    ((void) (const char *) {(Domainname)}, ngettext (Msgid1, Msgid2, N))
 # undef dcngettext
 # define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
-    ((void) (Category), dngettext (Domainname, Msgid1, Msgid2, N))
+    ((void) (const char *) {(Category)}, \
+     dngettext (Domainname, Msgid1, Msgid2, N))
 # undef textdomain
-# define textdomain(Domainname) ((const char *) (Domainname))
+# define textdomain(Domainname) ((const char *) {(Domainname)})
 # undef bindtextdomain
 # define bindtextdomain(Domainname, Dirname) \
-    ((void) (Domainname), (const char *) (Dirname))
+    ((void) (const char *) {(Domainname)}, (const char *) {(Dirname)})
 # undef bind_textdomain_codeset
 # define bind_textdomain_codeset(Domainname, Codeset) \
-    ((void) (Domainname), (const char *) (Codeset))
+    ((void) (const char *) {(Domainname)}, (const char *) {(Codeset)})
 
 #endif
 
index 071795b1e12c5cf68cc3a99c0775ff3077aefd7d..08e241b3985c61a921464f0645655917df9ed4df 100644 (file)
@@ -534,7 +534,7 @@ gl_tree_nx_add_first (gl_list_t list, const void *elt)
   new_node->h.hashcode =
     (list->base.hashcode_fn != NULL
      ? list->base.hashcode_fn (new_node->value)
-     : (size_t)(uintptr_t) new_node->value);
+     : (size_t) {(uintptr_t) new_node->value});
 #endif
 
   /* Add it to the tree.  */
@@ -597,7 +597,7 @@ gl_tree_nx_add_last (gl_list_t list, const void *elt)
   new_node->h.hashcode =
     (list->base.hashcode_fn != NULL
      ? list->base.hashcode_fn (new_node->value)
-     : (size_t)(uintptr_t) new_node->value);
+     : (size_t) {(uintptr_t) new_node->value});
 #endif
 
   /* Add it to the tree.  */
@@ -661,7 +661,7 @@ gl_tree_nx_add_before (gl_list_t list, gl_list_node_t node, const void *elt)
   new_node->h.hashcode =
     (list->base.hashcode_fn != NULL
      ? list->base.hashcode_fn (new_node->value)
-     : (size_t)(uintptr_t) new_node->value);
+     : (size_t) {(uintptr_t) new_node->value});
 #endif
 
   /* Add it to the tree.  */
@@ -726,7 +726,7 @@ gl_tree_nx_add_after (gl_list_t list, gl_list_node_t node, const void *elt)
   new_node->h.hashcode =
     (list->base.hashcode_fn != NULL
      ? list->base.hashcode_fn (new_node->value)
-     : (size_t)(uintptr_t) new_node->value);
+     : (size_t) {(uintptr_t) new_node->value});
 #endif
 
   /* Add it to the tree.  */
index 41c1785252a0cb4b528660e8033286b9e98ebd02..9fa25cf75a7f302affe205e66b267b84eab528a8 100644 (file)
@@ -123,7 +123,7 @@ gl_linked_nx_create (gl_list_implementation_t implementation,
       node->h.hashcode =
         (list->base.hashcode_fn != NULL
          ? list->base.hashcode_fn (node->value)
-         : (size_t)(uintptr_t) node->value);
+         : (size_t) {(uintptr_t) node->value});
 
       /* Add node to the hash table.  */
       if (add_to_bucket (list, node) < 0)
@@ -182,7 +182,7 @@ gl_linked_node_nx_set_value (_GL_ATTRIBUTE_MAYBE_UNUSED gl_list_t list,
       size_t new_hashcode =
         (list->base.hashcode_fn != NULL
          ? list->base.hashcode_fn (elt)
-         : (size_t)(uintptr_t) elt);
+         : (size_t) {(uintptr_t) elt});
 
       if (new_hashcode != node->h.hashcode)
         {
@@ -297,7 +297,7 @@ gl_linked_nx_set_at (gl_list_t list, size_t position, const void *elt)
       size_t new_hashcode =
         (list->base.hashcode_fn != NULL
          ? list->base.hashcode_fn (elt)
-         : (size_t)(uintptr_t) elt);
+         : (size_t) {(uintptr_t) elt});
 
       if (new_hashcode != node->h.hashcode)
         {
@@ -341,7 +341,7 @@ gl_linked_search_from_to (gl_list_t list, size_t start_index, size_t end_index,
     size_t hashcode =
       (list->base.hashcode_fn != NULL
        ? list->base.hashcode_fn (elt)
-       : (size_t)(uintptr_t) elt);
+       : (size_t) {(uintptr_t) elt});
     size_t bucket = hashcode % list->table_size;
     gl_listelement_equals_fn equals = list->base.equals_fn;
 
@@ -495,7 +495,7 @@ gl_linked_indexof_from_to (gl_list_t list, size_t start_index, size_t end_index,
     size_t hashcode =
       (list->base.hashcode_fn != NULL
        ? list->base.hashcode_fn (elt)
-       : (size_t)(uintptr_t) elt);
+       : (size_t) {(uintptr_t) elt});
     size_t bucket = hashcode % list->table_size;
     gl_listelement_equals_fn equals = list->base.equals_fn;
 
@@ -616,7 +616,7 @@ gl_linked_nx_add_first (gl_list_t list, const void *elt)
   node->h.hashcode =
     (list->base.hashcode_fn != NULL
      ? list->base.hashcode_fn (node->value)
-     : (size_t)(uintptr_t) node->value);
+     : (size_t) {(uintptr_t) node->value});
 
   /* Add node to the hash table.  */
   if (add_to_bucket (list, node) < 0)
@@ -654,7 +654,7 @@ gl_linked_nx_add_last (gl_list_t list, const void *elt)
   node->h.hashcode =
     (list->base.hashcode_fn != NULL
      ? list->base.hashcode_fn (node->value)
-     : (size_t)(uintptr_t) node->value);
+     : (size_t) {(uintptr_t) node->value});
 
   /* Add node to the hash table.  */
   if (add_to_bucket (list, node) < 0)
@@ -692,7 +692,7 @@ gl_linked_nx_add_before (gl_list_t list, gl_list_node_t node, const void *elt)
   new_node->h.hashcode =
     (list->base.hashcode_fn != NULL
      ? list->base.hashcode_fn (new_node->value)
-     : (size_t)(uintptr_t) new_node->value);
+     : (size_t) {(uintptr_t) new_node->value});
 
   /* Add new_node to the hash table.  */
   if (add_to_bucket (list, new_node) < 0)
@@ -730,7 +730,7 @@ gl_linked_nx_add_after (gl_list_t list, gl_list_node_t node, const void *elt)
   new_node->h.hashcode =
     (list->base.hashcode_fn != NULL
      ? list->base.hashcode_fn (new_node->value)
-     : (size_t)(uintptr_t) new_node->value);
+     : (size_t) {(uintptr_t) new_node->value});
 
   /* Add new_node to the hash table.  */
   if (add_to_bucket (list, new_node) < 0)
@@ -773,7 +773,7 @@ gl_linked_nx_add_at (gl_list_t list, size_t position, const void *elt)
   new_node->h.hashcode =
     (list->base.hashcode_fn != NULL
      ? list->base.hashcode_fn (new_node->value)
-     : (size_t)(uintptr_t) new_node->value);
+     : (size_t) {(uintptr_t) new_node->value});
 
   /* Add new_node to the hash table.  */
   if (add_to_bucket (list, new_node) < 0)
index 22007b21e1600e5c0711fbd61ed84ca7267a622d..7d0a003d9cd7c553d6509900906b1a0a9aa821fc 100644 (file)
@@ -779,7 +779,7 @@ gl_tree_nx_add_first (gl_list_t list, const void *elt)
   new_node->h.hashcode =
     (list->base.hashcode_fn != NULL
      ? list->base.hashcode_fn (new_node->value)
-     : (size_t)(uintptr_t) new_node->value);
+     : (size_t) {(uintptr_t) new_node->value});
 #endif
 
   /* Add it to the tree.  */
@@ -840,7 +840,7 @@ gl_tree_nx_add_last (gl_list_t list, const void *elt)
   new_node->h.hashcode =
     (list->base.hashcode_fn != NULL
      ? list->base.hashcode_fn (new_node->value)
-     : (size_t)(uintptr_t) new_node->value);
+     : (size_t) {(uintptr_t) new_node->value});
 #endif
 
   /* Add it to the tree.  */
@@ -901,7 +901,7 @@ gl_tree_nx_add_before (gl_list_t list, gl_list_node_t node, const void *elt)
   new_node->h.hashcode =
     (list->base.hashcode_fn != NULL
      ? list->base.hashcode_fn (new_node->value)
-     : (size_t)(uintptr_t) new_node->value);
+     : (size_t) {(uintptr_t) new_node->value});
 #endif
 
   /* Add it to the tree.  */
@@ -956,7 +956,7 @@ gl_tree_nx_add_after (gl_list_t list, gl_list_node_t node, const void *elt)
   new_node->h.hashcode =
     (list->base.hashcode_fn != NULL
      ? list->base.hashcode_fn (new_node->value)
-     : (size_t)(uintptr_t) new_node->value);
+     : (size_t) {(uintptr_t) new_node->value});
 #endif
 
   /* Add it to the tree.  */
index ac0ca621548a847a95b280e4be11b9fea912eec4..edc5ce2b1051f0a4a279ca47db9e2d5f4149d136 100644 (file)
@@ -75,7 +75,7 @@ gl_tree_node_nx_set_value (_GL_ATTRIBUTE_MAYBE_UNUSED gl_list_t list,
       size_t new_hashcode =
         (list->base.hashcode_fn != NULL
          ? list->base.hashcode_fn (elt)
-         : (size_t)(uintptr_t) elt);
+         : (size_t) {(uintptr_t) elt});
 
       if (new_hashcode != node->h.hashcode)
         {
@@ -216,7 +216,7 @@ gl_tree_nx_set_at (gl_list_t list, size_t position, const void *elt)
       size_t new_hashcode =
         (list->base.hashcode_fn != NULL
          ? list->base.hashcode_fn (elt)
-         : (size_t)(uintptr_t) elt);
+         : (size_t) {(uintptr_t) elt});
 
       if (new_hashcode != node->h.hashcode)
         {
index b77d56cebc04ae75679ecc0c132e9ef381e91f35..665ecead661b395877a0955afc0bf5e0c684d6ed 100644 (file)
@@ -289,7 +289,7 @@ add_nodes_to_buckets (gl_list_t list)
       node->h.hashcode =
         (list->base.hashcode_fn != NULL
          ? list->base.hashcode_fn (node->value)
-         : (size_t)(uintptr_t) node->value);
+         : (size_t) {(uintptr_t) node->value});
       if (add_to_bucket (list, node) < 0)
         goto fail;
       /* Descend on right branch.  */
index c28ff61c852edc9fc9fd92588f46161253c748d0..3f53f8bb0140b8f2f7f6b615581908fdf9d38d43 100644 (file)
@@ -29,7 +29,7 @@ gl_tree_search_from_to (gl_list_t list, size_t start_index, size_t end_index,
     size_t hashcode =
       (list->base.hashcode_fn != NULL
        ? list->base.hashcode_fn (elt)
-       : (size_t)(uintptr_t) elt);
+       : (size_t) {(uintptr_t) elt});
     size_t bucket = hashcode % list->table_size;
     gl_listelement_equals_fn equals = list->base.equals_fn;
 
@@ -63,7 +63,7 @@ gl_tree_search_from_to (gl_list_t list, size_t start_index, size_t end_index,
                           const void *nodes_elt;
                           if (gl_oset_search_atleast (nodes,
                                                       compare_position_threshold,
-                                                      (void *)(uintptr_t)start_index,
+                                                      (void *)(uintptr_t) {start_index},
                                                       &nodes_elt))
                             {
                               node = (gl_list_node_t) nodes_elt;
index b9d36c9599a2143229d8e3eca83121e045a5463f..217b2d24efc644152f1e44ede9a209ef70118f9f 100644 (file)
@@ -44,7 +44,7 @@ struct gl_list_impl
 
 /* struct gl_list_node_impl doesn't exist here.  The pointers are actually
    indices + 1.  */
-#define INDEX_TO_NODE(index) (gl_list_node_t)(uintptr_t)(size_t)((index) + 1)
+#define INDEX_TO_NODE(index) (gl_list_node_t)(uintptr_t) {(index) + 1}
 #define NODE_TO_INDEX(node) ((uintptr_t)(node) - 1)
 
 static gl_list_t
index 821b47dc822cf20c39af05ffad38a157079d360b..0d43fcae16b250bdde2577a9a7c4984d4e528377 100644 (file)
@@ -47,7 +47,7 @@ struct gl_list_impl
 
 /* struct gl_list_node_impl doesn't exist here.  The pointers are actually
    indices + 1.  */
-#define INDEX_TO_NODE(index) (gl_list_node_t)(uintptr_t)(size_t)((index) + 1)
+#define INDEX_TO_NODE(index) (gl_list_node_t)(uintptr_t) {(index) + 1}
 #define NODE_TO_INDEX(node) ((uintptr_t)(node) - 1)
 
 static gl_list_t
index 03057a3de436dc8a21d4f682a14b1979e3449b8f..15985156419f224245361e7a8aeeadb6260805a3 100644 (file)
@@ -101,7 +101,7 @@ gl_hash_search (gl_map_t map, const void *key, const void **valuep)
   size_t hashcode =
     (map->hashcode_fn != NULL
      ? map->hashcode_fn (key)
-     : (size_t)(uintptr_t) key);
+     : (size_t) {(uintptr_t) key});
   size_t bucket = hashcode % map->table_size;
   gl_mapkey_equals_fn equals = map->base.equals_fn;
 
@@ -127,7 +127,7 @@ gl_hash_nx_getput (gl_map_t map, const void *key, const void *value,
   size_t hashcode =
     (map->hashcode_fn != NULL
      ? map->hashcode_fn (key)
-     : (size_t)(uintptr_t) key);
+     : (size_t) {(uintptr_t) key});
   size_t bucket = hashcode % map->table_size;
   gl_mapkey_equals_fn equals = map->base.equals_fn;
 
@@ -174,7 +174,7 @@ gl_hash_getremove (gl_map_t map, const void *key, const void **oldvaluep)
   size_t hashcode =
     (map->hashcode_fn != NULL
      ? map->hashcode_fn (key)
-     : (size_t)(uintptr_t) key);
+     : (size_t) {(uintptr_t) key});
   size_t bucket = hashcode % map->table_size;
   gl_mapkey_equals_fn equals = map->base.equals_fn;
 
index 945ce46d8d8068b5787f2fc1c09c8e46bb141fb3..5d56b298e1d58eaad2d121cbb6edfcf496d27774 100644 (file)
@@ -98,7 +98,7 @@ gl_hash_search (gl_set_t set, const void *elt)
   size_t hashcode =
     (set->hashcode_fn != NULL
      ? set->hashcode_fn (elt)
-     : (size_t)(uintptr_t) elt);
+     : (size_t) {(uintptr_t) elt});
   size_t bucket = hashcode % set->table_size;
   gl_setelement_equals_fn equals = set->base.equals_fn;
 
@@ -120,7 +120,7 @@ gl_hash_nx_add (gl_set_t set, const void *elt)
   size_t hashcode =
     (set->hashcode_fn != NULL
      ? set->hashcode_fn (elt)
-     : (size_t)(uintptr_t) elt);
+     : (size_t) {(uintptr_t) elt});
   size_t bucket = hashcode % set->table_size;
   gl_setelement_equals_fn equals = set->base.equals_fn;
 
@@ -162,7 +162,7 @@ gl_hash_remove (gl_set_t set, const void *elt)
   size_t hashcode =
     (set->hashcode_fn != NULL
      ? set->hashcode_fn (elt)
-     : (size_t)(uintptr_t) elt);
+     : (size_t) {(uintptr_t) elt});
   size_t bucket = hashcode % set->table_size;
   gl_setelement_equals_fn equals = set->base.equals_fn;
 
index d1839643cacde107d509dd80837f49db4ef9d38d..fd9e7861280cfd064f0d493591444d457d8e7765 100644 (file)
@@ -126,7 +126,7 @@ gl_linkedhash_search (gl_map_t map, const void *key, const void **valuep)
   size_t hashcode =
     (map->hashcode_fn != NULL
      ? map->hashcode_fn (key)
-     : (size_t)(uintptr_t) key);
+     : (size_t) {(uintptr_t) key});
   size_t bucket = hashcode % map->table_size;
   gl_mapkey_equals_fn equals = map->base.equals_fn;
 
@@ -152,7 +152,7 @@ gl_linkedhash_nx_getput (gl_map_t map, const void *key, const void *value,
   size_t hashcode =
     (map->hashcode_fn != NULL
      ? map->hashcode_fn (key)
-     : (size_t)(uintptr_t) key);
+     : (size_t) {(uintptr_t) key});
   size_t bucket = hashcode % map->table_size;
   gl_mapkey_equals_fn equals = map->base.equals_fn;
 
@@ -203,7 +203,7 @@ gl_linkedhash_getremove (gl_map_t map, const void *key, const void **oldvaluep)
   size_t hashcode =
     (map->hashcode_fn != NULL
      ? map->hashcode_fn (key)
-     : (size_t)(uintptr_t) key);
+     : (size_t) {(uintptr_t) key});
   size_t bucket = hashcode % map->table_size;
   gl_mapkey_equals_fn equals = map->base.equals_fn;
 
index 97f8efc6828f4c884dd79a7518ef516eae2e755d..ec38bb53d26aaace9eec1b1a27d34cf92a04ee7a 100644 (file)
@@ -123,7 +123,7 @@ gl_linkedhash_search (gl_set_t set, const void *elt)
   size_t hashcode =
     (set->hashcode_fn != NULL
      ? set->hashcode_fn (elt)
-     : (size_t)(uintptr_t) elt);
+     : (size_t) {(uintptr_t) elt});
   size_t bucket = hashcode % set->table_size;
   gl_setelement_equals_fn equals = set->base.equals_fn;
 
@@ -145,7 +145,7 @@ gl_linkedhash_nx_add (gl_set_t set, const void *elt)
   size_t hashcode =
     (set->hashcode_fn != NULL
      ? set->hashcode_fn (elt)
-     : (size_t)(uintptr_t) elt);
+     : (size_t) {(uintptr_t) elt});
   size_t bucket = hashcode % set->table_size;
   gl_setelement_equals_fn equals = set->base.equals_fn;
 
@@ -191,7 +191,7 @@ gl_linkedhash_remove (gl_set_t set, const void *elt)
   size_t hashcode =
     (set->hashcode_fn != NULL
      ? set->hashcode_fn (elt)
-     : (size_t)(uintptr_t) elt);
+     : (size_t) {(uintptr_t) elt});
   size_t bucket = hashcode % set->table_size;
   gl_setelement_equals_fn equals = set->base.equals_fn;
 
index e4ce87e3380b834b0cc97983996b9969e76648ff..f882ec0fb9e89762713285accabe0fab12c54536 100644 (file)
@@ -40,7 +40,7 @@ struct gl_list_impl
    indices + 1.  (We don't use the whole list's gl_list_node_t implementation,
    because gl_sublist_next_node and gl_sublist_previous_node would not be easy
    to implement with this choice.)  */
-#define INDEX_TO_NODE(index) (gl_list_node_t)(uintptr_t)(size_t)((index) + 1)
+#define INDEX_TO_NODE(index) (gl_list_node_t)(uintptr_t) {(index) + 1}
 #define NODE_TO_INDEX(node) ((uintptr_t)(node) - 1)
 
 static gl_list_t
index f8306576693a58b8f1e1be2f978a541104ff1344..06ca8afdcf1e4eeeed41d17fa888250afa708e1c 100644 (file)
@@ -118,7 +118,7 @@ extern _Noreturn void gl_thread_exit (void *return_value);
     ((void) (struct { void (*prepare_func) (void); \
                       void (*parent_func) (void); \
                       void (*child_func) (void); }) \
-            { PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC }, \
+            { (PREPARE_FUNC), (PARENT_FUNC), (CHILD_FUNC) }, \
      0)
 
 # ifdef __cplusplus
@@ -249,7 +249,7 @@ extern const gl_thread_t gl_null_thread;
      ((void) (struct { void (*prepare_func) (void); \
                        void (*parent_func) (void); \
                        void (*child_func) (void); }) \
-             { PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC }, \
+             { (PREPARE_FUNC), (PARENT_FUNC), (CHILD_FUNC) }, \
       0)
 # endif
 
@@ -280,7 +280,7 @@ typedef glwthread_thread_t gl_thread_t;
 # define glthread_sigmask(HOW, SET, OSET) \
     /* unsupported */ \
     ((void) (struct { int how; sigset_t const *set; sigset_t *oset; }) \
-            { HOW, SET, OSET }, \
+            { (HOW), (SET), (OSET) }, \
      0)
 # define glthread_join(THREAD, RETVALP) \
     glwthread_thread_join (THREAD, RETVALP)
@@ -294,7 +294,7 @@ typedef glwthread_thread_t gl_thread_t;
     ((void) (struct { void (*prepare_func) (void); \
                       void (*parent_func) (void); \
                       void (*child_func) (void); }) \
-            { PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC }, \
+            { (PREPARE_FUNC), (PARENT_FUNC), (CHILD_FUNC) }, \
      0)
 
 # ifdef __cplusplus
@@ -318,7 +318,7 @@ typedef int gl_thread_t;
      ENOSYS)
 # define glthread_sigmask(HOW, SET, OSET) \
     ((void) (struct { int how; sigset_t const *set; sigset_t *oset; }) \
-            { HOW, SET, OSET }, \
+            { (HOW), (SET), (OSET) }, \
      0)
 # define glthread_join(THREAD, RETVALP) \
     ((void) (struct { gl_thread_t thread; void **retvalp; }) \
@@ -328,12 +328,12 @@ typedef int gl_thread_t;
 # define gl_thread_self_pointer() \
     ((void *) gl_thread_self ())
 # define gl_thread_exit(RETVAL) \
-    ((void) (int) { RETVAL })
+    ((void) (int) {(RETVAL)})
 # define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) \
     ((void) (struct { void (*prepare_func) (void); \
                       void (*parent_func) (void); \
                       void (*child_func) (void); }) \
-            { PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC }, \
+            { (PREPARE_FUNC), (PARENT_FUNC), (CHILD_FUNC) }, \
      0)
 
 #endif
index 70c5ecb42e37b5e9860cf0c391c2446414214dfb..8a82d8d08305ce606693bc555c16a98289c6ba43 100644 (file)
 # if (__GNUC__ >= 4) || (__clang_major__ >= 4)
    /* GCC >= 4.0 and clang provide a type-generic built-in for isnan.  */
 #  undef isnand
-#  define isnand(x) __builtin_isnan ((double)(x))
+#  define isnand(x) __builtin_isnan ((double) {(x)})
 # else
 #  undef isnand
-#  define isnand(x) isnan ((double)(x))
+#  define isnand(x) isnan ((double) {(x)})
 # endif
 #else
 /* Test whether X is a NaN.  */
index 0ed965dbe61ab9e9f66052e2b2512eb79f9fa9de..860c9e516bdd0d5f9ded0b5b798b1caa63aed286 100644 (file)
    /* GCC >= 4.0 and clang provide a type-generic built-in for isnan.
       GCC >= 4.0 also provides __builtin_isnanf, but clang doesn't.  */
 #  undef isnanf
-#  define isnanf(x) __builtin_isnan ((float)(x))
+#  define isnanf(x) __builtin_isnan ((float) {(x)})
 # elif defined isnan
 #  undef isnanf
-#  define isnanf(x) isnan ((float)(x))
+#  define isnanf(x) isnan ((float) {(x)})
 # endif
 #else
 /* Test whether X is a NaN.  */
index 640f959e5046f58bb0815a802d04577e94763c8f..b7e1344c936b931bcec7b7972adfface85cd601d 100644 (file)
    /* GCC >= 4.0 and clang provide a type-generic built-in for isnan.
       GCC >= 4.0 also provides __builtin_isnanl, but clang doesn't.  */
 #  undef isnanl
-#  define isnanl(x) __builtin_isnan ((long double)(x))
+#  define isnanl(x) __builtin_isnan ((long double) {(x)})
 # elif defined isnan
 #  undef isnanl
-#  define isnanl(x) isnan ((long double)(x))
+#  define isnanl(x) isnan ((long double) {(x)})
 # endif
 #else
 /* Test whether X is a NaN.  */
index 5fb955e5f7d9c522452a7c27e3c32bbcb1ce522a..6d2156d4116cb664660f568b4556cacf6e434144 100644 (file)
@@ -102,7 +102,7 @@ extern void *mmalloca (size_t n)
    on the stack.  N and S should be nonnegative and free of side effects.
    The array must be freed using freea() before the function returns.  */
 #define nmalloca(n, s) \
-  (xalloc_oversized (n, s) ? NULL : malloca ((n) * (size_t) {s}))
+  (xalloc_oversized (n, s) ? NULL : malloca ((n) * (size_t) {(s)}))
 
 
 #ifdef __cplusplus
index 216c203a60c45ee2c7f83dcb46a9f69f792a316c..89dfb9307d48d416e976f630af94e935e4504efe 100644 (file)
@@ -2588,10 +2588,10 @@ _GL_EXTERN_C int isnand (double x);
 #   if (__GNUC__ >= 4) || (__clang_major__ >= 4)
     /* GCC >= 4.0 and clang provide a type-generic built-in for isnan.  */
 #    undef isnand
-#    define isnand(x) __builtin_isnan ((double)(x))
+#    define isnand(x) __builtin_isnan ((double) {(x)})
 #   elif !defined HAVE_ISNAND_NOLIBM
 #    undef isnand
-#    define isnand(x) isnan ((double)(x))
+#    define isnand(x) isnan ((double) {(x)})
 #   endif
 #  endif
 # else
@@ -2638,7 +2638,7 @@ _GL_EXTERN_C int rpl_isnanf (float x);
 #   define _gl_isnanf(x) rpl_isnanf (x)
 #  endif
 #  if @HAVE_ISNAND@ && (__GNUC__ >= 4) || (__clang_major__ >= 4)
-#   define _gl_isnand(x) __builtin_isnan ((double)(x))
+#   define _gl_isnand(x) __builtin_isnan ((double) {(x)})
 #  else
 _GL_EXTERN_C int rpl_isnand (double x);
 #   define _gl_isnand(x) rpl_isnand (x)
@@ -2672,9 +2672,11 @@ template <> inline int isnan<long double> (long double x) { return __builtin_isn
 #  else
 #   undef isnan
 #   define isnan(x) \
-      (sizeof (x) == sizeof (long double) ? __builtin_isnan ((long double)(x)) : \
-       sizeof (x) == sizeof (double) ? __builtin_isnan ((double)(x)) : \
-       __builtin_isnan ((float)(x)))
+      (sizeof (x) == sizeof (long double) \
+       ? __builtin_isnan ((long double) {(x)}) \
+       : sizeof (x) == sizeof (double) \
+       ? __builtin_isnan ((double) {(x)}) \
+       : __builtin_isnan ((float) {(x)}))
 #  endif
 # endif
 # if @GNULIB_ISNAN@ && defined __cplusplus
index fe34886140756c20db3e7dcd2ad15676ff55047b..ba3a9f4bd6aaa670bfb15bccfa11fa3bf9f0fdfa 100644 (file)
--- a/lib/md4.c
+++ b/lib/md4.c
@@ -199,7 +199,7 @@ md4_process_bytes (void const *restrict buffer, size_t len,
 #define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
 #define G(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z)))
 #define H(x, y, z) ((x) ^ (y) ^ (z))
-#define rol(x, n) (((x) << (n)) | ((uint32_t) (x) >> (32 - (n))))
+#define rol(x, n) (((x) << (n)) | ((uint32_t) {(x)} >> (32 - (n))))
 #define R1(a,b,c,d,k,s) a=rol(a+F(b,c,d)+x[k],s);
 #define R2(a,b,c,d,k,s) a=rol(a+G(b,c,d)+x[k]+K1,s);
 #define R3(a,b,c,d,k,s) a=rol(a+H(b,c,d)+x[k]+K2,s);
index 1d7d49fd390ccad7619eb048278bb3588d97d82d..f01b61ebe50219a1f624b087cb6434f7fd8d4e42 100644 (file)
@@ -155,7 +155,7 @@ pagealign_alloc (size_t size)
       if (page_info_map == NULL)
         page_info_map =
           gl_map_create_empty (GL_HASH_MAP, NULL, NULL, NULL, NULL);
-      gl_map_put (page_info_map, ret, (void *) (uintptr_t) size);
+      gl_map_put (page_info_map, ret, (void *) (uintptr_t) {size});
       break;
       #else
       errno = ENOSYS;
@@ -248,7 +248,7 @@ pagealign_free (void *aligned_ptr)
         if (page_info_map == NULL
             || !gl_map_getremove (page_info_map, aligned_ptr, &value))
           abort ();
-        if (munmap (aligned_ptr, (size_t) (uintptr_t) value) < 0)
+        if (munmap (aligned_ptr, (size_t) {(uintptr_t) value}) < 0)
           error (EXIT_FAILURE, errno, "Failed to unmap memory");
       }
       break;
index bb7aa2af29346be204233be3361ce0dff4995f24..150e38ea47af936fac71e8ba885a8a63b43d2ce5 100644 (file)
@@ -240,7 +240,7 @@ sha1_process_block (void const *restrict buffer, size_t len,
   ctx->total[0] += lolen;
   ctx->total[1] += (len >> 31 >> 1) + (ctx->total[0] < lolen);
 
-#define rol(x, n) (((x) << (n)) | ((uint32_t) (x) >> (32 - (n))))
+#define rol(x, n) (((x) << (n)) | ((uint32_t) {(x)} >> (32 - (n))))
 
 #define M(I) ( tm =   x[I&0x0f] ^ x[(I-14)&0x0f] \
                     ^ x[(I-8)&0x0f] ^ x[(I-3)&0x0f] \
index f04f6e9ccf1e92e56dfe1d24d92774240345bbd5..603b7eb768b797d8dd8a69cdb00f043babc418dd 100644 (file)
@@ -718,7 +718,7 @@ allocate_block_from_pool (size_t size, struct page_pool *pool)
     gl_oset_iterator_t iter =
       gl_oset_iterator_atleast (pool->managed_pages,
                                 page_free_space_is_at_least,
-                                (void *) (uintptr_t) size);
+                                (void *) (uintptr_t) {size});
     const void *elt;
     while (gl_oset_iterator_next (&iter, &elt))
       {
index 2f9c79181514704d383dc1f2fbf1a6724118bd89..9274cb8182c65b16269bf2c43f4eb53deec9ab6c 100644 (file)
--- a/lib/u64.h
+++ b/lib/u64.h
@@ -46,10 +46,10 @@ extern "C" {
 /* Native implementations are trivial.  See below for comments on what
    these operations do.  */
 typedef uint64_t u64;
-# define u64hilo(hi, lo) ((u64) (((u64) (hi) << 32) + (lo)))
+# define u64hilo(hi, lo) ((u64) {((u64) {(hi)} << 32) + (lo)})
 # define u64init(hi, lo) u64hilo (hi, lo)
-# define u64lo(x) ((u64) (x))
-# define u64getlo(x) ((uint32_t) ((x) & UINT32_MAX))
+# define u64lo(x) ((u64) {(x)})
+# define u64getlo(x) ((uint32_t) {(x) & UINT32_MAX})
 # define u64size(x) u64lo (x)
 # define u64not(x) (~(x))
 # define u64lt(x, y) ((x) < (y))