aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@gcc.gnu.org>2002-02-07 07:36:46 -0500
committerJason Merrill <jason@gcc.gnu.org>2002-02-07 07:36:46 -0500
commit3adb9cb9af7fc3ae9d857bb11eb6e8a530718d5a (patch)
tree8cd4f3c67ba632a5d3ce43a6e8c23d318f5a686f
parenta6f3addd0bf743047a29a98235ecde07b41e9790 (diff)
downloadgcc-3adb9cb9af7fc3ae9d857bb11eb6e8a530718d5a.zip
gcc-3adb9cb9af7fc3ae9d857bb11eb6e8a530718d5a.tar.gz
gcc-3adb9cb9af7fc3ae9d857bb11eb6e8a530718d5a.tar.bz2
c-decl.c (finish_function): Warn about a non-void function with no return statement and no abnormal exit.
* c-decl.c (finish_function): Warn about a non-void function with no return statement and no abnormal exit. (current_function_returns_abnormally): New variable. (start_function): Clear it. (struct c_language_function): Add returns_abnormally. (push_c_function_context): Save it. (pop_c_function_context): Restore it. (builtin_function): Set TREE_THIS_VOLATILE on return fns. (grokdeclarator): Set C_FUNCTION_IMPLICIT_INT on functions without an explicit return type. * c-tree.h: Declare current_function_returns_abnormally. (C_FUNCTION_IMPLICIT_INT): New macro. * c-typeck.c (build_function_call): Set it. (c_expand_return): Set current_function_returns_value even if the value is erroneous. From-SVN: r49579
-rw-r--r--gcc/testsuite/gcc.dg/Wreturn-type2.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/Wreturn-type2.c b/gcc/testsuite/gcc.dg/Wreturn-type2.c
new file mode 100644
index 0000000..d57a914
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wreturn-type2.c
@@ -0,0 +1,7 @@
+/* Test for cases that should not get the unconditional warning about
+ missing return. */
+/* { dg-do compile } */
+
+f() {} /* { dg-bogus "" "no return warning" } */
+int g() { abort (); } /* { dg-bogus "" "no return warning" } */
+int main() {} /* { dg-bogus "" "no return warning" } */