Skip to content

ci: add -fno-builtin to bindgen builder#695

Merged
gurry merged 1 commit into
mainfrom
copilot/ci-fix-lint-errors
Jun 30, 2026
Merged

ci: add -fno-builtin to bindgen builder#695
gurry merged 1 commit into
mainfrom
copilot/ci-fix-lint-errors

Conversation

Copilot AI commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Fixes a build failure caused by a newly introduced rustc lint suspicious_runtime_symbol_definitions.

The lint fails because bindgen maps size_t to c_ulonglong/u64 instead of usize for functions like memcpy, strlen etc. The reason bindgen behaves like this is because clang silently replaces any declarations of such functions in the input C code with its own builtins with the same names. Since the builtins use unsigned long long instead of size_t bindgen emits c_ulonglong instead of usize.

The fix is to pass -fno-builtin to clang which ensures it does not replace aforesaid functions with builtins.

Copilot AI requested review from Copilot and removed request for Copilot June 30, 2026 11:39
Copilot finished work on behalf of gurry June 30, 2026 11:39
Copilot AI requested a review from gurry June 30, 2026 11:39
@gurry gurry marked this pull request as ready for review June 30, 2026 11:58
Copilot AI review requested due to automatic review settings June 30, 2026 11:58
@gurry gurry enabled auto-merge June 30, 2026 11:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates wdk-build’s bindgen configuration to avoid Clang substituting certain standard-library function declarations (e.g., memcpy, strlen) with builtin signatures, which can cause bindgen to emit Rust bindings with u64/c_ulonglong sizes and trip the new rustc lint suspicious_runtime_symbol_definitions.

Changes:

  • Add -fno-builtin to the bindgen Clang invocation so function signatures retain size_t (and therefore bindgen’s expected Rust mapping).
  • Document the rationale for the flag directly in the builder configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gurry gurry changed the title ci: add -fno-builtin to bindgen builder ci: add -fno-builtin to bindgen builder Jun 30, 2026
@codecov-commenter

codecov-commenter commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.78%. Comparing base (0e3499d) to head (4b24ab8).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #695   +/-   ##
=======================================
  Coverage   79.78%   79.78%           
=======================================
  Files          26       26           
  Lines        5590     5590           
  Branches     5590     5590           
=======================================
  Hits         4460     4460           
  Misses       1001     1001           
  Partials      129      129           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gurry gurry added this pull request to the merge queue Jun 30, 2026
Merged via the queue into main with commit e262ad0 Jun 30, 2026
575 of 578 checks passed
@gurry gurry deleted the copilot/ci-fix-lint-errors branch June 30, 2026 15:53
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.

6 participants