diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-09-26 03:48:56 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-09-26 03:48:56 +0000 |
commit | f679a986df5514bb42e001a5afd149f839ebed03 (patch) | |
tree | c51dc2f5d38ccdf6ead09e1e74d113ead0d90a33 | |
parent | c5df30fe345613bacd6810f3d7ec02e4b9ac853f (diff) |
Add two more test cases for attribute 'noreturn'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82841 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/Sema/return-noreturn.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/Sema/return-noreturn.c b/test/Sema/return-noreturn.c index 0a227a61cc..20df857d3b 100644 --- a/test/Sema/return-noreturn.c +++ b/test/Sema/return-noreturn.c @@ -10,3 +10,14 @@ void test1() { // expected-warning {{function could be attribute 'noreturn'}} void test2() { if (j) while (1) { } } + +// This test case illustrates that we don't warn about the missing return +// because the function is marked noreturn and there is an infinite loop. +extern int foo_test_3(); +__attribute__((__noreturn__)) void* test3(int arg) { + while (1) foo_test_3(); +} + +__attribute__((__noreturn__)) void* test3_positive(int arg) { + while (0) foo_test_3(); +} // expected-warning{{function declared 'noreturn' should not return}} |