From 3ab269c56ac1bb79956c0160382bb720ca487ca3 Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Sun, 22 Jan 2012 21:18:38 +0100 Subject: [PATCH] Error out when assigning void value. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tcc should now error out when compiling code like: VOID ExitProcess(UINT uExitCode); (…) retCode = ExitProcess(pi.dwProcessId); --- tccgen.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tccgen.c b/tccgen.c index dc67f028..3cf37155 100644 --- a/tccgen.c +++ b/tccgen.c @@ -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) {