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
I tried converting path_provider_foundation (the simplest of our plugins) to FFI, and immediately hit:
[SEVERE] : The integer type used for enums is implementation-defined. FFIgen tries to mimic the integer sizes chosen by the most common compilers for the various OS and architecture combinations. To prevent any crashes, remove the enums from your API surface. To rely on the (unsafe!) mimicking, you can silence this warning by adding silence-enum-warning: true to the FFIgen config. Affected enums:
NSDirectoryEnumerationOptions
NSFileManagerItemReplacementOptions
NSFileManagerUnmountOptions
NSSearchPathDirectory
NSSearchPathDomainMask
NSURLRelationship
NSVolumeEnumerationOptions
I need both NSSearchPathDirectory and NSSearchPathDomainMask, I don't control the APIs in question, and I don't want to ship something that is "unsafe!" to clients, so this would be a hard blocker on a pure-Dart implementation. However, the message doesn't seem to match the definitions:
I think the issue is that this int can be 32 or 64 bit depending on the architecture. That message might be a bit overzealous though, since FFI has ABI specific integers. Presumably it would be pretty safe for ffigen to just use UnisgnedInt here.
@dcharkes@mannprerak2 I read the original PR, and it seems like the issue is mainly on Windows, where there's a disagreement about whether it's an int or a uint. Maybe we just disable this warning if the language is set to ObjC, since we know the target platform is Mac? Or is there some other reason this is unsafe?
I think the issue is that this int can be 32 or 64 bit depending on the architecture. That message might be a bit overzealous though, since FFI has ABI specific integers. Presumably it would be pretty safe for ffigen to just use UnisgnedInt here.
If I remember correctly, enums are always 32 bits.
@dcharkes@mannprerak2 I read the original PR, and it seems like the issue is mainly on Windows, where there's a disagreement about whether it's an int or a uint. Maybe we just disable this warning if the language is set to ObjC, since we know the target platform is Mac? Or is there some other reason this is unsafe?
Yeah, the issue is mostly for enums that have values defined outside their range if that upgrades the int to different size or sign than the declared int side. And yes, we only observed this on Windows. MacOS/iOS should be consistent with itself since it's always the Apple clang compiler. So skipping the warning for language ObjC sgtm. 👍
I tried converting
path_provider_foundation
(the simplest of our plugins) to FFI, and immediately hit:I need both
NSSearchPathDirectory
andNSSearchPathDomainMask
, I don't control the APIs in question, and I don't want to ship something that is "unsafe!" to clients, so this would be a hard blocker on a pure-Dart implementation. However, the message doesn't seem to match the definitions:Isn't that a clearly defined integer type?
The text was updated successfully, but these errors were encountered: