From: Joseph Myers <joseph@codesourcery.com>
To: Samuel Thibault <samuel.thibault@gnu.org>
Cc: GNU C Library <libc-alpha@sourceware.org>
Subject: Re: Coping with gcc warning due to limitation of gcc analysis?
Date: Mon, 29 Jan 2018 18:26:00 -0000 [thread overview]
Message-ID: <alpine.DEB.2.20.1801291603180.11517@digraph.polyomino.org.uk> (raw)
In-Reply-To: <20180127205417.4eruhvizwf4x2y2c@var.youpi.perso.aquilenet.fr>
On Sat, 27 Jan 2018, Samuel Thibault wrote:
> What is the glibc-preferred way to deal with this? Of course I could
> just initialize saved to a dumb value like -1 but the reader might
> wonder why unless we put a blunt comment, and a smarter compiler might
> later warn "-1 set in `saved' is never used"...
As a general rule: we avoid such initializers that are only intended to
suppress warnings rather than ever to have that initial value used. If
the code can be changed to avoid the warning without being less efficient,
that's preferred. Otherwise, use the DIAG_*_NEEDS_COMMENT macros (with
appropriate explanatory comment detailing the warning and why it's a false
positive). Using -Wno-error=* or -Wno-* in the Makefiles is less
desirable, and generally only appropriate if the pragmas don't work for
some reason (e.g. no option controlling the warning in question to use in
a pragma) or can't be used (e.g. file copied verbatim from an upstream
source not using such pragmas and we don't want local changes to it).
--
Joseph S. Myers
joseph@codesourcery.com
prev parent reply other threads:[~2018-01-29 16:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-28 2:03 Samuel Thibault
2018-01-28 10:58 ` Jeff Law
2018-01-28 14:45 ` Samuel Thibault
2018-01-28 14:49 ` Florian Weimer
2018-01-29 18:26 ` Joseph Myers [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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.20.1801291603180.11517@digraph.polyomino.org.uk \
--to=joseph@codesourcery.com \
--cc=libc-alpha@sourceware.org \
--cc=samuel.thibault@gnu.org \
/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).