summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Analysis/null-deref-ps.c4
-rw-r--r--clang/test/Sema/return.c9
2 files changed, 11 insertions, 2 deletions
diff --git a/clang/test/Analysis/null-deref-ps.c b/clang/test/Analysis/null-deref-ps.c
index bd63c7edf0e..2b0ed0aadbc 100644
--- a/clang/test/Analysis/null-deref-ps.c
+++ b/clang/test/Analysis/null-deref-ps.c
@@ -69,7 +69,7 @@ int f4_b() {
*p = 5; // no-warning
p = 0;
}
- else return;
+ else return; // expected-warning {{non-void function 'f4_b' should return a value}}
*p += 10; // expected-warning{{Dereference of null pointer}}
}
@@ -160,7 +160,7 @@ int* f10(int* p, signed char x, int y) {
// This tests that our symbolication worked, and that we correctly test
// x against 0 (with the same bitwidth).
if (!x) {
- if (!p) return;
+ if (!p) return; // expected-warning {{non-void function 'f10' should return a value}}
*p = 10;
}
else p = 0;
diff --git a/clang/test/Sema/return.c b/clang/test/Sema/return.c
new file mode 100644
index 00000000000..b32b2e9eeb0
--- /dev/null
+++ b/clang/test/Sema/return.c
@@ -0,0 +1,9 @@
+// RUN: clang-cc %s -fsyntax-only -verify
+
+// clang emits the following warning by default.
+// With GCC, -pedantic, -Wreturn-type or -Wall are required to produce the
+// following warning.
+int t14() {
+ return; // expected-warning {{non-void function 't14' should return a value}}
+}
+
OpenPOWER on IntegriCloud