You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(cbindgen should be able to tell this isn't an arbitrary function call, after having parsed the corresponding types)
Note that the pub const which triggers the warning is NOT intended for FFI export by the delta_kernel_ffi crate. It is actually defined in a dependent crate (delta_kernel), and neither DataType nor Primitive is #[repr(C)]. In fact, the types are not even emitted because no FFI function references them (but apparently constants don't have to be referenced to be exported). Thus, the warning is annoying but harmless in this specific case (see #673)
Unfortunately, annotating the constant with /// cbindgen:no-export or /// cbindgen:ignore does NOT suppress the warning. Maybe that's a side effect of the fact that cbindgen does not seem to respect either annotation for constants in the first place (filed as #947)?
The text was updated successfully, but these errors were encountered:
Yeah, syntax-wise there's no way to know whether DataType::Primitive is a function or an enum initializer... So seems somewhat tricky to suppress this warning...
When generating FFI bindings for delta_kernel, the following construct:
causes cbindgen to emit the following warning:
Full warning text
(indented for readability)
I suspect the problem is a shortcoming in the cbindgen parser, since the constant is ultimately just a nested struct initialization?
If I mark the types
#[repr(C)]
then cbindgen emits the following definitions for them:... and the following constant initializer compiles fine with both gcc and clang:
(cbindgen should be able to tell this isn't an arbitrary function call, after having parsed the corresponding types)
Note that the
pub const
which triggers the warning is NOT intended for FFI export by thedelta_kernel_ffi
crate. It is actually defined in a dependent crate (delta_kernel
), and neitherDataType
norPrimitive
is#[repr(C)]
. In fact, the types are not even emitted because no FFI function references them (but apparently constants don't have to be referenced to be exported). Thus, the warning is annoying but harmless in this specific case (see #673)Unfortunately, annotating the constant with
/// cbindgen:no-export
or/// cbindgen:ignore
does NOT suppress the warning. Maybe that's a side effect of the fact that cbindgen does not seem to respect either annotation for constants in the first place (filed as #947)?The text was updated successfully, but these errors were encountered: