r265381 - Consolidate and improve the handling of built-in feature-like macros

2016-04-05 Thread Andy Gibbs via cfe-commits
Author: andyg Date: Tue Apr 5 03:36:47 2016 New Revision: 265381 URL: http://llvm.org/viewvc/llvm-project?rev=265381&view=rev Log: Consolidate and improve the handling of built-in feature-like macros Summary: The parsing logic has been separated out from the macro implementation logic, leading

Re: [PATCH] D17149: Consolidate and improve the handling of built-in feature-like macros

2016-04-05 Thread Andy Gibbs via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL265381: Consolidate and improve the handling of built-in feature-like macros (authored by AndyG). Changed prior to commit: http://reviews.llvm.org/D17149?vs=52535&id=52664#toc Repository: rL LLVM ht

Re: [PATCH] D17149: Consolidate and improve the handling of built-in feature-like macros

2016-04-04 Thread Andy Gibbs via cfe-commits
AndyG updated this revision to Diff 52535. AndyG marked 5 inline comments as done. AndyG added a comment. Implemented comments. http://reviews.llvm.org/D17149 Files: include/clang/Basic/DiagnosticLexKinds.td lib/Lex/PPMacroExpansion.cpp test/Preprocessor/feature_tests.c test/Preprocesso

Re: [PATCH] D17149: Consolidate and improve the handling of built-in feature-like macros

2016-04-04 Thread Andy Gibbs via cfe-commits
AndyG added inline comments. Comment at: lib/Lex/PPMacroExpansion.cpp:1456-1457 @@ +1455,4 @@ + +// Parse next non-comment, non-annotation token. +do PP.LexUnexpandedNonComment(Tok); while (Tok.isAnnotation()); + rsmith wrote: > If we get an annotation tok

Re: [PATCH] D17149: Consolidate and improve the handling of built-in feature-like macros

2016-04-03 Thread Andy Gibbs via cfe-commits
AndyG updated this revision to Diff 52513. AndyG added a comment. Ok, I've removed support for nested parentheses. Can this go through now? Thanks. http://reviews.llvm.org/D17149 Files: include/clang/Basic/DiagnosticLexKinds.td lib/Lex/PPMacroExpansion.cpp test/Preprocessor/feature_test

r265177 - Diagnose missing macro argument following charize operator.

2016-04-01 Thread Andy Gibbs via cfe-commits
Author: andyg Date: Fri Apr 1 14:02:20 2016 New Revision: 265177 URL: http://llvm.org/viewvc/llvm-project?rev=265177&view=rev Log: Diagnose missing macro argument following charize operator. For completeness, add a test-case for the equivalent stringize operator diagnostic too. Modified: cf

r262025 - Reduce false positives in printf/scanf format checker

2016-02-26 Thread Andy Gibbs via cfe-commits
Author: andyg Date: Fri Feb 26 09:35:16 2016 New Revision: 262025 URL: http://llvm.org/viewvc/llvm-project?rev=262025&view=rev Log: Reduce false positives in printf/scanf format checker Summary: The printf/scanf format checker is a little over-zealous in handling the conditional operator. This

Re: [PATCH] D15636: Reduce false positives in printf/scanf format checker

2016-02-25 Thread Andy Gibbs via cfe-commits
AndyG added inline comments. Comment at: lib/Sema/SemaChecking.cpp:3923-3924 @@ +3922,4 @@ + PartialDiagnostic PDiag = S.PDiag(diag::warn_printf_data_arg_not_used); + for (unsigned i = 1; i < DiagnosticExprs.size(); ++i) +PDiag << DiagnosticExprs[i]->getSourceRange(); +

Re: [PATCH] D15636: Reduce false positives in printf/scanf format checker

2016-02-25 Thread Andy Gibbs via cfe-commits
AndyG updated this revision to Diff 49058. AndyG marked 5 inline comments as done. AndyG added a comment. Updated patch according to the comments made. Also spotted a corner-case where a double-diagnostic was produced, for example in the following where one string has too few arguments and the

Re: [PATCH] D17149: Consolidate and improve the handling of built-in feature-like macros

2016-02-25 Thread Andy Gibbs via cfe-commits
AndyG added a comment. Second bump :o) http://reviews.llvm.org/D17149 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D15636: Reduce false positives in printf/scanf format checker

