[PATCH] PR18327: -Wsystem-headers introduces build errors

Richard Smith metafoo at gmail.com
Mon Jan 6 11:27:44 PST 2014


We need to figure out what -Wsystem-headers should do in some corner cases.
In particular:

 * If I -Werror= a warning, and I have -Wsystem-headers, and the warning
occurs in a system header, what should happen?
 * If I use -Werror=system-headers, and a DefaultError warning (like
-Winvalid-constexpr) is issued in a system header, what should happen?
 * If I use -Werror=system-headers, and a (non-promoted-to-error) warning
occurs in a system header, what should happen?
 * If I use -Werror globally, and I have -Wsystem-headers enabled, and a
warning is produced in a system header, what should happen?

One possible approach would be to set the apparent severity of diagnostics
in system headers to max(warning severity, -Wsystem-headers severity). So
-Wsystem-headers would allow warnings (but not errors) to be produced in
system headers, and -Werror=system-headers would also allow errors to be
produced in system headers.

Another would be your current patch (never produce errors in system
headers).

Another would be to treat all warnings in system headers as if they're
controlled by the -Wsystem-headers flag (so -Werror=system-headers would
promote them all to errors, as would -Werror -Wsystem-headers).

Maybe there's another, better, option.

Thoughts?

On Sun Dec 29 2013 at 7:01:45 AM, Alp Toker <alp at nuanti.com> wrote:

> The -Wsystem-headers option was enabling warnings that got upgraded to
> errors
> through mappings like DefaultError. In a normal build these errors are
> fully
> suppressed.
>
> This patch makes -Wsystem-headers consistent with ordinary behaviour by
> restoring mapped errors in system headers to warnings, ensuring that the
> option
> can never cause build failures.
>
> The test case extends existing checks added in r169689 / PR14550.
>
> Alp.
>
> --
> http://www.nuanti.com
> the browser experts
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140106/2026441a/attachment.html>


More information about the cfe-commits mailing list