Skip to content

Seemingly incorrect warning for Foundation enums #1817

@stuartmorgan-g

Description

@stuartmorgan-g

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:

typedef NS_ENUM(NSUInteger, NSSearchPathDirectory) {
  ...
};

typedef NS_OPTIONS(NSUInteger, NSSearchPathDomainMask) {
  ...
};

Isn't that a clearly defined integer type?

Metadata

Metadata

Assignees

Type

No type

Projects

Status

In progress

Relationships

None yet

Development

No branches or pull requests

Issue actions