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:
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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user