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:
Thomas Preud'homme 2012-01-22 21:18:38 +01:00
parent 9c25ed13b4
commit 3ab269c56a

View File

@ -2258,6 +2258,8 @@ static void gen_assign_cast(CType *dt)
st = &vtop->type; /* source type */
dbt = dt->t & VT_BTYPE;
sbt = st->t & VT_BTYPE;
if (sbt == VT_VOID)
tcc_error("Cannot assign void value");
if (dt->t & VT_CONSTANT)
tcc_warning("assignment of read-only location");
switch(dbt) {