diff options
| author | Mike Stump <mrs@apple.com> | 2009-07-22 23:56:57 +0000 |
|---|---|---|
| committer | Mike Stump <mrs@apple.com> | 2009-07-22 23:56:57 +0000 |
| commit | 33979f75a0fd85a29c3d0a70d4985a20773e8ece (patch) | |
| tree | a296fe11dc38d403e333910aefe4eca6200b2f16 /clang/test/SemaObjC/return.m | |
| parent | e93e46c69096c8f6ad9e61578955d60a0de59f1d (diff) | |
| download | bcm5719-llvm-33979f75a0fd85a29c3d0a70d4985a20773e8ece.tar.gz bcm5719-llvm-33979f75a0fd85a29c3d0a70d4985a20773e8ece.zip | |
Add warning for falling off the end of a function that should return a
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
Diffstat (limited to 'clang/test/SemaObjC/return.m')
| -rw-r--r-- | clang/test/SemaObjC/return.m | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/test/SemaObjC/return.m b/clang/test/SemaObjC/return.m new file mode 100644 index 00000000000..9acf4707995 --- /dev/null +++ b/clang/test/SemaObjC/return.m @@ -0,0 +1,6 @@ +// RUN: clang-cc %s -fsyntax-only -verify + +int test1() { + id a; + @throw a; +} |

