From 5ce89b2ef0de68535d829e3aee23921542d1a0ae Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 6 Feb 2002 15:40:18 -0500 Subject: 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: r49551 --- gcc/c-tree.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'gcc/c-tree.h') diff --git a/gcc/c-tree.h b/gcc/c-tree.h index 03bd683..8f53b17 100644 --- a/gcc/c-tree.h +++ b/gcc/c-tree.h @@ -132,6 +132,10 @@ struct lang_type /* Record whether a typedef for type `int' was actually `signed int'. */ #define C_TYPEDEF_EXPLICITLY_SIGNED(EXP) DECL_LANG_FLAG_1 (EXP) +/* For a FUNCTION_DECL, nonzero if it was defined without an explicit + return type. */ +#define C_FUNCTION_IMPLICIT_INT(EXP) DECL_LANG_FLAG_1 (EXP) + /* Nonzero for a declaration of a built in function if there has been no occasion that would declare the function in ordinary C. Using the function draws a pedantic warning in this case. */ @@ -277,6 +281,11 @@ extern int current_function_returns_value; extern int current_function_returns_null; +/* Set to 0 at beginning of a function definition, set to 1 if + a call to a noreturn function is seen. */ + +extern int current_function_returns_abnormally; + /* Nonzero means the expression being parsed will never be evaluated. This is a count, since unevaluated expressions can nest. */ -- cgit v1.1