summaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/pr20000.c
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/c-c++-common/pr20000.c
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/c-c++-common/pr20000.c')
-rw-r--r--gcc/testsuite/c-c++-common/pr20000.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/pr20000.c b/gcc/testsuite/c-c++-common/pr20000.c
new file mode 100644
index 000000000..3c0fb8841
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr20000.c
@@ -0,0 +1,32 @@
+/* PR c/20000 We only want to warn if the function returns
+ explicitly. We do not care about the return type. */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+int g(void) __attribute__((noreturn));
+int g2(void) __attribute__((noreturn)); /* { dg-bogus ".noreturn. function returns non-void value" } */
+void h(void) __attribute__((noreturn));
+
+
+int g(void) {
+ return 1; /* { dg-warning "function declared 'noreturn' has a 'return' statement" } */
+} /* { dg-warning "'noreturn' function does return" "" { target *-*-* } 12 } */
+
+int g2(void) {
+ h();
+}
+
+typedef int ft(void);
+volatile ft vg;
+volatile ft vg2;
+
+int vg(void);
+int vg2(void); /* { dg-bogus ".noreturn. function returns non-void value" } */
+
+int vg(void) {
+ return 1; /* { dg-warning "function declared 'noreturn' has a 'return' statement" "" { target c } 27 } */
+} /* { dg-warning "'noreturn' function does return" "" { target c } 27 } */
+
+int vg2(void) {
+ h();
+}