FFI: Allow 'typedef _Bool int BOOL;' to make Windows users happy.

This commit is contained in:
Mike Pall
2012-05-08 18:34:12 +02:00
parent 0d824b7d14
commit 886a450a3d
3 changed files with 16 additions and 9 deletions

View File

@@ -1502,8 +1502,13 @@ end_decl:
/* Determine type info and size. */
CTInfo info = CTINFO(CT_NUM, (cds & CDF_UNSIGNED) ? CTF_UNSIGNED : 0);
if ((cds & CDF_BOOL)) {
info = CTINFO(CT_NUM, CTF_UNSIGNED|CTF_BOOL);
lua_assert(sz == 1);
if ((cds & ~(CDF_SCL|CDF_BOOL|CDF_INT|CDF_SIGNED|CDF_UNSIGNED)))
cp_errmsg(cp, 0, LJ_ERR_FFI_INVTYPE);
info |= CTF_BOOL;
if (!sz) {
if (!(cds & CDF_SIGNED)) info |= CTF_UNSIGNED;
sz = 1;
}
} else if ((cds & CDF_FP)) {
info = CTINFO(CT_NUM, CTF_FP);
if ((cds & CDF_LONG)) sz = sizeof(long double);