fix plain "&" argument being accepted

This commit is contained in:
dzaima 2024-02-05 00:06:35 +02:00
parent 95c8957dcc
commit 7471c5c9f5
2 changed files with 8 additions and 3 deletions

View File

@ -541,7 +541,7 @@ BQNFFIEnt ffi_parseType(B arg, bool forRes) { // doesn't consume; parse argument
u32* xp = xp0; u32* xp = xp0;
BQNFFIEnt t; BQNFFIEnt t;
if (xp[0]=='&' && xp[1]=='\0') { if (forRes && xp[0]=='&' && xp[1]=='\0') {
t = (BQNFFIEnt){.t = ffi_type_void, .o=m_c32(sty_void), .resSingle=true}; t = (BQNFFIEnt){.t = ffi_type_void, .o=m_c32(sty_void), .resSingle=true};
xp+= 1; xp+= 1;
} else { } else {

View File

@ -64,6 +64,11 @@
!"Type parser: Representation wider than the value for ""i32:f64""" % @•FFI"""bqn_init""i32:f64" !"Type parser: Representation wider than the value for ""i32:f64""" % @•FFI"""bqn_init""i32:f64"
!"Type parser: Garbage at end of type" % @•FFI"""bqn_init""i32 hello world" !"Type parser: Garbage at end of type" % @•FFI"""bqn_init""i32 hello world"
# pointers
!"Type parser: Unexpected end of input" % @•FFI"""bqn_init""&"
!"Type parser: Unexpected character '}'" % @•FFI"""bqn_init""{&}"
!"Type parser: Unexpected character ':'" % @•FFI"""bqn_init""&:i8"
# return value # return value
!"FFI: Function specification must have at least two items" % @•FFI "&" !"FFI: Function specification must have at least two items" % @•FFI "&"
!"FFI: Return value is specified as ""&"", but there are 0 mutated values" % @•FFI"&""bqn_init"">*i32" !"FFI: Return value is specified as ""&"", but there are 0 mutated values" % @•FFI"&""bqn_init"">*i32"
@ -87,7 +92,7 @@
# bad array elements # bad array elements
!"Type parser: Structs currently cannot contain mutable references" % size_t "u64" size_tw 64 f@•FFI"&""memcpy""&{&i16}""*i8"size_t G{F𝕩,0,0} G ¨¯3276832767 !"Type parser: Structs currently cannot contain mutable references" % %USE defs f@•FFI"&""memcpy""&{&i16}""*i8"size_t G{F𝕩,0,0} G ¨¯3276832767
!"FFI: Array provided for &u8 contained 299" % f@•FFI"&""bqn_init"">&u8" F 300 !"FFI: Array provided for &u8 contained 299" % f@•FFI"&""bqn_init"">&u8" F 300
!"FFI: Array provided for &u8 contained ¯99" % f@•FFI"&""bqn_init"">&u8" F -100 !"FFI: Array provided for &u8 contained ¯99" % f@•FFI"&""bqn_init"">&u8" F -100
@ -175,7 +180,7 @@
# pointer objects # pointer objects
%DEF mm %USE defs Calloc {1𝕩 {𝕏𝕨} @•FFI"*"𝕨, "calloc", size_t, size_t} free @•FFI"""free"">*" cpy @•FFI"*:i8""memcpy""*""*""u64" CpyA +´(28×8)×256|Cpy %DEF mm %USE defs Calloc {1𝕩 {𝕏𝕨} @•FFI"*"𝕨, "calloc", size_t, size_t} free @•FFI"""free"">*" cpy @•FFI"*:i8""memcpy""*""*"size_t CpyA +´(28×8)×256|Cpy
%DEF WallocE %USE mm {allocs Clean{Free¨allocs𝕩} Clean 𝕏{𝕊: !•CurrentError Clean @} {{r allocs r 𝕨 Calloc 𝕩}}} %DEF WallocE %USE mm {allocs Clean{Free¨allocs𝕩} Clean 𝕏{𝕊: !•CurrentError Clean @} {{r allocs r 𝕨 Calloc 𝕩}}}
%DEF Walloc %USE mm {allocs Clean{Free¨allocs𝕩} Clean 𝕏 {{r allocs r 𝕨 Calloc 𝕩}}} %DEF Walloc %USE mm {allocs Clean{Free¨allocs𝕩} Clean 𝕏 {{r allocs r 𝕨 Calloc 𝕩}}}