[PATCH] D28148: [Sema] Suppress warnings for C's zero initializer
Arthur O'Dwyer via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 29 16:23:37 PST 2016
Quuxplusone added subscribers: rjmccall, Quuxplusone.
Quuxplusone added a comment.
Re the language option: In https://reviews.llvm.org/D27163, @rsmith wrote:
> Perhaps some catch-all "I want defined behavior for things that C defines even though I'm compiling in C++" flag would make sense here?
It didn't happen then, but I'd like to re-raise the idea. There's probably plenty of code (e.g. Apple kernel drivers, judging from @rjmccall's comments on https://reviews.llvm.org/D27163) that's written in the common subset of C and C++ but compiled as C++. It's unfortunate that that workflow keeps getting "broken" by aggressive diagnostics (in this case) and aggressive optimizations (in that case). I'd like if Clang provided a way for the user to explicitly opt-in and say "Some or all of this code is C compiled as C++; please respect that."
(IOW, it looks as if this patch proposes to fix the noisy diagnostic for every language //except for// C-sometimes-compiled-as-C++, and as a sometime writer of C-sometimes-compiled-as-C++ myself, that irks me. Apologies if I've misconstrued the patch.)
More information about the cfe-commits