summaryrefslogtreecommitdiff
path: root/test/Sema/return.c
Commit message (Collapse)AuthorAge
* Fix recent regressions in -Wreturn-type caused by heuristics to ↵Ted Kremenek2014-03-07
| | | | | | | | | | | | | | | | | -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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203209 91177308-0d34-0410-b5e6-96231b3b80d8
* CFG: Also apply the filter to the first block in a FilteredCFGBlockIterator.Benjamin Kramer2014-02-28
| | | | | | PR18999. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202491 91177308-0d34-0410-b5e6-96231b3b80d8
* Forbid driver use in Sema testsAlp Toker2014-01-16
| | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199348 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove setjmp.h header file from Sema/return.c test and include necessaryJyotsna Verma2013-04-16
| | | | | | | | declarations explicitly in the test. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179604 91177308-0d34-0410-b5e6-96231b3b80d8
* Exclude test30 of Sema/return.c for Hexagon since setjmp.h include fileJyotsna Verma2013-04-11
| | | | | | | is unavailable for Hexagon. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179310 91177308-0d34-0410-b5e6-96231b3b80d8
* For -Wignored-qualifiers, don't warn on qualifiers which we acquire via aRichard Smith2013-03-28
| | | | | | | | typedef. Also don't warn on the _Atomic type specifier, just on the _Atomic type qualifier. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178218 91177308-0d34-0410-b5e6-96231b3b80d8
* Change the binary operator data recursive evaluator to not stop at the firstRichard Trieu2012-03-21
| | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153226 91177308-0d34-0410-b5e6-96231b3b80d8
* [frontend] Don't allow a mapping to a warning override an error/fatal mapping.Chad Rosier2012-02-03
| | | | | | rdar://10736625 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149662 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the behavior of -Wignored-qualifiers on return type qualifiers inChandler Carruth2011-02-23
| | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126321 91177308-0d34-0410-b5e6-96231b3b80d8
* test/Sema/return.c: Cygwin does not have _longjmp().NAKAMURA Takumi2010-10-19
| | | | | | | | Although Cygwin-1.7 has _longjmp(), it would not be essential for this to distinguish Cygwin's version with <cygwin/version.h>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116783 91177308-0d34-0410-b5e6-96231b3b80d8
* Enhance -Wreturn-type to not warn when control-flow is most likely limited ↵Ted Kremenek2010-09-09
| | | | | | | | by a switch statement explicitly covering all the cases for an enum value. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113450 91177308-0d34-0410-b5e6-96231b3b80d8
* Get rid of the "functions declared 'noreturn' should have a 'void' result ↵Anders Carlsson2010-09-03
| | | | | | | | | | | 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). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112918 91177308-0d34-0410-b5e6-96231b3b80d8
* Add warning for functions/blocks that have attribute 'noreturn' but return a ↵Ted Kremenek2010-08-19
| | | | | | non-void result. (<rdar://problem/7562925>) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111492 91177308-0d34-0410-b5e6-96231b3b80d8
* Wire up '-Wignored-qualifiers' to the warning on 'const' in 'const int f()'.Chandler Carruth2010-07-14
| | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108325 91177308-0d34-0410-b5e6-96231b3b80d8
* fix PR7280 by making the warning on code like this:Chris Lattner2010-07-11
| | | | | | | | | | | | int test1() { return; } default to an error. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108108 91177308-0d34-0410-b5e6-96231b3b80d8
* Update test case.Ted Kremenek2010-04-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100801 91177308-0d34-0410-b5e6-96231b3b80d8
* For forward-declared static inline functions, delay CFG-based warnings until weTed Kremenek2010-03-23
| | | | | | encounter a definition. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99243 91177308-0d34-0410-b5e6-96231b3b80d8
* Only perform CFG-based warnings on 'static inline' functions thatTed Kremenek2010-03-23
| | | | | | | are called (transitively) by regular functions/blocks within a translation untion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99233 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve the unused-value check to look into comma expressions and filter outJohn McCall2010-03-12
| | | | | | | | | | voids in sub-expressions. Patch by Mike M! Fixes PR4806. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98335 91177308-0d34-0410-b5e6-96231b3b80d8
* Insulate these from changes to the default for -Wunreachable-code.Mike Stump2010-01-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94326 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r91073.Mike Stump2009-12-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91629 91177308-0d34-0410-b5e6-96231b3b80d8
* Update tests to use %clang instead of 'clang', and forcibly disable use of 'Daniel Dunbar2009-12-15
| | | | | | | clang ' or ' clang -cc1 ' or ' clang-cc ' in test lines (by substituting them to garbage). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91460 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't complain about falling off the end of a function with an asmMike Stump2009-12-10
| | | | | | | | block, if the function is supposed to return a value as we don't know exactly what the asm code does. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91073 91177308-0d34-0410-b5e6-96231b3b80d8
* Use clang to run tests which include headers from the system.Daniel Dunbar2009-11-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89085 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix some Window-isms to get these tests to pass on Windows.John Thompson2009-10-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85450 91177308-0d34-0410-b5e6-96231b3b80d8
* Be sure to turn on -fblocks.Mike Stump2009-07-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77406 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for -Wmissing-noreturn.Mike Stump2009-07-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77391 91177308-0d34-0410-b5e6-96231b3b80d8
* Ensure we can work through typedefs.Mike Stump2009-07-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77265 91177308-0d34-0410-b5e6-96231b3b80d8
* Add knowledge about _longjmp being noreturn.Mike Stump2009-07-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77254 91177308-0d34-0410-b5e6-96231b3b80d8
* Add builtin knowledge about longjmp being noreturn. Add printing forMike Stump2009-07-27
| | | | | | | the noreturn attribute. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77253 91177308-0d34-0410-b5e6-96231b3b80d8
* Add noreturn for exit.Mike Stump2009-07-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77237 91177308-0d34-0410-b5e6-96231b3b80d8
* add bugzilla #Chris Lattner2009-07-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77183 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR4624.Mike Stump2009-07-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77176 91177308-0d34-0410-b5e6-96231b3b80d8
* Add noreturn as a type attribute, handle printing for them and handleMike Stump2009-07-25
| | | | | | | calls to noreturn function pointers when CFG building. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77089 91177308-0d34-0410-b5e6-96231b3b80d8
* Add warning for falling off the end of a function that should return aMike Stump2009-07-22
| | | | | | | | | | | | | | | | | | | | | | 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! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76821 91177308-0d34-0410-b5e6-96231b3b80d8
* Name the "return-type" DiagGroup and reference it in a few places.Steve Naroff2009-04-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70500 91177308-0d34-0410-b5e6-96231b3b80d8
* Warn about invalid return statements by default.Steve Naroff2009-04-30
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70492 91177308-0d34-0410-b5e6-96231b3b80d8