Skip to content

Support cfg attributes on function arguments - #1173

Open
floze-the-genius wants to merge 1 commit into
mozilla:mainfrom
floze-the-genius:agent/cfg-function-arguments
Open

Support cfg attributes on function arguments#1173
floze-the-genius wants to merge 1 commit into
mozilla:mainfrom
floze-the-genius:agent/cfg-function-arguments

Conversation

@floze-the-genius

Copy link
Copy Markdown

Summary

  • preserve #[cfg] attributes when loading function arguments into the IR
  • emit cfg-aware C/C++ parameter lists with valid comma placement
  • emit void when every conditional argument is disabled
  • add regression fixtures for conditional arguments in leading, middle, trailing, and all-conditional positions

Fixes #1037.

Testing

  • CBINDGEN_TEST_VERIFY=1 CBINDGEN_TEST_NO_COMPILE=1 CARGO_BUILD_JOBS=8 cargo test test_cfg_function_args
  • compiled generated C and C++ expectations with neither define, each define independently, and both defines
  • cargo fmt -- --check
  • CARGO_BUILD_JOBS=8 cargo clippy --workspace -- -D warnings
  • CARGO_BUILD_JOBS=8 cargo check --all-targets --all-features
  • CARGO_BUILD_JOBS=8 cargo package
  • stable integration run: 153/159 fixtures passed; the remaining six macro-expansion fixtures require nightly because stable rejects -Zunpretty=expanded, matching the repository CI split

AI disclosure

I used OpenAI Codex to assist with issue discovery, implementation, and test execution. I reviewed and understand the changes and verified them locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optional function argument is not exported correctly

1 participant