Commit bdbf0360 authored by law's avatar law
Browse files

* c-decl.c (finish_function): Don't treat 'main' specially unless

	flag_hosted.  In C99 mode, return 0 from 'main' unless
	DEFAULT_MAIN_RETURN is otherwise defined.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35300 138bc75d-0d04-0410-961f-82ee72b054a4
parent a7d2c7fd
......@@ -10,6 +10,10 @@
 
2000-07-27 Joseph S. Myers <jsm28@cam.ac.uk>
 
* c-decl.c (finish_function): Don't treat 'main' specially unless
flag_hosted. In C99 mode, return 0 from 'main' unless
DEFAULT_MAIN_RETURN is otherwise defined.
* c-decl.c (store_parm_decls): In C99 mode, pedwarn for function
parameters defaulting to int in an old-style function definition.
 
......
......@@ -6589,7 +6589,8 @@ finish_function (nested)
setjmp_protect_args ();
}
if (! strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)), "main"))
if (! strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)), "main")
&& flag_hosted)
{
if (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (fndecl)))
!= integer_type_node)
......@@ -6604,6 +6605,9 @@ finish_function (nested)
#ifdef DEFAULT_MAIN_RETURN
/* Make it so that `main' always returns success by default. */
DEFAULT_MAIN_RETURN;
#else
if (flag_isoc99)
c_expand_return (integer_zero_node);
#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