[cfe-commits] r77254 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/Sema/return.c
Daniel Dunbar
daniel at zuster.org
Mon Jul 27 14:51:07 PDT 2009
Shouldn't this be done by recognizing longjmp as a builtin, and having
an attribute there?
- Daniel
On Mon, Jul 27, 2009 at 2:45 PM, Mike Stump<mrs at apple.com> wrote:
> Author: mrs
> Date: Mon Jul 27 16:45:16 2009
> New Revision: 77254
>
> URL: http://llvm.org/viewvc/llvm-project?rev=77254&view=rev
> Log:
> Add knowledge about _longjmp being noreturn.
>
> Modified:
> cfe/trunk/lib/Sema/SemaDecl.cpp
> cfe/trunk/test/Sema/return.c
>
> Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=77254&r1=77253&r2=77254&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Jul 27 16:45:16 2009
> @@ -3705,8 +3705,8 @@
> 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());
> }
>
>
> Modified: cfe/trunk/test/Sema/return.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/return.c?rev=77254&r1=77253&r2=77254&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/Sema/return.c (original)
> +++ cfe/trunk/test/Sema/return.c Mon Jul 27 16:45:16 2009
> @@ -200,5 +200,8 @@
> #include <setjmp.h>
> jmp_buf test30_j;
> int test30() {
> - longjmp(test30_j, 1);
> + if (j)
> + longjmp(test30_j, 1);
> + else
> + _longjmp(test30_j, 1);
> }
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
More information about the cfe-commits
mailing list