From: Paul Eggert <eggert@cs.ucla.edu>
To: Joseph Myers <joseph@codesourcery.com>, libc-alpha@sourceware.org
Subject: Re: Add macros for diagnostic control, use them in locale/weightwc.h
Date: Fri, 21 Nov 2014 17:43:00 -0000 [thread overview]
Message-ID: <546F79BB.80604@cs.ucla.edu> (raw)
In-Reply-To: <alpine.DEB.2.10.1411211705270.2475@digraph.polyomino.org.uk>
A couple of other thoughts.
First, the syntax DIAG_IGNORE (-Wmaybe-uninitialized, ...) is too clever and
brittle. Too clever, because in C code it looks like it's subtracting
'uninitialized' from the negative of 'Wmaybe'. Too brittle, because suppose GCC
adds a warning option syntax with commas in it?
"-Wsuggest-attribute=format,noreturn", say? Then DIAG_IGNORE
(-Wsuggest-attribute=format,noreturn, ...) won't work because of C's
tokenization rules. For both of these reasions it would be better to use a
string, e.g., DIAG_IGNORE ("-Wmaybe-uninitialized", ...).
More important, I looked through some of the Gnulib and GNU utilities code that
deals with working around bugs in GCC's diagnostics generation, and
-Wmaybe-uninitialized in particular has caused us so much grief that we
typically silence it in a different way, which I should mention. We use a macro
definition like this:
#ifdef lint
# define IF_LINT(Code) Code
#else
# define IF_LINT(Code) /* empty */
#endif
and then write declarations like this:
off_t size IF_LINT ( = 0);
when GCC wrongly complains that 'size' may be used unininitialized. That way,
people who want to use -Wmaybe-uninitialized can get clean compiles by compiling
with '-Wmaybe-uninitialized -Dlint', and people who don't care about this stuff
can omit the options and get slightly more-efficient code. Obviously there are
some pitfalls in this approach but overall its benefits outweigh its cost for
us. In particular, it lets us carefully isolate the uninitialized-warning bug,
whereas the DIAG_IGNORE approach is more of a blunderbuss that disables the
warning in a too-large region because of GCC's bugs.
next prev parent reply other threads:[~2014-11-21 17:43 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-18 18:04 Joseph Myers
2014-11-18 20:53 ` Paul Eggert
2014-11-18 21:18 ` Roland McGrath
2014-11-18 22:29 ` Paul Eggert
2014-11-18 23:16 ` Joseph Myers
2014-11-18 23:58 ` Paul Eggert
2014-11-19 0:06 ` Joseph Myers
2014-11-19 6:52 ` Paul Eggert
2014-11-19 9:09 ` Andreas Schwab
2014-11-19 15:42 ` Joseph Myers
2014-11-18 23:00 ` Joseph Myers
2014-11-18 23:49 ` Paul Eggert
2014-11-19 0:03 ` Joseph Myers
2014-11-19 6:51 ` Paul Eggert
2014-11-19 14:56 ` Joseph Myers
2014-11-21 17:29 ` Paul Eggert
2014-11-21 18:27 ` Joseph Myers
2014-11-21 17:05 ` Joseph Myers
2014-11-21 17:43 ` Paul Eggert [this message]
2014-11-21 18:12 ` Joseph Myers
2014-11-21 19:17 ` Paul Eggert
2014-11-21 22:47 ` Joseph Myers
2014-11-21 23:03 ` Joseph Myers
2014-11-22 5:14 ` Paul Eggert
2014-11-24 23:47 ` Roland McGrath
2014-11-25 1:29 ` Joseph Myers
2014-11-25 22:35 ` Paul Eggert
2014-11-25 22:42 ` Roland McGrath
2014-11-25 22:42 ` Joseph Myers
2014-11-26 0:24 ` Paul Eggert
2014-11-26 0:36 ` Joseph Myers
2014-11-26 0:42 ` Paul Eggert
2014-11-25 0:00 ` Roland McGrath
2014-11-25 22:23 ` Paul Eggert
2014-11-21 22:29 ` Roland McGrath
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=546F79BB.80604@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=joseph@codesourcery.com \
--cc=libc-alpha@sourceware.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).