From 8a8b67ce4b5e7deb94593a9e3d007e45adecbf39 Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Mon, 20 Nov 2017 17:38:16 +0000 Subject: Revert r318556 "Loosen -Wempty-body warning" It seems this somehow made -Wempty-body fire in some macro cases where it didn't before, e.g. ../../third_party/ffmpeg/libavcodec/bitstream.c(169,5): error: if statement has empty body [-Werror,-Wempty-body] ff_dlog(NULL, "new table index=%d size=%d\n", table_index, table_size); ^ ../../third_party/ffmpeg\libavutil/internal.h(276,80): note: expanded from macro 'ff_dlog' # define ff_dlog(ctx, ...) do { if (0) av_log(ctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0) ^ ../../third_party/ffmpeg/libavcodec/bitstream.c(169,5): note: put the semicolon on a separate line to silence this warning Reverting until this can be figured out. > Do not show it when `if` or `else` come from macros. > E.g., > > #define USED(A) if (A); else > #define SOME_IF(A) if (A) > > void test() { > // No warnings are shown in those cases now. > USED(0); > SOME_IF(0); > } > > Patch by Ilya Biryukov! > > Differential Revision: https://reviews.llvm.org/D40185 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@318665 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Parse/ParseStmt.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/Parse/ParseStmt.cpp') diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp index ec14cee5a3..e8cf7d5fa4 100644 --- a/lib/Parse/ParseStmt.cpp +++ b/lib/Parse/ParseStmt.cpp @@ -1101,7 +1101,6 @@ bool Parser::ParseParenExprOrCondition(StmtResult *InitStmt, // Otherwise the condition is valid or the rparen is present. T.consumeClose(); - Cond.setRParenLoc(T.getCloseLocation()); // Check for extraneous ')'s to catch things like "if (foo())) {". We know // that all callers are looking for a statement after the condition, so ")" -- cgit v1.2.1