[cfe-dev] Pushable #pragma diagnostics
Chris Lattner
clattner at apple.com
Tue Jul 7 14:08:20 PDT 2009
On Jul 5, 2009, at 2:42 PM, Louis Gerbarg wrote:
> I generally compile code with as many warnings enabled as I can, and
> -Werror. Clang is great for that since it has a lot more flexible
> options for handling warnings than gcc. It also adopted gcc's recent
> diagnostic pragmas, which allow one to embed the warning controls
> directly around the relevant code.
Cool, thanks for working on this.
> It is unclear what the correct behavior of the pop should be at that
> point. Should pop all the way back to the push, should it attempt to
> regenerate a diagnostic state without the push put with the warning
> "-Wall" ? We could choose something, but it seems to me like it is
> not worth it. Another option to make push and pop explicit it
> commands:
>
> #pragma clang diagnostic push
> #pragma clang diagnostic ignored "-Wmultichar"
> char d = 'df'; // no warning.
> #pragma clang diagnostic pop
I strongly prefer this approach. I'll take a look at your latest
patch, thanks for working on this Louis!
-Chris
More information about the cfe-dev
mailing list