diff options
author | Mike Stump <mrs@apple.com> | 2009-07-27 21:45:16 +0000 |
---|---|---|
committer | Mike Stump <mrs@apple.com> | 2009-07-27 21:45:16 +0000 |
commit | 773db1d4b5974a1849d0214900f5006f98adea5b (patch) | |
tree | d5220fa927731a48be0d90423ff9ab551b8285f0 | |
parent | fd350b5b4ae557d6b74899b945e77508f33149a9 (diff) |
Add knowledge about _longjmp being noreturn.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77254 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 4 | ||||
-rw-r--r-- | test/Sema/return.c | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index d168a907a0..27c109f9f0 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -3705,8 +3705,8 @@ void Sema::AddKnownFunctionAttributes(FunctionDecl *FD) { if (!FD->getAttr<FormatAttr>()) FD->addAttr(::new (Context) FormatAttr("printf", 2, Name->isStr("vasprintf") ? 0 : 3)); - } else if (Name->isStr("longjmp") && - !FD->hasAttr<NoReturnAttr>()) + } else if ((Name->isStr("longjmp") || Name->isStr("_longjmp")) + && !FD->hasAttr<NoReturnAttr>()) FD->addAttr(::new (Context) NoReturnAttr()); } diff --git a/test/Sema/return.c b/test/Sema/return.c index f439ad7994..c04337924a 100644 --- a/test/Sema/return.c +++ b/test/Sema/return.c @@ -200,5 +200,8 @@ int test29() { #include <setjmp.h> jmp_buf test30_j; int test30() { - longjmp(test30_j, 1); + if (j) + longjmp(test30_j, 1); + else + _longjmp(test30_j, 1); } |