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
1 changed files with 9 additions and 0 deletions
9
tccgen.c
9
tccgen.c
|
@ -7118,6 +7118,15 @@ static void gen_function(Sym *sym)
|
||||||
local_scope = 0;
|
local_scope = 0;
|
||||||
rsym = 0;
|
rsym = 0;
|
||||||
block(NULL, NULL, 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;
|
nocode_wanted = 0;
|
||||||
gsym(rsym);
|
gsym(rsym);
|
||||||
gfunc_epilog();
|
gfunc_epilog();
|
||||||
|
|
Loading…
Reference in a new issue