summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/return.c
Commit message (Collapse)AuthorAgeFilesLines
* [Diagnostics] Try to improve warning message for -Wreturn-typeDávid Bolvanský2019-11-091-22/+22
| | | | | | | | | | | | | | Summary: I agree with https://easyaspi314.github.io/gcc-vs-clang.html?fbclid=IwAR1VA0qxiWVUusOQUv5z7JESS7ZpeJy-UqAI5mnJscofGLqXcqeErIUB2gU, current warning message is not very good. We should try to improve it.. Reviewers: rsmith, aaron.ballman, easyaspi314 Reviewed By: aaron.ballman Subscribers: arphaman, Quuxplusone, mehdi_amini, hiraditya, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D69762
* [CFG] Fix CFG for statement-expressions in return values.Artem Dergachev2019-08-291-0/+11
| | | | | | | | | | | We're building the CFG from bottom to top, so when the return-value expression has a non-trivial CFG on its own, we need to continue building from the entry to the return-value expression CFG rather than from the block to which we've just appended the return statement. Fixes a false positive warning "control may reach end of non-void function". llvm-svn: 370406
* Teach Wreturn-type, Wunreachable-code, and alpha.deadcode.UnreachableCode to ↵Nico Weber2018-02-131-0/+12
| | | | | | | | | treat __assume(0) like __builtin_unreachable. Fixes PR29134. https://reviews.llvm.org/D43221 llvm-svn: 325052
* Fix recent regressions in -Wreturn-type caused by heuristics to ↵Ted Kremenek2014-03-071-1/+35
| | | | | | | | | | | | | | | | | -Wunreachable-code. I had forgotten that the same reachability code is used by both -Wreturn-type and -Wunreachable-code, so the heuristics applied to the latter were indirectly impacting the former. To address this, the reachability code is more refactored so that whiled the logic at its core is shared, the intention of the clients are better captured and segregated in helper APIs. Fixes PR19074, and also some false positives reported offline to me by Nick Lewycky. llvm-svn: 203209
* CFG: Also apply the filter to the first block in a FilteredCFGBlockIterator.Benjamin Kramer2014-02-281-0/+7
| | | | | | PR18999. llvm-svn: 202491
* Forbid driver use in Sema testsAlp Toker2014-01-161-1/+1
| | | | | | | | This ports the last Sema tests over to use the frontend directly, and adds a local lit substitution to disable inappropriate %clang usage under this directory. llvm-svn: 199348
* Remove setjmp.h header file from Sema/return.c test and include necessaryJyotsna Verma2013-04-161-3/+7
| | | | | | declarations explicitly in the test. llvm-svn: 179604
* Exclude test30 of Sema/return.c for Hexagon since setjmp.h include fileJyotsna Verma2013-04-111-0/+2
| | | | | | is unavailable for Hexagon. llvm-svn: 179310
* For -Wignored-qualifiers, don't warn on qualifiers which we acquire via aRichard Smith2013-03-281-0/+5
| | | | | | | typedef. Also don't warn on the _Atomic type specifier, just on the _Atomic type qualifier. llvm-svn: 178218
* Change the binary operator data recursive evaluator to not stop at the firstRichard Trieu2012-03-211-0/+9
| | | | | | | | | | | non-constant value encountered. This allows the evaluator to deduce that expressions like (x < 5 || true) is equal to true. Previously, it would visit x and determined that the entire expression is could not evaluated to a constant. This fixes PR12318. llvm-svn: 153226
* [frontend] Don't allow a mapping to a warning override an error/fatal mapping.Chad Rosier2012-02-031-1/+1
| | | | | | rdar://10736625 llvm-svn: 149662
* Fix the behavior of -Wignored-qualifiers on return type qualifiers inChandler Carruth2011-02-231-1/+1
| | | | | | | | | | several ways. We now warn for more of the return types, and correctly locate the ignored ones. Also adds fix-it hints to remove the ignored qualifiers. Fixes much of PR9058, although not all of it. Patch by Hans Wennborg, a couple of minor style tweaks from me. llvm-svn: 126321
* test/Sema/return.c: Cygwin does not have _longjmp().NAKAMURA Takumi2010-10-191-1/+1
| | | | | | | Although Cygwin-1.7 has _longjmp(), it would not be essential for this to distinguish Cygwin's version with <cygwin/version.h>. llvm-svn: 116783
* Enhance -Wreturn-type to not warn when control-flow is most likely limited ↵Ted Kremenek2010-09-091-0/+13
| | | | | | | | by a switch statement explicitly covering all the cases for an enum value. llvm-svn: 113450
* Get rid of the "functions declared 'noreturn' should have a 'void' result ↵Anders Carlsson2010-09-031-1/+1
| | | | | | | | | type" warning. The rationale behind this is that it is normal for callback functions to have a non-void return type and it should still be possible to mark them noreturn. (JavaScriptCore is a good example of this). llvm-svn: 112918
* Add warning for functions/blocks that have attribute 'noreturn' but return a ↵Ted Kremenek2010-08-191-1/+1
| | | | | | non-void result. (<rdar://problem/7562925>) llvm-svn: 111492
* Wire up '-Wignored-qualifiers' to the warning on 'const' in 'const int f()'.Chandler Carruth2010-07-141-1/+4
| | | | | | | | | This flag and warning match GCC semantics. Also, move it to -Wextra as this is a largely cosmetic issue and doesn't seem to mask problems. Subsequent fixes to the tests which no longer by default emit the warning. Added explicit test cases for both C and C++ behavior with the warning turned on. llvm-svn: 108325
* fix PR7280 by making the warning on code like this:Chris Lattner2010-07-111-1/+1
| | | | | | | | | | int test1() { return; } default to an error. llvm-svn: 108108
* Update test case.Ted Kremenek2010-04-081-1/+1
| | | | llvm-svn: 100801
* For forward-declared static inline functions, delay CFG-based warnings until weTed Kremenek2010-03-231-0/+3
| | | | | | encounter a definition. llvm-svn: 99243
* Only perform CFG-based warnings on 'static inline' functions thatTed Kremenek2010-03-231-0/+14
| | | | | | | are called (transitively) by regular functions/blocks within a translation untion. llvm-svn: 99233
* Improve the unused-value check to look into comma expressions and filter outJohn McCall2010-03-121-1/+1
| | | | | | | | voids in sub-expressions. Patch by Mike M! Fixes PR4806. llvm-svn: 98335
* Insulate these from changes to the default for -Wunreachable-code.Mike Stump2010-01-231-1/+1
| | | | llvm-svn: 94326
* Revert r91073.Mike Stump2009-12-171-4/+0
| | | | llvm-svn: 91629
* Update tests to use %clang instead of 'clang', and forcibly disable use of 'Daniel Dunbar2009-12-151-1/+1
| | | | | | | clang ' or ' clang -cc1 ' or ' clang-cc ' in test lines (by substituting them to garbage). llvm-svn: 91460
* Don't complain about falling off the end of a function with an asmMike Stump2009-12-101-0/+4
| | | | | | | block, if the function is supposed to return a value as we don't know exactly what the asm code does. llvm-svn: 91073
* Use clang to run tests which include headers from the system.Daniel Dunbar2009-11-171-1/+1
| | | | llvm-svn: 89085
* Fix some Window-isms to get these tests to pass on Windows.John Thompson2009-10-291-0/+4
| | | | llvm-svn: 85450
* Be sure to turn on -fblocks.Mike Stump2009-07-291-1/+1
| | | | llvm-svn: 77406
* Add support for -Wmissing-noreturn.Mike Stump2009-07-281-0/+10
| | | | llvm-svn: 77391
* Ensure we can work through typedefs.Mike Stump2009-07-271-0/+3
| | | | llvm-svn: 77265
* Add knowledge about _longjmp being noreturn.Mike Stump2009-07-271-1/+4
| | | | llvm-svn: 77254
* Add builtin knowledge about longjmp being noreturn. Add printing forMike Stump2009-07-271-0/+6
| | | | | | the noreturn attribute. llvm-svn: 77253
* Add noreturn for exit.Mike Stump2009-07-271-0/+5
| | | | llvm-svn: 77237
* add bugzilla #Chris Lattner2009-07-271-0/+1
| | | | llvm-svn: 77183
* Fix PR4624.Mike Stump2009-07-271-0/+3
| | | | llvm-svn: 77176
* Add noreturn as a type attribute, handle printing for them and handleMike Stump2009-07-251-0/+4
| | | | | | calls to noreturn function pointers when CFG building. llvm-svn: 77089
* Add warning for falling off the end of a function that should return aMike Stump2009-07-221-0/+173
| | | | | | | | | | | | | | | | | | | | | value. This is on by default, and controlled by -Wreturn-type (-Wmost -Wall). I believe there should be very few false positives, though the most interesting case would be: int() { bar(); } when bar does: bar() { while (1) ; } Here, we assume functions return, unless they are marked with the noreturn attribute. I can envision a fixit note for functions that never return normally that don't have a noreturn attribute to add a noreturn attribute. If anyone spots other false positives, let me know! llvm-svn: 76821
* Name the "return-type" DiagGroup and reference it in a few places.Steve Naroff2009-04-301-0/+3
| | | | llvm-svn: 70500
* Warn about invalid return statements by default.Steve Naroff2009-04-301-0/+9
This fixes <rdar://problem/6839489> 10A345: Clang does not warm about mismatched returns (void return from a bool function) Will implement -Wreturn-type, -Wno-return-type in another commit. llvm-svn: 70492
OpenPOWER on IntegriCloud