This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH to warn about inlines which fail to return a value
Applying some of the additional bits from the C version to C++. Tested
i686-pc-linux-gnu.
2002-02-13 Jason Merrill <jason@redhat.com>
* decl.c (builtin_function): Set TREE_THIS_VOLATILE on return fns.
(finish_function): Don't warn if current_function_returns_null.
*** decl.c.~1~ Wed Feb 13 17:10:46 2002
--- decl.c Wed Feb 13 17:33:51 2002
*************** builtin_function (name, type, code, clas
*** 6719,6724 ****
--- 6719,6728 ----
DECL_BUILT_IN_CLASS (decl) = class;
DECL_FUNCTION_CODE (decl) = code;
+ /* The return builtins leave the current function. */
+ if (code == BUILT_IN_RETURN || code == BUILT_IN_EH_RETURN)
+ TREE_THIS_VOLATILE (decl) = 1;
+
my_friendly_assert (DECL_CONTEXT (decl) == NULL_TREE, 392);
/* All builtins that don't begin with an `_' should go in the `std'
*************** finish_function (flags)
*** 14224,14230 ****
/* Complain if there's just no return statement. */
if (!processing_template_decl
&& TREE_CODE (TREE_TYPE (fntype)) != VOID_TYPE
! && !current_function_returns_value
&& !DECL_NAME (DECL_RESULT (fndecl))
/* Don't complain if we abort or throw. */
&& !current_function_returns_abnormally
--- 14228,14234 ----
/* Complain if there's just no return statement. */
if (!processing_template_decl
&& TREE_CODE (TREE_TYPE (fntype)) != VOID_TYPE
! && !current_function_returns_value && !current_function_returns_null
&& !DECL_NAME (DECL_RESULT (fndecl))
/* Don't complain if we abort or throw. */
&& !current_function_returns_abnormally