Re: [PATCH] D15866: Warn when using `defined` in a macro definition.

2016-01-19 Thread Nico Weber via cfe-commits
thakis closed this revision. thakis added a comment. r258128 http://reviews.llvm.org/D15866 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D15866: Warn when using `defined` in a macro definition.

2016-01-14 Thread Nico Weber via cfe-commits
thakis marked an inline comment as done. thakis added a comment. Also addressed your comment and added a test for that. http://reviews.llvm.org/D15866 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/list

Re: [PATCH] D15866: Warn when using `defined` in a macro definition.

2016-01-14 Thread Nico Weber via cfe-commits
thakis updated this revision to Diff 44959. thakis added a comment. Address review comment. http://reviews.llvm.org/D15866 Files: include/clang/Basic/DiagnosticGroups.td include/clang/Basic/DiagnosticLexKinds.td lib/Lex/PPExpressions.cpp test/Lexer/cxx-features.cpp test/Preprocessor/e

Re: [PATCH] D15866: Warn when using `defined` in a macro definition.

2016-01-14 Thread Nico Weber via cfe-commits
Thanks for the review! I tweaked it a bit so that this only warns on function-type macros in -pedantic mode. That way, the warning can even be used in practice :-) On Thu, Jan 14, 2016 at 10:33 PM, Nico Weber wrote: > thakis updated this revision to Diff 44958. > thakis added a comment. > > For

Re: [PATCH] D15866: Warn when using `defined` in a macro definition.

2016-01-14 Thread Nico Weber via cfe-commits
thakis updated this revision to Diff 44958. thakis added a comment. For function-type macros, make the warning only show up with -pedantic http://reviews.llvm.org/D15866 Files: include/clang/Basic/DiagnosticGroups.td include/clang/Basic/DiagnosticLexKinds.td lib/Lex/PPExpressions.cpp te

Re: [PATCH] D15866: Warn when using `defined` in a macro definition.

2016-01-14 Thread Richard Smith via cfe-commits
rsmith accepted this revision. This revision is now accepted and ready to land. Comment at: lib/Lex/PPExpressions.cpp:104-105 @@ +103,4 @@ + // #else branch. Emit a warning about this undefined behavior. + if (beginLoc.isMacroID()) +PP.Diag(beginLoc, diag::warn_defined_in_m

[PATCH] D15866: Warn when using `defined` in a macro definition.

2016-01-04 Thread Nico Weber via cfe-commits
thakis created this revision. thakis added a reviewer: rsmith. thakis added a subscriber: cfe-commits. As far as I can tell, doing #define HAVE_FOO_BAR defined(FOO) && defined(BAR) #if HAVE_FOO ... #endif has undefined behavior per [cpp.cond]p4. In practice, it can have different