[PATCH] D13969: Tweak how -Wunused-value interacts with macros

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 27 12:39:04 PDT 2015

rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm, I don't feel strongly about whether -fms-compatibility matters, but I'd prefer that it didn't.

Comment at: lib/Sema/SemaStmt.cpp:224
@@ +223,3 @@
+  // but its implementation makes clang's -Wunused-value fire.  Prevent this.
+  if (getLangOpts().MSVCCompat && isa<ParenExpr>(E->IgnoreImpCasts()) &&
+      Loc.isMacroID()) {
I'd rather not make this conditional on -fms-compatibility. I can easily imagine a situation where someone has cargo-culted this pattern from windows.h while porting to other platforms, and silencing the unused value warning in that situation seems like goodness. I guess the only concern is lexer performance, but I think it'll be fine.


More information about the cfe-commits mailing list