bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: "Pádraig Brady" <P@draigBrady.com>
To: Dylan Cali <calid1984@gmail.com>
Cc: bug-gnulib@gnu.org, Paul Eggert <eggert@cs.ucla.edu>,
	Eric Blake <eblake@redhat.com>
Subject: Re: compile warnings when including avltree-list and gcc-warnings is enabled
Date: Tue, 16 Sep 2014 17:05:22 +0100	[thread overview]
Message-ID: <54185FC2.1090006@draigBrady.com> (raw)
In-Reply-To: <CAM1XmN98m7=93AM61seqT4190MZX9kGMMtXOWKXTPM_f93zT+A@mail.gmail.com>

On 09/09/2014 12:09 AM, Dylan Cali wrote:
> On Mon, Sep 8, 2014 at 10:04 AM, Dylan Cali <calid1984@gmail.com> wrote:
>> On Sep 8, 2014 9:27 AM, "Eric Blake" <eblake@redhat.com> wrote:
>>> Does this work for all supported versions of gcc? Or do you need to make
>>> it conditional on new enough gcc (it's okay if warnings have to be
>>> disabled to compile with older gcc, but not okay if the way to disable
>>> warnings for newer gcc causes compilation failure in older gcc).
>>
>> Yep you're right, looking at some other code of mine I have a conditional
>> checking for gcc > 3.7 before doing the push/pop, so it looks like that is
>> the min version for this pragma.  So wrap the pragma in a conditional, and
>> add a conditional in the Makefile turning off warnings altogether for gcc <=
>> 3.7?
> 
> Ok cool, it looks like this is mostly already implemented.  First, I
> was wrong about the version of gcc that supports these pragmas, it's
> 4.6 [1].  And gnulib already uses the diagnostic pragmas elsewhere, so
> I mimicked the conditional format used in other files.  Finally, the
> makefile conditional is already done in the coreutils configure.ac
> [2].
> 
> I've attached a patch with the updates, let me know if you see any
> further issues.
> 
> Thanks,
> Dylan
> 
> [1] https://gcc.gnu.org/ml/gcc-help/2011-01/msg00113.html
> [2] https://github.com/coreutils/coreutils/blob/master/configure.ac#L97

I don't think we need to worry about the pragma as it was a valid warning in this case.
To tell the compiler we want to discard the result in this context
we can use ignore_value() or the more appropriate (void) cast in this case.

Also it's best to leave the prototype in the tests.

I've adjusted and pushed your patch accordingly at:
http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=5549ef8

thanks!
Pádraig.

p.s. It's marked trivial for licensing reasons.


  reply	other threads:[~2014-09-16 16:05 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 [this message]
2019-09-29 14:39                 ` Bruno Haible

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=54185FC2.1090006@draigBrady.com \
    --to=p@draigbrady.com \
    --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).