bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org
Cc: Eric Blake <eblake@redhat.com>, Paul Eggert <eggert@cs.ucla.edu>,
	Dylan Cali <calid1984@gmail.com>
Subject: Re: compile warnings when including avltree-list and gcc-warnings is enabled
Date: Sun, 29 Sep 2019 16:39:05 +0200	[thread overview]
Message-ID: <3019441.MRqVNFB1MQ@omega> (raw)
In-Reply-To: <54185FC2.1090006@draigBrady.com>

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  <bruno@clisp.org>

	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)



      reply	other threads:[~2019-09-29 14:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-05 14:37 compile warnings when including avltree-list and gcc-warnings is enabled Dylan Cali
2014-09-05 15:51 ` Paul Eggert
2014-09-05 16:11   ` Dylan Cali
2014-09-06  7:05   ` Dylan Cali
2014-09-07  0:30     ` Paul Eggert
2014-09-07  1:42       ` Dylan Cali
2014-09-08 14:27         ` Eric Blake
2014-09-08 15:04           ` Dylan Cali
2014-09-08 23:09             ` Dylan Cali
2014-09-16 16:05               ` Pádraig Brady
2019-09-29 14:39                 ` Bruno Haible [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3019441.MRqVNFB1MQ@omega \
    --to=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    --cc=calid1984@gmail.com \
    --cc=eblake@redhat.com \
    --cc=eggert@cs.ucla.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).