[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: compile warnings when including avltree-list and gcc-warnings is ena
From: |
Bruno Haible |
Subject: |
Re: compile warnings when including avltree-list and gcc-warnings is enabled |
Date: |
Sun, 29 Sep 2019 16:39:05 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-159-generic; KDE/5.18.0; x86_64; ; ) |
On 2014-09-16 Pádraig Brady wrote:
> I've adjusted and pushed your patch accordingly at:
> http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=5549ef8
Now, on CentOS 8, with GCC 8.2.1 RedHat variant, I get this warning:
gl_avltree_list.c:67:1: warning: 'const' attribute on function returning 'void'
[-Wattributes]
The warning is explained in [1]:
"Note that a function that has pointer arguments and examines the data
pointed to must not be declared const."
[1] https://gcc.gnu.org/onlinedocs/gcc-8.2.0/gcc/Common-Function-Attributes.html
If some GCC versions suggested to add 'const' on this function, this suggestion
was mistaken and should be silenced. In other words, don't use
-Werror=suggest-attribute=const with that version of GCC.
2019-09-29 Bruno Haible <address@hidden>
avltree-list: Fix compilation warning (introduced on 2014-09-16).
* lib/gl_avltree_list.c (gl_avltree_list_check_invariants): Remove
'const' attribute.
diff --git a/lib/gl_avltree_list.c b/lib/gl_avltree_list.c
index 655eeac..6d9a537 100644
--- a/lib/gl_avltree_list.c
+++ b/lib/gl_avltree_list.c
@@ -62,7 +62,7 @@ check_invariants (gl_list_node_t node, gl_list_node_t parent)
return 1 + (left_height > right_height ? left_height : right_height);
}
-void _GL_ATTRIBUTE_CONST
+void
gl_avltree_list_check_invariants (gl_list_t list)
{
if (list->root != NULL)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: compile warnings when including avltree-list and gcc-warnings is enabled,
Bruno Haible <=