This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Add macros for diagnostic control, use them in locale/weightwc.h
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Paul Eggert <eggert at cs dot ucla dot edu>
- Cc: <libc-alpha at sourceware dot org>
- Date: Wed, 19 Nov 2014 00:03:11 +0000
- Subject: Re: Add macros for diagnostic control, use them in locale/weightwc.h
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot DEB dot 2 dot 10 dot 1411181803130 dot 11642 at digraph dot polyomino dot org dot uk> <546BB1B1 dot 50000 at cs dot ucla dot edu> <alpine dot DEB dot 2 dot 10 dot 1411182256130 dot 18922 at digraph dot polyomino dot org dot uk> <546BDAF1 dot 8070401 at cs dot ucla dot edu>
On Tue, 18 Nov 2014, Paul Eggert wrote:
> On 11/18/2014 03:00 PM, Joseph Myers wrote:
> > Checking it means reviewing if the warning still appears... We don't want
> > to introduce lots of build failures every time GCC branches and the mainline
> > version increases.
> >
> In that case, we can do the equivalent of the following instead:
>
> #if __GNUC_PREREQ (4, 7)
> # if !__GNUC_PREPREQ (4, 10)
> # pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
> # else
> # pragma GCC diagnostic warning "-Wmaybe-uninitialized"
> # endif
> #endif
>
>
> That is, we can check the "4.9" without causing build failures in 5.0. That
> should be better than having an unchecked 4.9 sitting in the source.
But the basic point of using -Werror is that people don't look at warnings
that scroll by, and shouldn't need to; cluttering build logs up with
warnings doesn't help. And the relevant time to check is when 4.9 is no
longer supported (one person, or one per architecture, doing the checks
then), rather than keeping updating the pragma every time a new GCC
version branches.
Making the pragma turn the diagnostic into a warning is an interesting
idea for how to do the checks at the point when we increase the minimum
GCC version - it may be more convenient to turn all the cases where 4.9 is
specified into warnings to check them all at once, rather than try
deleting them and see which need adding back. I don't think, however,
that we need to work out now how we'll manage those checks in future and
whether macros making more sophisticated use of the version number might
be useful then.
--
Joseph S. Myers
joseph@codesourcery.com