From d8a8fb3423499851bf06aac2302112944a276f97 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sun, 31 May 2020 08:59:25 +0200 Subject: list: fix GCC warnings * lib/gl_anytree_list2.h (gl_tree_iterator_free) (gl_tree_next_node, gl_tree_node_nx_set_value) (gl_tree_previous_node, gl_tree_next_node): Mark unused arguments. * lib/gl_anytree_oset.h (gl_tree_iterator_free): Likewise. * lib/gl_anylinked_list2.h (gl_linked_node_value) (gl_linked_node_nx_set_value, gl_linked_iterator_free): Likewise. * lib/gl_anytreehash_list2.h (gl_tree_search_from_to): Avoid using the same variable name in nested scopes. --- lib/gl_anylinked_list2.h | 18 ++++++++++-------- lib/gl_anytree_list2.h | 14 +++++++++----- lib/gl_anytree_oset.h | 2 +- lib/gl_anytreehash_list2.h | 6 +++--- 4 files changed, 23 insertions(+), 17 deletions(-) (limited to 'lib') diff --git a/lib/gl_anylinked_list2.h b/lib/gl_anylinked_list2.h index 114106c7dc..3e01f8fa06 100644 --- a/lib/gl_anylinked_list2.h +++ b/lib/gl_anylinked_list2.h @@ -76,11 +76,11 @@ gl_linked_nx_create_empty (gl_list_implementation_t implementation, static gl_list_t gl_linked_nx_create (gl_list_implementation_t implementation, - gl_listelement_equals_fn equals_fn, - gl_listelement_hashcode_fn hashcode_fn, - gl_listelement_dispose_fn dispose_fn, - bool allow_duplicates, - size_t count, const void **contents) + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + gl_listelement_dispose_fn dispose_fn, + bool allow_duplicates, + size_t count, const void **contents) { struct gl_list_impl *list = (struct gl_list_impl *) malloc (sizeof (struct gl_list_impl)); @@ -170,13 +170,15 @@ gl_linked_size (gl_list_t list) } static const void * _GL_ATTRIBUTE_PURE -gl_linked_node_value (gl_list_t list, gl_list_node_t node) +gl_linked_node_value (gl_list_t list _GL_ATTRIBUTE_MAYBE_UNUSED, + gl_list_node_t node) { return node->value; } static int -gl_linked_node_nx_set_value (gl_list_t list, gl_list_node_t node, +gl_linked_node_nx_set_value (gl_list_t list _GL_ATTRIBUTE_MAYBE_UNUSED, + gl_list_node_t node, const void *elt) { #if WITH_HASHTABLE @@ -1021,7 +1023,7 @@ gl_linked_iterator_next (gl_list_iterator_t *iterator, } static void -gl_linked_iterator_free (gl_list_iterator_t *iterator) +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 c5a67dbd0c..939b797480 100644 --- a/lib/gl_anytree_list2.h +++ b/lib/gl_anytree_list2.h @@ -60,13 +60,15 @@ gl_tree_size (gl_list_t list) } static const void * -gl_tree_node_value (gl_list_t list, gl_list_node_t node) +gl_tree_node_value (gl_list_t list _GL_ATTRIBUTE_MAYBE_UNUSED, + gl_list_node_t node) { return node->value; } static int -gl_tree_node_nx_set_value (gl_list_t list, gl_list_node_t node, const void *elt) +gl_tree_node_nx_set_value (gl_list_t list _GL_ATTRIBUTE_MAYBE_UNUSED, + gl_list_node_t node, const void *elt) { #if WITH_HASHTABLE if (elt != node->value) @@ -101,7 +103,8 @@ gl_tree_node_nx_set_value (gl_list_t list, gl_list_node_t node, const void *elt) } static gl_list_node_t _GL_ATTRIBUTE_PURE -gl_tree_next_node (gl_list_t list, gl_list_node_t node) +gl_tree_next_node (gl_list_t list _GL_ATTRIBUTE_MAYBE_UNUSED, + gl_list_node_t node) { if (node->right != NULL) { @@ -119,7 +122,8 @@ gl_tree_next_node (gl_list_t list, gl_list_node_t node) } static gl_list_node_t _GL_ATTRIBUTE_PURE -gl_tree_previous_node (gl_list_t list, gl_list_node_t node) +gl_tree_previous_node (gl_list_t list _GL_ATTRIBUTE_MAYBE_UNUSED, + gl_list_node_t node) { if (node->left != NULL) { @@ -628,7 +632,7 @@ gl_tree_iterator_next (gl_list_iterator_t *iterator, } static void -gl_tree_iterator_free (gl_list_iterator_t *iterator) +gl_tree_iterator_free (gl_list_iterator_t *iterator _GL_ATTRIBUTE_MAYBE_UNUSED) { } diff --git a/lib/gl_anytree_oset.h b/lib/gl_anytree_oset.h index e837f63241..d737e313d7 100644 --- a/lib/gl_anytree_oset.h +++ b/lib/gl_anytree_oset.h @@ -292,6 +292,6 @@ gl_tree_iterator_next (gl_oset_iterator_t *iterator, const void **eltp) } static void -gl_tree_iterator_free (gl_oset_iterator_t *iterator) +gl_tree_iterator_free (gl_oset_iterator_t *iterator _GL_ATTRIBUTE_MAYBE_UNUSED) { } diff --git a/lib/gl_anytreehash_list2.h b/lib/gl_anytreehash_list2.h index 69e6776b09..26e52bf389 100644 --- a/lib/gl_anytreehash_list2.h +++ b/lib/gl_anytreehash_list2.h @@ -61,13 +61,13 @@ gl_tree_search_from_to (gl_list_t list, size_t start_index, size_t end_index, { /* We have to return only the one at the minimal position >= start_index. */ - const void *elt; + const void *nodes_elt; if (gl_oset_search_atleast (nodes, compare_position_threshold, (void *)(uintptr_t)start_index, - &elt)) + &nodes_elt)) { - node = (gl_list_node_t) elt; + node = (gl_list_node_t) nodes_elt; if (end_index == list->root->branch_size || node_position (node) < end_index) return node; -- cgit v1.2.1