dart-lang / native

Dart packages related to FFI and native assets bundling.
BSD 3-Clause "New" or "Revised" License
82 stars 27 forks source link

Can't `structs.dependency-only: opaque` suppress "No definition found for declaration"? #1123

Closed jonasfj closed 1 week ago

jonasfj commented 1 week ago

This is probably more if a question than an issue.

Reproduction steps:

git clone https://github.com/google/webcrypto.dart
cd webcrypto.dart/
flutter pub get
flutter pub run ffigen --config=lib/src/third_party/boringssl/ffigen.yaml

I get a lot of warnings like:

[WARNING]: No definition found for declaration - (Cursor) spelling: evp_aead_st, kind: 2, kindSpelling: StructDecl, type: 105, typeSpelling: struct evp_aead_st, usr: c:@S@evp_aead_st

From what I can see these are internal things.

There is a declaration typedef struct evp_aead_st EVP_AEAD; in a header file. But the definition is inside an internal.h file (which I'm guessing isn't included from src/include/openssl/.

I have structs.dependency-only: opaque in my ffigen.yaml file.


Am I supposed to ignore this warning? Or is there a config option I'm missing?

Be ware it's obviously very plausible that I'm doing some fairly naive very wrong :rofl:

dcharkes commented 1 week ago

cc @mannprerak2

mannprerak2 commented 1 week ago

Even for opaque type structs/unions, we do try to fetch the doc comment, hence the definition lookup.

But yes, we could do better even with this constraint. I've raised a PR for the same.