[cfe-commits] r82841 - /cfe/trunk/test/Sema/return-noreturn.c

Ted Kremenek kremenek at apple.com
Fri Sep 25 20:49:13 PDT 2009


Author: kremenek
Date: Fri Sep 25 22:48:56 2009
New Revision: 82841

URL: http://llvm.org/viewvc/llvm-project?rev=82841&view=rev
Log:
Add two more test cases for attribute 'noreturn'.

Modified:
    cfe/trunk/test/Sema/return-noreturn.c

Modified: cfe/trunk/test/Sema/return-noreturn.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/return-noreturn.c?rev=82841&r1=82840&r2=82841&view=diff

==============================================================================
--- cfe/trunk/test/Sema/return-noreturn.c (original)
+++ cfe/trunk/test/Sema/return-noreturn.c Fri Sep 25 22:48:56 2009
@@ -10,3 +10,14 @@
 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}}





More information about the cfe-commits mailing list