From: Richard Stallman Date: Tue, 7 Jul 1992 01:09:25 +0000 (+0000) Subject: (finish_function): If return type of `main' is not `int', X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8e077183b4b711155a3270b25bd7e901b3546fb9;p=gcc.git (finish_function): If return type of `main' is not `int', warn instead of doing DEFAULT_MAIN_RETURN. From-SVN: r1486 --- diff --git a/gcc/c-decl.c b/gcc/c-decl.c index c9d2815b3af..4f004716280 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -5786,8 +5786,13 @@ finish_function (nested) #ifdef DEFAULT_MAIN_RETURN if (! strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)), "main")) { - /* Make it so that `main' always returns success by default. */ - DEFAULT_MAIN_RETURN; + if (TREE_TYPE (fndecl) != integer_type_node) + warning_with_decl (fndecl, "return type of `%s' is not `int'"); + else + { + /* Make it so that `main' always returns success by default. */ + DEFAULT_MAIN_RETURN; + } } #endif