aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/return.c
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-03-23 00:13:23 +0000
committerTed Kremenek <kremenek@apple.com>2010-03-23 00:13:23 +0000
commitd064fdc4b7b64ca55b40b70490c79d6f569df78e (patch)
tree07a0c6fb87b558bbfb070a1aba01717486b9fe47 /test/Sema/return.c
parent22f757b38da3fc9f17ea9e99524064fdfbca3456 (diff)
Only perform CFG-based warnings on 'static inline' functions that
are called (transitively) by regular functions/blocks within a translation untion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99233 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/return.c')
-rw-r--r--test/Sema/return.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/Sema/return.c b/test/Sema/return.c
index 3ab23f4f8f..fad81ad09a 100644
--- a/test/Sema/return.c
+++ b/test/Sema/return.c
@@ -222,3 +222,17 @@ void test32() {
void test33() {
if (j) while (1) { }
}
+
+// Test that 'static inline' functions are only analyzed for CFG-based warnings
+// when they are used.
+static inline int si_has_missing_return() {} // no-warning
+static inline int si_has_missing_return_2() {}; // expected-warning{{control reaches end of non-void function}}
+static inline int si_has_missing_return_3(int x) {
+ if (x)
+ return si_has_missing_return_3(x+1);
+} // expected-warning{{control may reach end of non-void function}}
+
+int test_static_inline(int x) {
+ return x ? si_has_missing_return_2() : si_has_missing_return_3(x);
+}
+