Paul Eggert wrote:
> I attempted to fix these problems by installing the attached patches.

This produced a compilation error on many platforms:

gcc -std=gnu23 -DHAVE_CONFIG_H -DEXEEXT=\"\" -DEXEEXT=\"\" -DNO_XMALLOC 
-DEXEEXT=\"\" -I. -I../../gllib -I..  -DGNULIB_STRICT_CHECKING=1 -Wall 
-DCONTINUE_AFTER_ASSERT -fvisibility=hidden -g -O2 -MT hamt.o -MD -MP -MF 
$depbase.Tpo -c -o hamt.o ../../gllib/hamt.c &&\
mv -f $depbase.Tpo $depbase.Po
../../gllib/hamt.c: In function 'free_element':
../../gllib/hamt.c:195:24: error: passing argument 1 of 'dec_ref_counter' from 
incompatible pointer type [-Wincompatible-pointer-types]
  195 |   if (dec_ref_counter (&elt->ref_count))
      |                        ^~~~~~~~~~~~~~~
      |                        |
      |                        _Atomic size_t * {aka _Atomic long unsigned int 
*}
../../gllib/hamt.c:87:31: note: expected 'ref_counter *' {aka 'long unsigned 
int *'} but argument is of type '_Atomic size_t *' {aka '_Atomic long unsigned 
int *'}
   87 | dec_ref_counter (ref_counter *counter)
      |                  ~~~~~~~~~~~~~^~~~~~~

Fixed as follows:


2026-08-12  Bruno Haible  <[email protected]>

        hamt: Fix compilation error (regression 2026-08-10).
        * lib/hamt.c (ref_counter): Use GL_HAMT_ATOMIC instead of
        GL_HAMT_THREAD_SAFE.

diff --git a/lib/hamt.c b/lib/hamt.c
index fa4bed98d1..095a47665b 100644
--- a/lib/hamt.c
+++ b/lib/hamt.c
@@ -35,11 +35,7 @@
    A thread must not modify an entry or its children (!) if its
    reference count implies that the entry is shared by at least two
    hamts.  */
-typedef
-#if GL_HAMT_THREAD_SAFE
-_Atomic
-#endif
-size_t ref_counter;
+typedef GL_HAMT_ATOMIC (size_t) ref_counter;
 
 /***************/
 /* Entry Types */




        • Re: incorr... Arsen Arsenović
          • Re: in... Bruno Haible via Gnulib discussion list
            • R... Paul Eggert
            • R... Arsen Arsenović
            • R... Bruno Haible via Gnulib discussion list
            • R... Arsen Arsenović
            • G... Paul Eggert
            • R... Marc Nieper-Wißkirchen via Gnulib discussion list
            • R... Bruno Haible via Gnulib discussion list
            • R... Paul Eggert
            • R... Bruno Haible via Gnulib discussion list
            • R... Bruno Haible via Gnulib discussion list
            • R... Bruno Haible via Gnulib discussion list
            • R... Arsen Arsenović
            • R... Paul Eggert
            • R... Bruno Haible via Gnulib discussion list
  • Re: incorrect use of 'p... Bruno Haible via Gnulib discussion list

Reply via email to