Re: incorrect use of 'pure' attribute

Bruno Haible via Gnulib discussion list <[email protected]>
Newsgroups gmane.comp.lib.gnulib.bugs
Message-ID <5054201.anssfa2V6d@cagnes>
Paul Eggert wrote:
> > +static bool _GL_ATTRIBUTE_REPRODUCIBLE
> 
> Shouldn't _GL_ATTRIBUTE_REPRODUCIBLE come before 'static'?

Indeed, you're right. The only reason that I didn't see a compilation error from
my patch was that gcc and clang don't support [[reproducible]] yet.



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

	Fix position of _GL_ATTRIBUTE_REPRODUCIBLE in last commit.
	Reported by Paul Eggert in
	<https://lists.gnu.org/archive/html/bug-gnulib/2026-08/msg00136.html>.
	* lib/gl_array_omap.c (gl_array_search, gl_array_search_atleast): Put
	_GL_ATTRIBUTE_REPRODUCIBLE before 'static'.
	* lib/gl_array_oset.c (gl_array_search_atleast): Likewise.
	* lib/gl_hash_map.c (gl_hash_search): Likewise.
	* lib/gl_linkedhash_map.c (gl_linkedhash_search): Likewise.

diff --git a/lib/gl_array_omap.c b/lib/gl_array_omap.c
index 0fda12ce7a..24ea6a5d0b 100644
--- a/lib/gl_array_omap.c
+++ b/lib/gl_array_omap.c
@@ -110,7 +110,7 @@ gl_array_indexof (gl_omap_t map, const void *key)
   return (size_t)(-1);
 }
 
-static bool _GL_ATTRIBUTE_REPRODUCIBLE
+_GL_ATTRIBUTE_REPRODUCIBLE static bool
 gl_array_search (gl_omap_t map, const void *key, const void **valuep)
 {
   size_t index = gl_array_indexof (map, key);
@@ -123,7 +123,7 @@ gl_array_search (gl_omap_t map, const void *key, const void **valuep)
     return false;
 }
 
-static bool _GL_ATTRIBUTE_REPRODUCIBLE
+_GL_ATTRIBUTE_REPRODUCIBLE static bool
 gl_array_search_atleast (gl_omap_t map,
                          gl_mapkey_threshold_fn threshold_fn,
                          const void *threshold,
diff --git a/lib/gl_array_oset.c b/lib/gl_array_oset.c
index 03afec519e..e11d53ff8c 100644
--- a/lib/gl_array_oset.c
+++ b/lib/gl_array_oset.c
@@ -161,7 +161,7 @@ gl_array_indexof_atleast (gl_oset_t set,
   return count;
 }
 
-static bool _GL_ATTRIBUTE_REPRODUCIBLE
+_GL_ATTRIBUTE_REPRODUCIBLE static bool
 gl_array_search_atleast (gl_oset_t set,
                          gl_setelement_threshold_fn threshold_fn,
                          const void *threshold,
diff --git a/lib/gl_hash_map.c b/lib/gl_hash_map.c
index 3767b17cae..608c8475cf 100644
--- a/lib/gl_hash_map.c
+++ b/lib/gl_hash_map.c
@@ -95,7 +95,7 @@ gl_hash_size (gl_map_t map)
   return map->count;
 }
 
-static bool _GL_ATTRIBUTE_REPRODUCIBLE
+_GL_ATTRIBUTE_REPRODUCIBLE static bool
 gl_hash_search (gl_map_t map, const void *key, const void **valuep)
 {
   size_t hashcode =
diff --git a/lib/gl_linkedhash_map.c b/lib/gl_linkedhash_map.c
index 3b85099a60..d6530aa0bd 100644
--- a/lib/gl_linkedhash_map.c
+++ b/lib/gl_linkedhash_map.c
@@ -120,7 +120,7 @@ gl_linkedhash_size (gl_map_t map)
   return map->count;
 }
 
-static bool _GL_ATTRIBUTE_REPRODUCIBLE
+_GL_ATTRIBUTE_REPRODUCIBLE static bool
 gl_linkedhash_search (gl_map_t map, const void *key, const void **valuep)
 {
   size_t hashcode =
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.