[PATCH] PR18327: -Wsystem-headers introduces build errors
richard at metafoo.co.uk
Thu Jan 9 14:51:47 PST 2014
On Thu, Jan 9, 2014 at 2:39 PM, Marshall Clow <mclow.lists at gmail.com> wrote:
> On Jan 9, 2014, at 2:20 PM, Richard Smith <richard at metafoo.co.uk> wrote:
> On Thu, Jan 9, 2014 at 7:25 AM, Alp Toker <alp at nuanti.com> wrote:
> It's not fair on the user or the system header maintainers to bring up
>> unexpected errors with this flag.
> I don't think this is clear. If the code in the system header is
> ill-formed, I would expect the system header maintainers to be *grateful*
> that we flag it as an error and not just as a warning. But I'll wait to
> hear what they have to say about that.
> A few points, in no particular order:
> * If we have ill-formed code in system headers, I would expect it to fail
> to compile whether the user specifies -Wsystem-headers or not.
And yet in some cases we don't, because we deliberately support some
flavors of broken system headers. Given that, would you want
-Wsystem-headers to make such code produce an error or only a warning?
* If a user has a clean build, and then rebuilds with -Wsystem-headers, I
> would expect to get warnings - not errors. [ Isn’t that what PR18327 is
> all about? ]
Do you expect this because the flag starts with -W? (Maybe that's the
problem here -- it's *not* a warning flag in the sense that the other -W
flags are. But that's not unprecedented -- nor is -Werror.)
* There are some “interesting” language features which are only enabled for
> system headers, and cause warnings if used in user code.
> [ User-defined suffixes that do not start with an underscore, for example.
This is a really great example, thanks. So it seems there are at least
three different classes of errors that we might think about producing in
1) warnings that the user has turned into errors with -Werror or
2) errors for ill-formed code that we suppress by default in system
headers as a workaround for a system header bug
3) errors for code that is ill-formed outside system headers but valid
within system headers (using reserved names, adding names to namespace std,
that sort of thing)
With -Wsystem-headers enabled, I think (1) should be an error, (3) should
remain suppressed (not even a warning), and (2) should be either a warning
or an error (and your first two bullets don't give me a clear idea of which
way these cases should go).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-commits