cbindgen icon indicating copy to clipboard operation
cbindgen copied to clipboard

cbindgen shouldn't emit errors for declarations that won't be printed anyway

Open jrose-signal opened this issue 4 years ago • 3 comments

At https://github.com/signalapp/libsignal-client/commit/7be34d74461578b326b68007be7ee0c9374c0c7e, running cbindgen in rust/bridge/ffi produces the following errors:

ERROR: Conflicting name for constant signal-crypto::Aes256GcmEncryption::NONCE_SIZE.
ERROR: Conflicting name for constant signal-crypto::Aes256GcmDecryption::TAG_SIZE.
ERROR: Conflicting name for constant signal-crypto::Aes256GcmDecryption::NONCE_SIZE.

However, the cbindgen.toml in that directory has constants disabled:

[export]
item_types = ["enums", "functions", "opaque", "structs", "typedefs"]

So there's no problem with conflicting names, and indeed the resulting header is correct.

jrose-signal avatar Mar 24 '21 17:03 jrose-signal

Yeah, we filter out stuff later after parsing, so we still get the parsing warnings. My guess is that this shouldn't be hard to fix.

emilio avatar Mar 29 '21 12:03 emilio

@jrose-signal were you able to resolve this issue with signal? (I'm trying to generate signal_ffi)

samuelscheit avatar Jun 28 '23 21:06 samuelscheit

No, we just ignore the errors, assuming that we'll see any problems when we actually try to use the header from Swift. :-(

jrose-signal avatar Jun 28 '23 21:06 jrose-signal