summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-06-29 04:52:37 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-06-29 04:52:37 -0700
commitf97d109da4c4c7ba9dde853e78ab496a167c98a0 (patch)
tree0c4f9dab03e1e2aff86a76dc3cd37435fa98dc3a
parent6053445daa24a94303e5f3491bf85574ce38f2f9 (diff)
downloadtxr-f97d109da4c4c7ba9dde853e78ab496a167c98a0.tar.gz
txr-f97d109da4c4c7ba9dde853e78ab496a167c98a0.tar.bz2
txr-f97d109da4c4c7ba9dde853e78ab496a167c98a0.zip
ffi: reject bitfields as arguments or return values.
* ffi.c (ffi_make_call_desc): Throw error if argument or return value is a bitfield.
-rw-r--r--ffi.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ffi.c b/ffi.c
index 1c3b928c..4a2db26d 100644
--- a/ffi.c
+++ b/ffi.c
@@ -4103,6 +4103,9 @@ val ffi_make_call_desc(val ntotal, val nfixed, val rettype, val argtypes)
if (tft->size == 0)
uw_throwf(error_s, lit("~a: can't pass type ~s by value"),
self, type, nao);
+ if (bitfield_syntax_p(tft->syntax))
+ uw_throwf(error_s, lit("~a: can't pass bitfield as argument"),
+ self, nao);
args[i] = tft->ft;
}
@@ -4111,6 +4114,9 @@ val ffi_make_call_desc(val ntotal, val nfixed, val rettype, val argtypes)
if (tft->size == 0 && tft->ft != &ffi_type_void)
uw_throwf(error_s, lit("~a: can't return type ~s by value"),
self, rettype, nao);
+ if (bitfield_syntax_p(tft->syntax))
+ uw_throwf(error_s, lit("~a: can't return bitfield from function"),
+ self, nao);
}
if (tfcd->variadic)