Fix cbindgen warnings with cbindgen:ignore annotations and native feature define#4466
Fix cbindgen warnings with cbindgen:ignore annotations and native feature define#4466joshuacolvin0 wants to merge 2 commits intomasterfrom
Conversation
…ture define Add /// cbindgen:ignore to Gas, Ink, and prover constants that cbindgen cannot translate to C (newtype wrappers, method chains, string literals, unsupported expressions). Add [defines] section mapping the native feature to STYLUS_NATIVE for conditional compilation guards in the generated header. Reduces cbindgen warnings from 52 to 3 (remaining are generic type mangling issues that cannot be resolved with annotations). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4466 +/- ##
==========================================
+ Coverage 32.72% 32.74% +0.02%
==========================================
Files 493 493
Lines 58290 58294 +4
==========================================
+ Hits 19076 19090 +14
+ Misses 35868 35860 -8
+ Partials 3346 3344 -2 |
crates/stylus/cbindgen.toml
Outdated
| [defines] | ||
| "feature = native" = "STYLUS_NATIVE" |
There was a problem hiding this comment.
this seems to cause compilation failure:
Error: validator/server_arb/machine.go:363:12: could not determine what C.arbitrator_add_inbox_message refers to
Error: validator/server_arb/machine.go:454:2: could not determine what C.arbitrator_add_user_wasm refers to
Error: validator/server_arb/machine.go:138:32: could not determine what C.arbitrator_clone_machine refers to
Error: validator/server_arb/machine.go:344:12: could not determine what C.arbitrator_deserialize_and_replace_state refers to
Error: validator/server_arb/machine.go:88:3: could not determine what C.arbitrator_free_machine refers to
Error: validator/server_arb/machine.go:308:2: could not determine what C.arbitrator_gen_proof refers to
Error: validator/server_arb/machine.go:181:16: could not determine what C.arbitrator_get_num_steps refers to
at least without it, make lint succeeds
crates/arbutil/src/evm/mod.rs
Outdated
| pub mod storage; | ||
| pub mod user; | ||
|
|
||
| /// cbindgen:ignore |
There was a problem hiding this comment.
from what I see, many objects don't require this annotation - cbindgen handles well const values (it fails with const expressions though); therefore I think it's worth considering to put these annotations only where they are actually needed; for example, they are not useful anywhere in this module
There was a problem hiding this comment.
They reduce the warnings, but if we don't care about warnings, we can remove them
You are correct, many were not needed
❌ 9 Tests Failed:
View the top 3 failed tests by shortest run time
📣 Thoughts on this report? Let Codecov know! | Powered by Codecov |
Remove the [defines] section from cbindgen.toml that wrapped arbitrator_* functions in #ifdef STYLUS_NATIVE guards, breaking CGo. Remove unnecessary cbindgen:ignore annotations on non-pub constants and simple newtype constructors. Add annotations to evm/mod.rs constants that alias other Gas constants (e.g. TLOAD_GAS = WARM_SLOAD_GAS), which produced dangling #define references in the generated C header. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Closes NIT-4532
Add /// cbindgen:ignore to Gas, Ink, and prover constants that cbindgen
cannot translate to C (newtype wrappers, method chains, string literals,
unsupported expressions). Add [defines] section mapping the native feature
to STYLUS_NATIVE for conditional compilation guards in the generated header.
Reduces cbindgen warnings from 52 to 3 (remaining are generic type
mangling issues that cannot be resolved with annotations).
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com