Browse Source

FFI: Record calls to functions with void results.

Mike Pall 14 years ago
parent
commit
a720db409d
1 changed files with 8 additions and 2 deletions
  1. 8 2
      src/lj_crecord.c

+ 8 - 2
src/lj_crecord.c

@@ -707,8 +707,14 @@ static int crec_call(jit_State *J, RecordFFData *rd, GCcdata *cd)
     CType *ctr = ctype_rawchild(cts, ct);
     CType *ctr = ctype_rawchild(cts, ct);
     IRType t = crec_ct2irt(ctr);
     IRType t = crec_ct2irt(ctr);
     TRef tr;
     TRef tr;
-    if (ctype_isenum(ctr->info)) ctr = ctype_child(cts, ctr);
-    if (!(ctype_isnum(ctr->info) || ctype_isptr(ctr->info)) ||
+    if (ctype_isvoid(ctr->info)) {
+      t = IRT_NIL;
+      rd->nres = 0;
+    } else if (ctype_isenum(ctr->info)) {
+      ctr = ctype_child(cts, ctr);
+    }
+    if (!(ctype_isnum(ctr->info) || ctype_isptr(ctr->info) ||
+	  ctype_isvoid(ctr->info)) ||
 	ctype_isbool(ctr->info) || (ct->info & CTF_VARARG) ||
 	ctype_isbool(ctr->info) || (ct->info & CTF_VARARG) ||
 #if LJ_TARGET_X86
 #if LJ_TARGET_X86
 	ctype_cconv(ct->info) != CTCC_CDECL ||
 	ctype_cconv(ct->info) != CTCC_CDECL ||