Paul Eggert wrote: > I installed the attached commentary changes. OK, with these definitions of 'pure' and 'const', I can make the change Marc requested - and some more.
2020-10-10 Bruno Haible <br...@clisp.org> *-list, *-oset, *-omap: Avoid possible compiler warnings. Reported by Marc Nieper-Wißkirchen in <https://lists.gnu.org/r/bug-gnulib/2020-10/msg00025.html>. * lib/gl_anylinked_list2.h (gl_linked_iterator, gl_linked_iterator_from_to): Mark as 'pure'. (gl_linked_iterator_free): Mark as 'const'. * lib/gl_anytree_list2.h (gl_tree_size, gl_tree_node_value, gl_tree_search_from_to, gl_tree_indexof_from_to, gl_tree_iterator, gl_tree_iterator_from_to, gl_tree_sortedlist_search, gl_tree_sortedlist_search_from_to, gl_tree_sortedlist_indexof, gl_tree_sortedlist_indexof_from_to): Mark as 'pure'. (gl_tree_iterator_free): Mark as 'const'. * lib/gl_anytree_omap.h (gl_tree_size, gl_tree_iterator): Mark as 'pure'. (gl_tree_iterator_free): Mark as 'const'. * lib/gl_anytree_oset.h (gl_tree_size, gl_tree_next_node, gl_tree_prev_node, gl_tree_iterator): Mark as 'pure'. (gl_tree_iterator_free): Mark as 'const'. * lib/gl_anytreehash_list1.h (node_position, compare_by_position, compare_position_threshold): Mark as 'pure'. * lib/gl_array_list.c (gl_array_size, gl_array_indexof_from_to, gl_array_search_from_to, gl_array_iterator, gl_array_iterator_from_to, gl_array_sortedlist_indexof_from_to, gl_array_sortedlist_indexof, gl_array_sortedlist_search_from_to, gl_array_sortedlist_search): Mark as 'pure'. (gl_array_iterator_free): Mark as 'const'. * lib/gl_array_omap.c (gl_array_size, gl_array_indexof, gl_array_search, gl_array_search_atleast, gl_array_iterator): Mark as 'pure'. (gl_array_iterator_free): Mark as 'const'. * lib/gl_array_oset.c (gl_array_size, gl_array_indexof, gl_array_search, gl_array_indexof_atleast, gl_array_search_atleast, gl_array_iterator, gl_array_iterator_atleast): Mark as 'pure'. (gl_array_iterator_free): Mark as 'const'. * lib/gl_carray_list.c (gl_carray_size, gl_carray_node_value, gl_carray_next_node, gl_carray_previous_node, gl_carray_get_at, gl_carray_indexof_from_to, gl_carray_search_from_to, gl_carray_iterator, gl_carray_iterator_from_to, gl_carray_sortedlist_indexof_from_to, gl_carray_sortedlist_indexof, gl_carray_sortedlist_search_from_to, gl_carray_sortedlist_search): Mark as 'pure'. (gl_carray_iterator_free): Mark as 'const'. 2020-10-10 Bruno Haible <br...@clisp.org> rbtree-list: Avoid possible compiler warnings. This mirrors the change of avltree-list on 2014-09-16. * lib/gl_rbtree_list.c (gl_rbtree_list_check_invariants): Add extern declaration. Add cast to void for ignored value of check_invariants.
>From be744f1e1db0b7dc79f8206fd83918c32fad1d31 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sat, 10 Oct 2020 22:17:15 +0200 Subject: [PATCH 1/2] rbtree-list: Avoid possible compiler warnings. This mirrors the change of avltree-list on 2014-09-16. * lib/gl_rbtree_list.c (gl_rbtree_list_check_invariants): Add extern declaration. Add cast to void for ignored value of check_invariants. --- ChangeLog | 7 +++++++ lib/gl_avltree_list.c | 1 - lib/gl_rbtree_list.c | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b479cf0..869f627 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2020-10-10 Bruno Haible <br...@clisp.org> + + rbtree-list: Avoid possible compiler warnings. + This mirrors the change of avltree-list on 2014-09-16. + * lib/gl_rbtree_list.c (gl_rbtree_list_check_invariants): Add extern + declaration. Add cast to void for ignored value of check_invariants. + 2020-10-10 Paul Eggert <egg...@cs.ucla.edu> attribute: improve const, pure doc diff --git a/lib/gl_avltree_list.c b/lib/gl_avltree_list.c index 35ffec6..600e78b 100644 --- a/lib/gl_avltree_list.c +++ b/lib/gl_avltree_list.c @@ -61,7 +61,6 @@ check_invariants (gl_list_node_t node, gl_list_node_t parent) return 1 + (left_height > right_height ? left_height : right_height); } - void gl_avltree_list_check_invariants (gl_list_t list) { diff --git a/lib/gl_rbtree_list.c b/lib/gl_rbtree_list.c index d79becf..5be225f 100644 --- a/lib/gl_rbtree_list.c +++ b/lib/gl_rbtree_list.c @@ -37,6 +37,8 @@ #include "gl_anytree_list2.h" /* For debugging. */ +extern void gl_rbtree_list_check_invariants (gl_list_t list); + static unsigned int check_invariants (gl_list_node_t node, gl_list_node_t parent) { @@ -64,7 +66,7 @@ void gl_rbtree_list_check_invariants (gl_list_t list) { if (list->root != NULL) - check_invariants (list->root, NULL); + (void) check_invariants (list->root, NULL); } const struct gl_list_implementation gl_rbtree_list_implementation = -- 2.7.4
From a8c6c899b90387bc4424c726e08c9e567c0ecbb5 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sat, 10 Oct 2020 22:52:22 +0200 Subject: [PATCH 2/2] *-list, *-oset, *-omap: Avoid possible compiler warnings. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reported by Marc Nieper-Wißkirchen in <https://lists.gnu.org/r/bug-gnulib/2020-10/msg00025.html>. * lib/gl_anylinked_list2.h (gl_linked_iterator, gl_linked_iterator_from_to): Mark as 'pure'. (gl_linked_iterator_free): Mark as 'const'. * lib/gl_anytree_list2.h (gl_tree_size, gl_tree_node_value, gl_tree_search_from_to, gl_tree_indexof_from_to, gl_tree_iterator, gl_tree_iterator_from_to, gl_tree_sortedlist_search, gl_tree_sortedlist_search_from_to, gl_tree_sortedlist_indexof, gl_tree_sortedlist_indexof_from_to): Mark as 'pure'. (gl_tree_iterator_free): Mark as 'const'. * lib/gl_anytree_omap.h (gl_tree_size, gl_tree_iterator): Mark as 'pure'. (gl_tree_iterator_free): Mark as 'const'. * lib/gl_anytree_oset.h (gl_tree_size, gl_tree_next_node, gl_tree_prev_node, gl_tree_iterator): Mark as 'pure'. (gl_tree_iterator_free): Mark as 'const'. * lib/gl_anytreehash_list1.h (node_position, compare_by_position, compare_position_threshold): Mark as 'pure'. * lib/gl_array_list.c (gl_array_size, gl_array_indexof_from_to, gl_array_search_from_to, gl_array_iterator, gl_array_iterator_from_to, gl_array_sortedlist_indexof_from_to, gl_array_sortedlist_indexof, gl_array_sortedlist_search_from_to, gl_array_sortedlist_search): Mark as 'pure'. (gl_array_iterator_free): Mark as 'const'. * lib/gl_array_omap.c (gl_array_size, gl_array_indexof, gl_array_search, gl_array_search_atleast, gl_array_iterator): Mark as 'pure'. (gl_array_iterator_free): Mark as 'const'. * lib/gl_array_oset.c (gl_array_size, gl_array_indexof, gl_array_search, gl_array_indexof_atleast, gl_array_search_atleast, gl_array_iterator, gl_array_iterator_atleast): Mark as 'pure'. (gl_array_iterator_free): Mark as 'const'. * lib/gl_carray_list.c (gl_carray_size, gl_carray_node_value, gl_carray_next_node, gl_carray_previous_node, gl_carray_get_at, gl_carray_indexof_from_to, gl_carray_search_from_to, gl_carray_iterator, gl_carray_iterator_from_to, gl_carray_sortedlist_indexof_from_to, gl_carray_sortedlist_indexof, gl_carray_sortedlist_search_from_to, gl_carray_sortedlist_search): Mark as 'pure'. (gl_carray_iterator_free): Mark as 'const'. --- ChangeLog | 43 +++++++++++++++++++++++++++++++++++++++++++ lib/gl_anylinked_list2.h | 6 +++--- lib/gl_anytree_list2.h | 22 +++++++++++----------- lib/gl_anytree_omap.h | 8 ++++---- lib/gl_anytree_oset.h | 12 ++++++------ lib/gl_anytreehash_list1.h | 6 +++--- lib/gl_array_list.c | 22 +++++++++++----------- lib/gl_array_omap.c | 14 +++++++------- lib/gl_array_oset.c | 18 +++++++++--------- lib/gl_carray_list.c | 30 +++++++++++++++--------------- 10 files changed, 112 insertions(+), 69 deletions(-) diff --git a/ChangeLog b/ChangeLog index 869f627..1a4d7ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,48 @@ 2020-10-10 Bruno Haible <br...@clisp.org> + *-list, *-oset, *-omap: Avoid possible compiler warnings. + Reported by Marc Nieper-Wißkirchen in + <https://lists.gnu.org/r/bug-gnulib/2020-10/msg00025.html>. + * lib/gl_anylinked_list2.h (gl_linked_iterator, + gl_linked_iterator_from_to): Mark as 'pure'. + (gl_linked_iterator_free): Mark as 'const'. + * lib/gl_anytree_list2.h (gl_tree_size, gl_tree_node_value, + gl_tree_search_from_to, gl_tree_indexof_from_to, gl_tree_iterator, + gl_tree_iterator_from_to, gl_tree_sortedlist_search, + gl_tree_sortedlist_search_from_to, gl_tree_sortedlist_indexof, + gl_tree_sortedlist_indexof_from_to): Mark as 'pure'. + (gl_tree_iterator_free): Mark as 'const'. + * lib/gl_anytree_omap.h (gl_tree_size, gl_tree_iterator): Mark as + 'pure'. + (gl_tree_iterator_free): Mark as 'const'. + * lib/gl_anytree_oset.h (gl_tree_size, gl_tree_next_node, + gl_tree_prev_node, gl_tree_iterator): Mark as 'pure'. + (gl_tree_iterator_free): Mark as 'const'. + * lib/gl_anytreehash_list1.h (node_position, compare_by_position, + compare_position_threshold): Mark as 'pure'. + * lib/gl_array_list.c (gl_array_size, gl_array_indexof_from_to, + gl_array_search_from_to, gl_array_iterator, gl_array_iterator_from_to, + gl_array_sortedlist_indexof_from_to, gl_array_sortedlist_indexof, + gl_array_sortedlist_search_from_to, gl_array_sortedlist_search): Mark as + 'pure'. + (gl_array_iterator_free): Mark as 'const'. + * lib/gl_array_omap.c (gl_array_size, gl_array_indexof, gl_array_search, + gl_array_search_atleast, gl_array_iterator): Mark as 'pure'. + (gl_array_iterator_free): Mark as 'const'. + * lib/gl_array_oset.c (gl_array_size, gl_array_indexof, gl_array_search, + gl_array_indexof_atleast, gl_array_search_atleast, gl_array_iterator, + gl_array_iterator_atleast): Mark as 'pure'. + (gl_array_iterator_free): Mark as 'const'. + * lib/gl_carray_list.c (gl_carray_size, gl_carray_node_value, + gl_carray_next_node, gl_carray_previous_node, gl_carray_get_at, + gl_carray_indexof_from_to, gl_carray_search_from_to, gl_carray_iterator, + gl_carray_iterator_from_to, gl_carray_sortedlist_indexof_from_to, + gl_carray_sortedlist_indexof, gl_carray_sortedlist_search_from_to, + gl_carray_sortedlist_search): Mark as 'pure'. + (gl_carray_iterator_free): Mark as 'const'. + +2020-10-10 Bruno Haible <br...@clisp.org> + rbtree-list: Avoid possible compiler warnings. This mirrors the change of avltree-list on 2014-09-16. * lib/gl_rbtree_list.c (gl_rbtree_list_check_invariants): Add extern diff --git a/lib/gl_anylinked_list2.h b/lib/gl_anylinked_list2.h index 3e01f8f..bc9d5c7 100644 --- a/lib/gl_anylinked_list2.h +++ b/lib/gl_anylinked_list2.h @@ -916,7 +916,7 @@ gl_linked_list_free (gl_list_t list) /* --------------------- gl_list_iterator_t Data Type --------------------- */ -static gl_list_iterator_t +static gl_list_iterator_t _GL_ATTRIBUTE_PURE gl_linked_iterator (gl_list_t list) { gl_list_iterator_t result; @@ -934,7 +934,7 @@ gl_linked_iterator (gl_list_t list) return result; } -static gl_list_iterator_t +static gl_list_iterator_t _GL_ATTRIBUTE_PURE gl_linked_iterator_from_to (gl_list_t list, size_t start_index, size_t end_index) { @@ -1022,7 +1022,7 @@ gl_linked_iterator_next (gl_list_iterator_t *iterator, return false; } -static void +static void _GL_ATTRIBUTE_CONST gl_linked_iterator_free (gl_list_iterator_t *iterator _GL_ATTRIBUTE_MAYBE_UNUSED) { } diff --git a/lib/gl_anytree_list2.h b/lib/gl_anytree_list2.h index 939b797..3cb3422 100644 --- a/lib/gl_anytree_list2.h +++ b/lib/gl_anytree_list2.h @@ -53,13 +53,13 @@ gl_tree_nx_create_empty (gl_list_implementation_t implementation, #endif } -static size_t +static size_t _GL_ATTRIBUTE_PURE gl_tree_size (gl_list_t list) { return (list->root != NULL ? list->root->branch_size : 0); } -static const void * +static const void * _GL_ATTRIBUTE_PURE gl_tree_node_value (gl_list_t list _GL_ATTRIBUTE_MAYBE_UNUSED, gl_list_node_t node) { @@ -221,7 +221,7 @@ gl_tree_nx_set_at (gl_list_t list, size_t position, const void *elt) #if !WITH_HASHTABLE -static gl_list_node_t +static gl_list_node_t _GL_ATTRIBUTE_PURE gl_tree_search_from_to (gl_list_t list, size_t start_index, size_t end_index, const void *elt) { @@ -332,7 +332,7 @@ gl_tree_search_from_to (gl_list_t list, size_t start_index, size_t end_index, } } -static size_t +static size_t _GL_ATTRIBUTE_PURE gl_tree_indexof_from_to (gl_list_t list, size_t start_index, size_t end_index, const void *elt) { @@ -552,7 +552,7 @@ gl_tree_list_free (gl_list_t list) /* --------------------- gl_list_iterator_t Data Type --------------------- */ -static gl_list_iterator_t +static gl_list_iterator_t _GL_ATTRIBUTE_PURE gl_tree_iterator (gl_list_t list) { gl_list_iterator_t result; @@ -577,7 +577,7 @@ gl_tree_iterator (gl_list_t list) return result; } -static gl_list_iterator_t +static gl_list_iterator_t _GL_ATTRIBUTE_PURE gl_tree_iterator_from_to (gl_list_t list, size_t start_index, size_t end_index) { size_t count = (list->root != NULL ? list->root->branch_size : 0); @@ -631,14 +631,14 @@ gl_tree_iterator_next (gl_list_iterator_t *iterator, return false; } -static void +static void _GL_ATTRIBUTE_CONST gl_tree_iterator_free (gl_list_iterator_t *iterator _GL_ATTRIBUTE_MAYBE_UNUSED) { } /* ---------------------- Sorted gl_list_t Data Type ---------------------- */ -static gl_list_node_t +static gl_list_node_t _GL_ATTRIBUTE_PURE gl_tree_sortedlist_search (gl_list_t list, gl_listelement_compar_fn compar, const void *elt) { @@ -679,7 +679,7 @@ gl_tree_sortedlist_search (gl_list_t list, gl_listelement_compar_fn compar, return NULL; } -static gl_list_node_t +static gl_list_node_t _GL_ATTRIBUTE_PURE gl_tree_sortedlist_search_from_to (gl_list_t list, gl_listelement_compar_fn compar, size_t low, size_t high, @@ -761,7 +761,7 @@ gl_tree_sortedlist_search_from_to (gl_list_t list, return NULL; } -static size_t +static size_t _GL_ATTRIBUTE_PURE gl_tree_sortedlist_indexof (gl_list_t list, gl_listelement_compar_fn compar, const void *elt) { @@ -816,7 +816,7 @@ gl_tree_sortedlist_indexof (gl_list_t list, gl_listelement_compar_fn compar, return (size_t)(-1); } -static size_t +static size_t _GL_ATTRIBUTE_PURE gl_tree_sortedlist_indexof_from_to (gl_list_t list, gl_listelement_compar_fn compar, size_t low, size_t high, diff --git a/lib/gl_anytree_omap.h b/lib/gl_anytree_omap.h index dec11d5..016c83b 100644 --- a/lib/gl_anytree_omap.h +++ b/lib/gl_anytree_omap.h @@ -49,7 +49,7 @@ gl_tree_nx_create_empty (gl_omap_implementation_t implementation, return map; } -static size_t +static size_t _GL_ATTRIBUTE_PURE gl_tree_size (gl_omap_t map) { return map->count; @@ -245,7 +245,7 @@ gl_tree_omap_free (gl_omap_t map) /* --------------------- gl_omap_iterator_t Data Type --------------------- */ -static gl_omap_iterator_t +static gl_omap_iterator_t _GL_ATTRIBUTE_PURE gl_tree_iterator (gl_omap_t map) { gl_omap_iterator_t result; @@ -299,7 +299,7 @@ gl_tree_iterator_next (gl_omap_iterator_t *iterator, return false; } -static void -gl_tree_iterator_free (gl_omap_iterator_t *iterator) +static void _GL_ATTRIBUTE_CONST +gl_tree_iterator_free (gl_omap_iterator_t *iterator _GL_ATTRIBUTE_MAYBE_UNUSED) { } diff --git a/lib/gl_anytree_oset.h b/lib/gl_anytree_oset.h index 10957c0..46c47c2 100644 --- a/lib/gl_anytree_oset.h +++ b/lib/gl_anytree_oset.h @@ -47,14 +47,14 @@ gl_tree_nx_create_empty (gl_oset_implementation_t implementation, return set; } -static size_t +static size_t _GL_ATTRIBUTE_PURE gl_tree_size (gl_oset_t set) { return set->count; } /* Returns the next node in the tree, or NULL if there is none. */ -static inline gl_oset_node_t +static inline gl_oset_node_t _GL_ATTRIBUTE_PURE gl_tree_next_node (gl_oset_node_t node) { if (node->right != NULL) @@ -73,7 +73,7 @@ gl_tree_next_node (gl_oset_node_t node) } /* Returns the previous node in the tree, or NULL if there is none. */ -static inline gl_oset_node_t +static inline gl_oset_node_t _GL_ATTRIBUTE_PURE gl_tree_prev_node (gl_oset_node_t node) { if (node->left != NULL) @@ -350,7 +350,7 @@ gl_tree_oset_free (gl_oset_t set) /* --------------------- gl_oset_iterator_t Data Type --------------------- */ -static gl_oset_iterator_t +static gl_oset_iterator_t _GL_ATTRIBUTE_PURE gl_tree_iterator (gl_oset_t set) { gl_oset_iterator_t result; @@ -437,7 +437,7 @@ gl_tree_iterator_next (gl_oset_iterator_t *iterator, const void **eltp) return false; } -static void -gl_tree_iterator_free (gl_oset_iterator_t *iterator _GL_ATTRIBUTE_MAYBE_UNUSED) +static void _GL_ATTRIBUTE_CONST +gl_tree_iterator_free (gl_oset_iterator_t *iterator _GL_ATTRIBUTE_MAYBE_UNUSED) { } diff --git a/lib/gl_anytreehash_list1.h b/lib/gl_anytreehash_list1.h index 88fac00..715f602 100644 --- a/lib/gl_anytreehash_list1.h +++ b/lib/gl_anytreehash_list1.h @@ -29,7 +29,7 @@ struct gl_multiple_nodes #define MULTIPLE_NODES_MAGIC (void *) -1 /* Returns the position of the given node in the tree. */ -static size_t +static size_t _GL_ATTRIBUTE_PURE node_position (gl_list_node_t node) { size_t position = 0; @@ -55,7 +55,7 @@ node_position (gl_list_node_t node) } /* Compares two nodes by their position in the tree. */ -static int +static int _GL_ATTRIBUTE_PURE compare_by_position (const void *x1, const void *x2) { gl_list_node_t node1 = (gl_list_node_t) x1; @@ -68,7 +68,7 @@ compare_by_position (const void *x1, const void *x2) } /* Compares a node's position in the tree with a given threshold. */ -static bool +static bool _GL_ATTRIBUTE_PURE compare_position_threshold (const void *x, const void *threshold) { gl_list_node_t node = (gl_list_node_t) x; diff --git a/lib/gl_array_list.c b/lib/gl_array_list.c index 4950962..92bf463 100644 --- a/lib/gl_array_list.c +++ b/lib/gl_array_list.c @@ -111,7 +111,7 @@ gl_array_nx_create (gl_list_implementation_t implementation, return NULL; } -static size_t +static size_t _GL_ATTRIBUTE_PURE gl_array_size (gl_list_t list) { return list->count; @@ -189,7 +189,7 @@ gl_array_nx_set_at (gl_list_t list, size_t position, const void *elt) return INDEX_TO_NODE (position); } -static size_t +static size_t _GL_ATTRIBUTE_PURE gl_array_indexof_from_to (gl_list_t list, size_t start_index, size_t end_index, const void *elt) { @@ -232,7 +232,7 @@ gl_array_indexof_from_to (gl_list_t list, size_t start_index, size_t end_index, return (size_t)(-1); } -static gl_list_node_t +static gl_list_node_t _GL_ATTRIBUTE_PURE gl_array_search_from_to (gl_list_t list, size_t start_index, size_t end_index, const void *elt) { @@ -441,7 +441,7 @@ gl_array_list_free (gl_list_t list) /* --------------------- gl_list_iterator_t Data Type --------------------- */ -static gl_list_iterator_t +static gl_list_iterator_t _GL_ATTRIBUTE_PURE gl_array_iterator (gl_list_t list) { gl_list_iterator_t result; @@ -459,7 +459,7 @@ gl_array_iterator (gl_list_t list) return result; } -static gl_list_iterator_t +static gl_list_iterator_t _GL_ATTRIBUTE_PURE gl_array_iterator_from_to (gl_list_t list, size_t start_index, size_t end_index) { gl_list_iterator_t result; @@ -508,14 +508,14 @@ gl_array_iterator_next (gl_list_iterator_t *iterator, return false; } -static void -gl_array_iterator_free (gl_list_iterator_t *iterator _GL_UNUSED) +static void _GL_ATTRIBUTE_CONST +gl_array_iterator_free (gl_list_iterator_t *iterator _GL_ATTRIBUTE_MAYBE_UNUSED) { } /* ---------------------- Sorted gl_list_t Data Type ---------------------- */ -static size_t +static size_t _GL_ATTRIBUTE_PURE gl_array_sortedlist_indexof_from_to (gl_list_t list, gl_listelement_compar_fn compar, size_t low, size_t high, @@ -574,7 +574,7 @@ gl_array_sortedlist_indexof_from_to (gl_list_t list, return (size_t)(-1); } -static size_t +static size_t _GL_ATTRIBUTE_PURE gl_array_sortedlist_indexof (gl_list_t list, gl_listelement_compar_fn compar, const void *elt) { @@ -582,7 +582,7 @@ gl_array_sortedlist_indexof (gl_list_t list, gl_listelement_compar_fn compar, elt); } -static gl_list_node_t +static gl_list_node_t _GL_ATTRIBUTE_PURE gl_array_sortedlist_search_from_to (gl_list_t list, gl_listelement_compar_fn compar, size_t low, size_t high, @@ -593,7 +593,7 @@ gl_array_sortedlist_search_from_to (gl_list_t list, return INDEX_TO_NODE (index); } -static gl_list_node_t +static gl_list_node_t _GL_ATTRIBUTE_PURE gl_array_sortedlist_search (gl_list_t list, gl_listelement_compar_fn compar, const void *elt) { diff --git a/lib/gl_array_omap.c b/lib/gl_array_omap.c index 872e51c..c3117db 100644 --- a/lib/gl_array_omap.c +++ b/lib/gl_array_omap.c @@ -67,13 +67,13 @@ gl_array_nx_create_empty (gl_omap_implementation_t implementation, return map; } -static size_t +static size_t _GL_ATTRIBUTE_PURE gl_array_size (gl_omap_t map) { return map->count; } -static size_t +static size_t _GL_ATTRIBUTE_PURE gl_array_indexof (gl_omap_t map, const void *key) { size_t count = map->count; @@ -109,7 +109,7 @@ gl_array_indexof (gl_omap_t map, const void *key) return (size_t)(-1); } -static bool +static bool _GL_ATTRIBUTE_PURE gl_array_search (gl_omap_t map, const void *key, const void **valuep) { size_t index = gl_array_indexof (map, key); @@ -122,7 +122,7 @@ gl_array_search (gl_omap_t map, const void *key, const void **valuep) return false; } -static bool +static bool _GL_ATTRIBUTE_PURE gl_array_search_atleast (gl_omap_t map, gl_mapkey_threshold_fn threshold_fn, const void *threshold, @@ -324,7 +324,7 @@ gl_array_free (gl_omap_t map) /* ---------------------- gl_omap_iterator_t Data Type ---------------------- */ -static gl_omap_iterator_t +static gl_omap_iterator_t _GL_ATTRIBUTE_PURE gl_array_iterator (gl_omap_t map) { gl_omap_iterator_t result; @@ -369,8 +369,8 @@ gl_array_iterator_next (gl_omap_iterator_t *iterator, return false; } -static void -gl_array_iterator_free (gl_omap_iterator_t *iterator) +static void _GL_ATTRIBUTE_CONST +gl_array_iterator_free (gl_omap_iterator_t *iterator _GL_ATTRIBUTE_MAYBE_UNUSED) { } diff --git a/lib/gl_array_oset.c b/lib/gl_array_oset.c index f44d6b0..5fb0da1 100644 --- a/lib/gl_array_oset.c +++ b/lib/gl_array_oset.c @@ -59,13 +59,13 @@ gl_array_nx_create_empty (gl_oset_implementation_t implementation, return set; } -static size_t +static size_t _GL_ATTRIBUTE_PURE gl_array_size (gl_oset_t set) { return set->count; } -static size_t +static size_t _GL_ATTRIBUTE_PURE gl_array_indexof (gl_oset_t set, const void *elt) { size_t count = set->count; @@ -101,7 +101,7 @@ gl_array_indexof (gl_oset_t set, const void *elt) return (size_t)(-1); } -static bool +static bool _GL_ATTRIBUTE_PURE gl_array_search (gl_oset_t set, const void *elt) { return gl_array_indexof (set, elt) != (size_t)(-1); @@ -112,7 +112,7 @@ gl_array_search (gl_oset_t set, const void *elt) by the THRESHOLD_FN. Returns the position at which it was found, or gl_list_size (SET) if not found. */ -static size_t +static size_t _GL_ATTRIBUTE_PURE gl_array_indexof_atleast (gl_oset_t set, gl_setelement_threshold_fn threshold_fn, const void *threshold) @@ -160,7 +160,7 @@ gl_array_indexof_atleast (gl_oset_t set, return count; } -static bool +static bool _GL_ATTRIBUTE_PURE gl_array_search_atleast (gl_oset_t set, gl_setelement_threshold_fn threshold_fn, const void *threshold, @@ -423,7 +423,7 @@ gl_array_free (gl_oset_t set) /* --------------------- gl_oset_iterator_t Data Type --------------------- */ -static gl_oset_iterator_t +static gl_oset_iterator_t _GL_ATTRIBUTE_PURE gl_array_iterator (gl_oset_t set) { gl_oset_iterator_t result; @@ -441,7 +441,7 @@ gl_array_iterator (gl_oset_t set) return result; } -static gl_oset_iterator_t +static gl_oset_iterator_t _GL_ATTRIBUTE_PURE gl_array_iterator_atleast (gl_oset_t set, gl_setelement_threshold_fn threshold_fn, const void *threshold) @@ -487,8 +487,8 @@ gl_array_iterator_next (gl_oset_iterator_t *iterator, const void **eltp) return false; } -static void -gl_array_iterator_free (gl_oset_iterator_t *iterator) +static void _GL_ATTRIBUTE_CONST +gl_array_iterator_free (gl_oset_iterator_t *iterator _GL_ATTRIBUTE_MAYBE_UNUSED) { } diff --git a/lib/gl_carray_list.c b/lib/gl_carray_list.c index 36a8773..8c2dc4e 100644 --- a/lib/gl_carray_list.c +++ b/lib/gl_carray_list.c @@ -116,13 +116,13 @@ gl_carray_nx_create (gl_list_implementation_t implementation, return NULL; } -static size_t +static size_t _GL_ATTRIBUTE_PURE gl_carray_size (gl_list_t list) { return list->count; } -static const void * +static const void * _GL_ATTRIBUTE_PURE gl_carray_node_value (gl_list_t list, gl_list_node_t node) { uintptr_t index = NODE_TO_INDEX (node); @@ -154,7 +154,7 @@ gl_carray_node_nx_set_value (gl_list_t list, gl_list_node_t node, return 0; } -static gl_list_node_t +static gl_list_node_t _GL_ATTRIBUTE_PURE gl_carray_next_node (gl_list_t list, gl_list_node_t node) { uintptr_t index = NODE_TO_INDEX (node); @@ -168,7 +168,7 @@ gl_carray_next_node (gl_list_t list, gl_list_node_t node) return NULL; } -static gl_list_node_t +static gl_list_node_t _GL_ATTRIBUTE_PURE gl_carray_previous_node (gl_list_t list, gl_list_node_t node) { uintptr_t index = NODE_TO_INDEX (node); @@ -181,7 +181,7 @@ gl_carray_previous_node (gl_list_t list, gl_list_node_t node) return NULL; } -static const void * +static const void * _GL_ATTRIBUTE_PURE gl_carray_get_at (gl_list_t list, size_t position) { size_t count = list->count; @@ -212,7 +212,7 @@ gl_carray_nx_set_at (gl_list_t list, size_t position, const void *elt) return INDEX_TO_NODE (position); } -static size_t +static size_t _GL_ATTRIBUTE_PURE gl_carray_indexof_from_to (gl_list_t list, size_t start_index, size_t end_index, const void *elt) { @@ -274,7 +274,7 @@ gl_carray_indexof_from_to (gl_list_t list, size_t start_index, size_t end_index, return (size_t)(-1); } -static gl_list_node_t +static gl_list_node_t _GL_ATTRIBUTE_PURE gl_carray_search_from_to (gl_list_t list, size_t start_index, size_t end_index, const void *elt) { @@ -611,7 +611,7 @@ gl_carray_list_free (gl_list_t list) /* --------------------- gl_list_iterator_t Data Type --------------------- */ -static gl_list_iterator_t +static gl_list_iterator_t _GL_ATTRIBUTE_PURE gl_carray_iterator (gl_list_t list) { gl_list_iterator_t result; @@ -629,7 +629,7 @@ gl_carray_iterator (gl_list_t list) return result; } -static gl_list_iterator_t +static gl_list_iterator_t _GL_ATTRIBUTE_PURE gl_carray_iterator_from_to (gl_list_t list, size_t start_index, size_t end_index) { gl_list_iterator_t result; @@ -680,14 +680,14 @@ gl_carray_iterator_next (gl_list_iterator_t *iterator, return false; } -static void -gl_carray_iterator_free (gl_list_iterator_t *iterator) +static void _GL_ATTRIBUTE_CONST +gl_carray_iterator_free (gl_list_iterator_t *iterator _GL_ATTRIBUTE_MAYBE_UNUSED) { } /* ---------------------- Sorted gl_list_t Data Type ---------------------- */ -static size_t +static size_t _GL_ATTRIBUTE_PURE gl_carray_sortedlist_indexof_from_to (gl_list_t list, gl_listelement_compar_fn compar, size_t low, size_t high, @@ -760,7 +760,7 @@ gl_carray_sortedlist_indexof_from_to (gl_list_t list, return (size_t)(-1); } -static size_t +static size_t _GL_ATTRIBUTE_PURE gl_carray_sortedlist_indexof (gl_list_t list, gl_listelement_compar_fn compar, const void *elt) { @@ -768,7 +768,7 @@ gl_carray_sortedlist_indexof (gl_list_t list, gl_listelement_compar_fn compar, elt); } -static gl_list_node_t +static gl_list_node_t _GL_ATTRIBUTE_PURE gl_carray_sortedlist_search_from_to (gl_list_t list, gl_listelement_compar_fn compar, size_t low, size_t high, @@ -779,7 +779,7 @@ gl_carray_sortedlist_search_from_to (gl_list_t list, return INDEX_TO_NODE (index); } -static gl_list_node_t +static gl_list_node_t _GL_ATTRIBUTE_PURE gl_carray_sortedlist_search (gl_list_t list, gl_listelement_compar_fn compar, const void *elt) { -- 2.7.4