Skip to content

src: avoid GCC warning in node_ffi.cc - #67864

Open
Renegade334 wants to merge 1 commit into
nodejs:mainfrom
Renegade334:ffi-no-gcc-warning
Open

Renegade334 wants to merge 1 commit into
nodejs:mainfrom
Renegade334:ffi-no-gcc-warning

Conversation

@Renegade334

@Renegade334 Renegade334 commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

gcc emits a false positive -Wmaybe-uninitialized warning if the structured binding of the PreparedFunction struct in GetFunctions() is copy-initialized.

In file included from ../src/node_ffi.cc:3:
In copy constructor ‘node::ffi::DynamicLibrary::PreparedFunction::PreparedFunction(const node::ffi::DynamicLibrary::PreparedFunction&)’,
    inlined from ‘static void node::ffi::DynamicLibrary::GetFunctions(const v8::FunctionCallbackInfo<v8::Value>&)’ at ../src/node_ffi.cc:1069:63:
../src/node_ffi.h:174:10: warning: ‘*(unsigned char*)((char*)&prepared + offsetof(node::ffi::DynamicLibrary::PreparedFunction, node::ffi::DynamicLibrary::PreparedFunction::should_cache_function))’ may be used uninitialized [-Wmaybe-uninitialized]
  174 |   struct PreparedFunction {
      |          ^~~~~~~~~~~~~~~~
../src/node_ffi.cc: In static member function ‘static void node::ffi::DynamicLibrary::GetFunctions(const v8::FunctionCallbackInfo<v8::Value>&)’:
../src/node_ffi.cc:1063:24: note: ‘*(unsigned char*)((char*)&prepared + offsetof(node::ffi::DynamicLibrary::PreparedFunction, node::ffi::DynamicLibrary::PreparedFunction::should_cache_function))’ was declared here
 1063 |       PreparedFunction prepared;
      |                        ^~~~~~~~
In copy constructor ‘node::ffi::DynamicLibrary::PreparedFunction::PreparedFunction(const node::ffi::DynamicLibrary::PreparedFunction&)’,
    inlined from ‘static void node::ffi::DynamicLibrary::GetFunctions(const v8::FunctionCallbackInfo<v8::Value>&)’ at ../src/node_ffi.cc:1069:63:
../src/node_ffi.h:174:10: warning: ‘*(unsigned char*)((char*)&prepared + offsetof(node::ffi::DynamicLibrary::PreparedFunction, node::ffi::DynamicLibrary::PreparedFunction::should_cache_symbol))’ may be used uninitialized [-Wmaybe-uninitialized]
  174 |   struct PreparedFunction {
      |          ^~~~~~~~~~~~~~~~
../src/node_ffi.cc: In static member function ‘static void node::ffi::DynamicLibrary::GetFunctions(const v8::FunctionCallbackInfo<v8::Value>&)’:
../src/node_ffi.cc:1063:24: note: ‘*(unsigned char*)((char*)&prepared + offsetof(node::ffi::DynamicLibrary::PreparedFunction, node::ffi::DynamicLibrary::PreparedFunction::should_cache_symbol))’ was declared here
 1063 |       PreparedFunction prepared;
      |                        ^~~~~~~~

Signed-off-by: René <rene@renegade334.me.uk>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/ffi

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Nov 29, 2026
@codecov

codecov Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.53%. Comparing base (c58ccfa) to head (b03ea47).
⚠️ Report is 18 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main   #67864    +/-   ##
========================================
  Coverage   90.52%   90.53%            
========================================
  Files         805      805            
  Lines      285669   286363   +694     
  Branches    55151    55311   +160     
========================================
+ Hits       258616   259252   +636     
- Misses      17173    17203    +30     
- Partials     9880     9908    +28     
Files with missing lines Coverage Δ
src/node_ffi.cc 75.96% <100.00%> (+0.02%) ⬆️

... and 54 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Renegade334 Renegade334 added author ready PRs with CI started, the required approvals, and no outstanding review comments. request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. labels Nov 29, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 29, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@Renegade334 Renegade334 added the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. c++ Issues and PRs that require attention from people who are familiar with C++. commit-queue PRs queued for automated landing through the Commit Queue. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants