subprocess: Fix `-Wunused-private-field` for `Popen` class on Windows
What changed, and why it matters
This commit is a minor compiler warning fix. It moves a private class field inside a non-Windows-only section of code so that the Windows compiler no longer complains about an unused variable. There is no functional change and no security relevance.
No security action needed; treat as routine build hygiene.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch reorders a private member child_pid_ in src/util/subprocess.h so it is declared only under #else (non-Windows) rather than unconditionally. On Windows builds, process_handle_ and cleanup_future_ are used instead, so child_pid_ was flagged by -Wunused-private-field. The change is purely structural and does not alter logic, initialization values, or behavior.
Changed components
src/util/subprocess.hInspect captured patch +3 / −3
diff --git a/src/util/subprocess.h b/src/util/subprocess.h
index e90c1652..e261215c 100644
--- a/src/util/subprocess.h
+++ b/src/util/subprocess.h
@@ -1024,6 +1024,9 @@ private:
#ifdef __USING_WINDOWS__
HANDLE process_handle_;
std::future<void> cleanup_future_;
+#else
+ // Pid of the child process
+ int child_pid_ = -1;
#endif
std::string exe_name_;
@@ -1034,9 +1037,6 @@ private:
std::vector<std::string> vargs_;
std::vector<char*> cargv_;
- // Pid of the child process
- int child_pid_ = -1;
-
int retcode_ = -1;
};
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.