summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-06-02 06:48:12 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-06-02 06:48:12 -0700
commitabbc0d00006c3126b9d1cf8150c21f4a8c56089a (patch)
treeadcbb9961fa18d872dddf672e94522c44cc0565b
parentae05a8f6e9dbaa6f18a0d22475ab8fafc2b56506 (diff)
downloadtxr-abbc0d00006c3126b9d1cf8150c21f4a8c56089a.tar.gz
txr-abbc0d00006c3126b9d1cf8150c21f4a8c56089a.tar.bz2
txr-abbc0d00006c3126b9d1cf8150c21f4a8c56089a.zip
ffi: don't allow size calculation of bitfield type.
* ffi.c (ffi_size): Check for a bitfield type and diagnose.
-rw-r--r--ffi.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ffi.c b/ffi.c
index 42a16db0..255a318d 100644
--- a/ffi.c
+++ b/ffi.c
@@ -3029,7 +3029,11 @@ val ffi_typedef(val name, val type)
val ffi_size(val type)
{
+ val self = lit("ffi-size");
struct txr_ffi_type *tft = ffi_type_struct_checked(type);
+ if (tft->size == 0 && bitfield_syntax_p(tft->syntax))
+ uw_throwf(error_s, lit("~a: bitfield type ~s has no size"),
+ self, type, nao);
return num(tft->size);
}