subprocess: Fix `-Wunused-private-field` for `Child` class on Windows
What changed, and why it matters
This commit is a straightforward compiler warning fix. It wraps a Windows-only unused class and its friend declaration in conditional compilation so that clang-cl on Windows stops complaining about private fields that are never used. There is no functional change to how the program behaves.
No security action needed. Treat as normal build hygiene cleanup.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change adds #ifndef USING_WINDOWS guards around the detail::Child class definition, the Popen friend declaration for detail::Child, and the Child::execute_child() method. On Windows these are not referenced, so the class fields trigger -Wunused-private-field. The patch removes the warnings by excluding the code from Windows builds entirely. No logic, API, or security behavior is altered.
Changed components
src/util/subprocess.hInspect captured patch +6 / −2
diff --git a/src/util/subprocess.h b/src/util/subprocess.h
index e261215c..87a7e49c 100644
--- a/src/util/subprocess.h
+++ b/src/util/subprocess.h
@@ -738,6 +738,7 @@ private:
Popen* popen_ = nullptr;
};
+#ifndef __USING_WINDOWS__
/*!
* A helper class to Popen.
* This takes care of all the fork-exec logic
@@ -759,6 +760,7 @@ private:
Popen* parent_ = nullptr;
int err_wr_pipe_ = -1;
};
+#endif
// Fwd Decl.
class Streams;
@@ -932,7 +934,9 @@ class Popen
{
public:
friend struct detail::ArgumentDeducer;
+#ifndef __USING_WINDOWS__
friend class detail::Child;
+#endif
template <typename... Args>
Popen(const std::string& cmd_args, Args&& ...args):
@@ -1275,8 +1279,8 @@ namespace detail {
}
- inline void Child::execute_child() {
#ifndef __USING_WINDOWS__
+ inline void Child::execute_child() {
int sys_ret = -1;
auto& stream = parent_->stream_;
@@ -1336,8 +1340,8 @@ namespace detail {
// Calling application would not get this
// exit failure
_exit (EXIT_FAILURE);
-#endif
}
+#endif
inline void Streams::setup_comm_channels()
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.