summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/unused-expr.c
Commit message (Collapse)AuthorAgeFilesLines
* Warn on dropping the return value from a warn_unused_result function, even inMatt Beaumont-Gay2013-02-261-0/+6
| | | | | | macros. llvm-svn: 176114
* Suppress all -Wunused-value warnings from macro body expansions.Matt Beaumont-Gay2013-01-171-3/+20
| | | | | | | | | | | | | | | | | | | This is inspired by a number of false positives in real code, including PR14968. I've added test cases reduced from these false positives to test/Sema/unused-expr.c, as well as corresponding test cases that pass the offending expressions as arguments to a no-op macro to ensure that we do warn there. This also removes my previous tweak from r166522/r166534, so that we warn on unused cast expressions in macro arguments. There were several test cases that were using -Wunused-value to test general diagnostic emission features; I changed those to use other warnings or warn on a macro argument expression. I stared at the test case for PR14399 for a while with Richard Smith and we believe the new test case exercises the same codepaths as before. llvm-svn: 172696
* Address feedback from Eli Friedman on r166522.Matt Beaumont-Gay2012-10-241-4/+8
| | | | | | | In particular, we do want to warn on some unused cast subexpressions within macros. llvm-svn: 166534
* Don't emit -Wunused-value warnings from macro expansions.Matt Beaumont-Gay2012-10-231-0/+7
| | | | llvm-svn: 166522
* c: small refactoring of checking for __attribute__(const))Fariborz Jahanian2012-08-131-2/+0
| | | | | | per Richard's comment. llvm-svn: 161786
* c: make __has_attribute(const) work for constFariborz Jahanian2012-08-131-1/+3
| | | | | | function attribute. // rdar://10253857 llvm-svn: 161767
* Add a warning to diagnose statements in C++ like "*(volatile int*)x;". ↵Eli Friedman2012-05-241-0/+1
| | | | | | Conceptually, this is part of -Wunused-value, but I added a separate flag -Wunused-volatile-lvalue so it doesn't get turned off by accident with -Wno-unused-value. I also made a few minor improvements to existing unused value warnings in the process. <rdar://problem/11516811>. llvm-svn: 157362
* Treating the unused equality comparisons as something other than part ofChandler Carruth2011-08-171-10/+10
| | | | | | | | | | | | | | | | | | | | | -Wunused was a mistake. It resulted in duplicate warnings and lots of other hacks. Instead, this should be a special sub-category to -Wunused-value, much like -Wunused-result is. Moved to -Wunused-comparison, moved the implementation to piggy back on the -Wunused-value implementation instead of rolling its own, different mechanism for catching all of the "interesting" statements. I like the unused-value mechanism for this better, but its currently missing several top-level statements. For now, I've FIXME-ed out those test cases. I'll enhance the generic infrastructure to catch these statements in a subsequent patch. This patch also removes the cast-to-void fixit hint. This hint isn't available on any of the other -Wunused-value diagnostics, and if we want it to be, we should add it generically rather than in one specific case. llvm-svn: 137822
* Change the wording of the bad-decl-for-attribute warning and errorJohn McCall2011-01-251-1/+1
| | | | | | to make it clear that we're talking about the declarations and not the types. llvm-svn: 124175
* testcase for http://llvm.org/PR8371 of my last commit, r116570Gabor Greif2010-10-151-0/+3
| | | | llvm-svn: 116571
* Revert r114316, -Wunused-value enabled by default was intended.Argyrios Kyrtzidis2010-09-191-1/+1
| | | | llvm-svn: 114318
* Make -Wunused-value off by default, matching GCC. Fixes rdar://7126194.Argyrios Kyrtzidis2010-09-191-1/+1
| | | | llvm-svn: 114316
* Don't complain about an __builtin_va_arg expression's result beingDouglas Gregor2010-05-081-0/+8
| | | | | | unused, since the operation has side effects. llvm-svn: 103360
* Devote a special diagnostic to the typoJohn McCall2010-04-061-0/+6
| | | | | | | (void*) someFunction(5, 10, 15, 20); where the cast is presumably meant to be to 'void'. llvm-svn: 100574
* Insulate these from changes to the default for -Wunreachable-code.Mike Stump2010-01-231-1/+1
| | | | llvm-svn: 94326
* Use -fno-math-errno by default, and remove the IsMathErrnoDefaultDan Gohman2010-01-081-3/+3
| | | | | | targethook, which is no longer being used. This fixes PR5971. llvm-svn: 92987
* testcase for previous patch!Chris Lattner2009-12-301-0/+1
| | | | llvm-svn: 92317
* warn when attribute warn_unused_result is applied to void functions.Nuno Lopes2009-12-221-2/+4
| | | | | | while at it, remove an outdated FIXME llvm-svn: 91946
* fix PR4010: add support for the warn_unused_result for function pointersNuno Lopes2009-12-201-0/+5
| | | | llvm-svn: 91803
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-151-1/+1
| | | | | | | | | - This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). llvm-svn: 91446
* Switch -f{builtin,math-errno,rtti} and -analyzer-purge-dead to -...no... ↵Daniel Dunbar2009-11-191-1/+1
| | | | | | variants instead of using llvm::cl::init(true) arguments. llvm-svn: 89315
* add rdar # I accidentally lost.Chris Lattner2009-10-131-1/+1
| | | | llvm-svn: 83942
* merge two tests.Chris Lattner2009-10-131-0/+18
| | | | llvm-svn: 83941
* make the diagnostic in the 'unused result' warning more preciseChris Lattner2009-10-131-2/+6
| | | | | | about the reason, rdar://7186119. llvm-svn: 83940
* More warnings for unused expressions.Anders Carlsson2009-08-011-0/+4
| | | | llvm-svn: 77763
* Diagnose unused expression results for all statements, just not compound ↵Anders Carlsson2009-07-301-0/+19
| | | | | | statements. llvm-svn: 77631
* fix PR4633: cast to void should silence the 'unused expression' warning.Chris Lattner2009-07-281-0/+7
| | | | llvm-svn: 77344
* Driver: Manually translate a number of -f with no- variants options toDaniel Dunbar2009-04-071-1/+1
| | | | | | | | | | | | clang. - We will eventually want some more driver infrastructre for this probably. - For now, the clang-cc interface stays relatively the same, but we don't accept multiple instances anymore, or the [no-] variants directly. llvm-svn: 68550
* Rename clang to clang-cc.Daniel Dunbar2009-03-241-1/+1
| | | | | | Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
* add support for -fno-math-errno, and validate that it affects sema properly.Chris Lattner2009-02-171-1/+6
| | | | llvm-svn: 64708
* sema no longer explodes, yay!Chris Lattner2009-02-171-3/+2
| | | | llvm-svn: 64707
* Make the unused expression warning a bit less aggressive (found in PHP Eli Friedman2008-05-191-0/+5
| | | | | | code). llvm-svn: 51276
* rename -parse-ast-print to -ast-printChris Lattner2007-10-111-1/+1
| | | | | | | rename -parse-ast-dump to -ast-dump remove -parse-ast, which is redundant with -fsyntax-only llvm-svn: 42852
* Removed option "-parse-ast-check" from clang driver. This is now implementedTed Kremenek2007-09-261-1/+1
| | | | | | | | | | | | using "-parse-ast -verify". Updated all test cases (using a sed script) that invoked -parse-ast-check to now use -parse-ast -verify. Fixed a bug where using "-verify" instead of "-parse-ast-check" would not correctly create the DiagClient needed to accumulate diagnostics. llvm-svn: 42365
* Fix a bug/missing-feature Ted noticed: the 'unused' warning should notChris Lattner2007-08-311-0/+5
| | | | | | | | | | warn about the last stmt in a stmtexpr, f.e. there should be no warning for: int maxval_stmt_expr(int x, int y) { return ({int _a = x, _b = y; _a > _b ? _a : _b; }); } llvm-svn: 41655
* Add Type::getAsBuiltinType() and Type::builtinTypesAreCompatible().Steve Naroff2007-08-271-2/+1
| | | | | | | | | | | | | | | | Modified Type::typesAreCompatible() to use the above. This fixes the following bug submitted by Keith Bauer (thanks!). int equal(char *a, const char *b) { return a == b; } Also tweaked Sema::CheckCompareOperands() to ignore the qualifiers when comparing two pointer types (though it doesn't relate directly to this bug). llvm-svn: 41476
* Fix a bug reported by Keith BauerChris Lattner2007-08-261-1/+7
| | | | llvm-svn: 41452
* we now correctly emit:Chris Lattner2007-08-211-1/+2
| | | | | | | | unused-expr.c:8:6: warning: comparison of distinct pointer types ('int volatile *' and 'int *') VP == P; ~~ ^ ~ llvm-svn: 41210
* New testcase for unused expression analysisChris Lattner2007-06-271-0/+26
llvm-svn: 39683
OpenPOWER on IntegriCloud