Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Obj-C ffigen creates a bunch of The declaration '_sel_...' isn't referenced warnings #1595

Open
stuartmorgan opened this issue Sep 24, 2024 · 1 comment

Comments

@stuartmorgan
Copy link

My generated FFI bindings file has about 15 unreferenced private selector warnings, which causes a lot of noise in the analyzer output and makes the IDE problem inspector much harder to use. Either they should be generated only as-needed, or if over-generating and letting tree shaking handle it is intentional (to make the generator logic simpler), the file should be generated with a file-level ignore for that warning.

If the solution will be the former, it looks like this is selectors from NSOjbect maybe? I see all the following unused: _sel_class, _sel_self, _sel_performSelector_, _sel_performSelector_withObject_, _sel_performSelector_withObject_withObject_, _sel_isMemberOfClass_, _sel_conformsToProtocol_, _sel_retain, _sel_release, _sel_autorelease, _sel_retainCount, _sel_zone, _sel_hash, _sel_superclass, _sel_debugDescription.

@liamappelbe
Copy link
Contributor

In theory they're only generated as needed, but there's probably a bug somewhere where I'm deleting a method for one reason or another and not cleaning this up. Bugs like this should go away (or be easier to fix) once the transformer refactor is done.

The pattern in the meantime has been to add a bunch of file ignores to the preamble: option in the config. But maybe it would make sense to do this automatically. The typical set is:

// ignore_for_file: camel_case_types
// ignore_for_file: non_constant_identifier_names
// ignore_for_file: unnecessary_non_null_assertion
// ignore_for_file: unused_element
// ignore_for_file: unused_field

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

2 participants