Commit 8e077183 by Richard Stallman

(finish_function): If return type of `main' is not `int',

warn instead of doing DEFAULT_MAIN_RETURN.

From-SVN: r1486
parent de86a82e
...@@ -5786,8 +5786,13 @@ finish_function (nested) ...@@ -5786,8 +5786,13 @@ finish_function (nested)
#ifdef DEFAULT_MAIN_RETURN #ifdef DEFAULT_MAIN_RETURN
if (! strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)), "main")) if (! strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)), "main"))
{ {
/* Make it so that `main' always returns success by default. */ if (TREE_TYPE (fndecl) != integer_type_node)
DEFAULT_MAIN_RETURN; 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 #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment