From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; 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. --- gcc/testsuite/c-c++-common/pr20000.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 gcc/testsuite/c-c++-common/pr20000.c (limited to 'gcc/testsuite/c-c++-common/pr20000.c') 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(); +} -- cgit v1.2.3