2016-02-22 Thread Andy Gibbs via cfe-commits
AndyG added inline comments. Comment at: lib/Sema/SemaChecking.cpp:3905 @@ -3822,14 +3904,3 @@ CoveredArgs.flip(); -signed notCoveredArg = CoveredArgs.find_first(); -if (notCoveredArg >= 0) { - assert((unsigned)notCoveredArg < NumDataArgs); - if (const Expr

Re: [PATCH] D15636: Reduce false positives in printf/scanf format checker

2016-02-22 Thread Andy Gibbs via cfe-commits
AndyG updated this revision to Diff 48678. AndyG marked 2 inline comments as done. AndyG added a comment. Patch additionally re-based off r261522. http://reviews.llvm.org/D15636 Files: lib/Sema/SemaChecking.cpp test/Sema/format-strings-scanf.c test/Sema/format-strings.c Index: test/Sema/

Re: [PATCH] D15636: Reduce false positives in printf/scanf format checker

2016-02-22 Thread Andy Gibbs via cfe-commits
AndyG marked 11 inline comments as done. AndyG added a comment. Revised patch coming shortly... Comment at: lib/Sema/SemaChecking.cpp:3603 @@ -3554,3 +3602,3 @@ - void DoneProcessing(); + void DoneProcessing(signed &FirstUncoveredArg); rtrieu wrote: > Don'

Re: [PATCH] D15636: Reduce false positives in printf/scanf format checker

2016-02-22 Thread Andy Gibbs via cfe-commits
AndyG marked 7 inline comments as done. AndyG added a comment. I've removed CheckFormatString from Sema.h and make it a static function inside SemaChecking.cpp in r261522. I'll submit a new diff here with the remaining requested changes for this patch when I have a moment. http://reviews.llvm

r261522 - Make Sema::CheckFormatString a static function inside SemaChecking.cpp

2016-02-22 Thread Andy Gibbs via cfe-commits
Author: andyg Date: Mon Feb 22 07:00:43 2016 New Revision: 261522 URL: http://llvm.org/viewvc/llvm-project?rev=261522&view=rev Log: Make Sema::CheckFormatString a static function inside SemaChecking.cpp No functionality change. Change at the request of Richard Trieu, see http://reviews.llvm.org/

Re: [PATCH] D17149: Consolidate and improve the handling of built-in feature-like macros

2016-02-18 Thread Andy Gibbs via cfe-commits
AndyG added a comment. Bump :o) http://reviews.llvm.org/D17149 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D15636: Reduce false positives in printf/scanf format checker

2016-02-15 Thread Andy Gibbs via cfe-commits
AndyG added a comment. Richard, are you happy with this latest version? Can I proceed to commit it? Thanks. http://reviews.llvm.org/D15636 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-c

Re: [PATCH] D17149: Consolidate and improve the handling of built-in feature-like macros

2016-02-11 Thread Andy Gibbs via cfe-commits
AndyG added a comment. To be honest, the simple answer is because it was just as easy to do with nesting as without (the code would still need to track the appearance of left and right parentheses in order to correctly parse to the closing right-parenthesis of the macro invocation in any case).

Re: [PATCH] D17149: Consolidate and improve the handling of built-in feature-like macros

2016-02-11 Thread Andy Gibbs via cfe-commits
AndyG added a comment. Test comment -- just to see whether email notifications are sending properly (it seems, for example, that cfe-commits wasn't notified of this patch...) http://reviews.llvm.org/D17149 ___ cfe-commits mailing list cfe-commits@l

Re: [PATCH] D15636: Reduce false positives in printf/scanf format checker

2016-02-10 Thread Andy Gibbs via cfe-commits
AndyG removed reviewers: dblaikie, rsmith. AndyG updated this revision to Diff 47426. AndyG added a comment. All strings matching the highest uncovered argument are now highlighted in the diagnostic. http://reviews.llvm.org/D15636 Files: include/clang/Sema/Sema.h lib/Sema/SemaChecking.cpp

Re: [PATCH] D15636: Reduce false positives in printf/scanf format checker

2016-02-03 Thread Andy Gibbs via cfe-commits
AndyG added a comment. In your case, the first string would be highlighted only. Yes, I see what you mean. Is it possible to have multiple ranges for the diagnostic? By which I mean, to produce the following: test.cpp:x:y: warning: data argument not used by format string [-Wformat-extra-a

Re: [PATCH] D15636: Reduce false positives in printf/scanf format checker

2016-02-03 Thread Andy Gibbs via cfe-commits
AndyG added a comment. Thoughts? Am I good to go? Cheers, Andy http://reviews.llvm.org/D15636 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D15636: Reduce false positives in printf/scanf format checker

2016-01-28 Thread Andy Gibbs via cfe-commits
AndyG added a comment. Yes, but only for the "data argument not used" warning. All other warnings are unaffected by the change, for example: test.cpp:9:51: warning: format specifies type 'char *' but the argument has type 'int' [-Wformat]

Re: [PATCH] D15636: Reduce false positives in printf/scanf format checker

2016-01-26 Thread Andy Gibbs via cfe-commits
AndyG added a comment. Hi Richard, Thank you for looking at my patch. I would argue that the code printf(minimal ? "%i\n" : "%i: %s\n", code, msg); is valid and should //not// cause a warning due to unused arguments since at least one code path uses all the arguments. This in my view is th

Re: [PATCH] D15636: Reduce false positives in printf/scanf format checker

2016-01-25 Thread Andy Gibbs via cfe-commits
AndyG added a reviewer: rtrieu. AndyG added a comment. Richard, you have been recommended to me as a suitable reviewer by David. If that's not ok with you, please could you recommend another! Thanks, Andy. http://reviews.llvm.org/D15636 ___ cfe-c

Re: [PATCH] D15636: Reduce false positives in printf/scanf format checker

2016-01-12 Thread Andy Gibbs via cfe-commits
AndyG added a comment. Bump! :o) http://reviews.llvm.org/D15636 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D15636: Reduce false positives in printf/scanf format checker

2015-12-21 Thread Andy Gibbs via cfe-commits
AndyG added a comment. Richard, David, Sorry, I've added you as reviewers by proximity to recent relevant changes in SemaChecking.cpp. Hope you don't mind. Please tell me who to redirect to, if there are more applicable reviewers. Cheers Andy http://reviews.llvm.org/D15636 _

[PATCH] D15636: Reduce false positives in printf/scanf format checker

2015-12-18 Thread Andy Gibbs via cfe-commits
AndyG created this revision. AndyG added a reviewer: cfe-commits. The printf/scanf format checker is a little over-zealous in handling the conditional operator. This patch reduces work by not checking code-paths that are never used and reduces false positives regarding uncovered arguments, for