Error out when assigning void value.
tcc should now error out when compiling code like: VOID ExitProcess(UINT uExitCode); (…) retCode = ExitProcess(pi.dwProcessId);
This commit is contained in:
parent
9c25ed13b4
commit
3ab269c56a
1 changed files with 2 additions and 0 deletions
2
tccgen.c
2
tccgen.c
|
@ -2258,6 +2258,8 @@ static void gen_assign_cast(CType *dt)
|
||||||
st = &vtop->type; /* source type */
|
st = &vtop->type; /* source type */
|
||||||
dbt = dt->t & VT_BTYPE;
|
dbt = dt->t & VT_BTYPE;
|
||||||
sbt = st->t & VT_BTYPE;
|
sbt = st->t & VT_BTYPE;
|
||||||
|
if (sbt == VT_VOID)
|
||||||
|
tcc_error("Cannot assign void value");
|
||||||
if (dt->t & VT_CONSTANT)
|
if (dt->t & VT_CONSTANT)
|
||||||
tcc_warning("assignment of read-only location");
|
tcc_warning("assignment of read-only location");
|
||||||
switch(dbt) {
|
switch(dbt) {
|
||||||
|
|
Loading…
Reference in a new issue