mirror of
https://github.com/mirror/tinycc.git
synced 2025-03-12 09:00:09 +08:00
Fix noreturn in main()
ISO C requires 'main' falling through the end without explicit returns to implicitely return 0 (if declared as returning int).
This commit is contained in:
parent
61ba9f2299
commit
3b9c3fd186
9
tccgen.c
9
tccgen.c
@ -7118,6 +7118,15 @@ static void gen_function(Sym *sym)
|
||||
local_scope = 0;
|
||||
rsym = 0;
|
||||
block(NULL, NULL, 0);
|
||||
if (!(nocode_wanted & 0x20000000)
|
||||
&& ((func_vt.t & VT_BTYPE) == VT_INT)
|
||||
&& !strcmp (funcname, "main"))
|
||||
{
|
||||
nocode_wanted = 0;
|
||||
vpushi(0);
|
||||
gen_assign_cast(&func_vt);
|
||||
gfunc_return(&func_vt);
|
||||
}
|
||||
nocode_wanted = 0;
|
||||
gsym(rsym);
|
||||
gfunc_epilog();
|
||||
|
Loading…
Reference in New Issue
Block a user