[cfe-dev] Overeager -Wswitch
Kim Gräsman via cfe-dev
cfe-dev at lists.llvm.org
Sun Oct 11 10:58:32 PDT 2015
Hi Joerg,
On Sat, Oct 10, 2015 at 1:33 PM, Joerg Sonnenberger via cfe-dev
<cfe-dev at lists.llvm.org> wrote:
> On Sat, Oct 10, 2015 at 10:21:17AM +0200, Kim Gräsman via cfe-dev wrote:
>> Alternatively, if we could get a patch into Poco, is there something
>> like MSVC's #pragma(warning:disable) for Clang, so they could
>> selectively silence the warning around this function?
>
> add GCC diagnostic push
> #pragma GCC diagnostic ignored "-Wswitch"
> ... your function here...
> #pragma GCC diagnostic pop
>
> I think it also works with clang as pragma group.
Thanks, that's what I was looking for in the way of disabling. To
confirm, #pragma clang diagnostic also works.
I think we've agreed to rewrite the function in Poco using if/else
instead of switch, because it was hard to find a switch phrasing that
worked with all -W combinations (-Weverything overrode the #pragma
diagnostic and threw diagnostics for code that worked with -Wall).
That said, it might be worth trying to make Clang aware of libstdc++'s
enum convention, but I haven't thought of a way to do so yet.
- Kim
More information about the cfe-dev
mailing list