Merge bitcoin/bitcoin#34385: subprocess: Fix -Wunused-private-field when building with clang-cl on Windows
1b36bf0c5dsubprocess: Fix `-Wunused-private-field` for `Child` class on Windows (Hennadii Stepanov)9f2b338bc0subprocess: Fix `-Wunused-private-field` for `Popen` class on Windows (Hennadii Stepanov) Pull request description: This PR is a prerequisite for https://github.com/bitcoin/bitcoin/pull/31507. It resolves `-Wunused-private-field` warnings triggered in `src/util/subprocess.h` when compiling with clang-cl on Windows: ``` D:\a\bitcoin\bitcoin\src\util/subprocess.h(759,10): warning : private field 'parent_' is not used [-Wunused-private-field] [D:\a\bitcoin\bitcoin\build\src\util\bitcoin_util.vcxproj] D:\a\bitcoin\bitcoin\src\util/subprocess.h(760,7): warning : private field 'err_wr_pipe_' is not used [-Wunused-private-field] [D:\a\bitcoin\bitcoin\build\src\util\bitcoin_util.vcxproj] D:\a\bitcoin\bitcoin\src\util/subprocess.h(1038,7): warning : private field 'child_pid_' is not used [-Wunused-private-field] [D:\a\bitcoin\bitcoin\build\src\util\bitcoin_util.vcxproj] ``` Only the second commit has been [submitted](https://github.com/arun11299/cpp-subprocess/pull/127) upstream. The first commit is specific to this repository and not applicable upstream. ACKs for top commit: maflcko: review ACK1b36bf0c5d👋 purpleKarrot: ACK1b36bf0c5dsedited: ACK1b36bf0c5dTree-SHA512: 1bc0544d769264fa74d2f39150595ee6339af4bca7b7051ecaecbe234c17b643b715e00cfb9302a16ffc4856957f4fa47c216aebf03fec0cd95c387f51bd29a6
This commit is contained in:
1 file changed
+9
-5
@@ -738,6 +738,7 @@ private:
|
|||||||
Popen* popen_ = nullptr;
|
Popen* popen_ = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef __USING_WINDOWS__
|
||||||
/*!
|
/*!
|
||||||
* A helper class to Popen.
|
* A helper class to Popen.
|
||||||
* This takes care of all the fork-exec logic
|
* This takes care of all the fork-exec logic
|
||||||
@@ -759,6 +760,7 @@ private:
|
|||||||
Popen* parent_ = nullptr;
|
Popen* parent_ = nullptr;
|
||||||
int err_wr_pipe_ = -1;
|
int err_wr_pipe_ = -1;
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
// Fwd Decl.
|
// Fwd Decl.
|
||||||
class Streams;
|
class Streams;
|
||||||
@@ -930,7 +932,9 @@ class Popen
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
friend struct detail::ArgumentDeducer;
|
friend struct detail::ArgumentDeducer;
|
||||||
|
#ifndef __USING_WINDOWS__
|
||||||
friend class detail::Child;
|
friend class detail::Child;
|
||||||
|
#endif
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
Popen(std::initializer_list<const char*> cmd_args, Args&& ...args)
|
Popen(std::initializer_list<const char*> cmd_args, Args&& ...args)
|
||||||
@@ -1009,6 +1013,9 @@ private:
|
|||||||
#ifdef __USING_WINDOWS__
|
#ifdef __USING_WINDOWS__
|
||||||
HANDLE process_handle_;
|
HANDLE process_handle_;
|
||||||
std::future<void> cleanup_future_;
|
std::future<void> cleanup_future_;
|
||||||
|
#else
|
||||||
|
// Pid of the child process
|
||||||
|
int child_pid_ = -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::string exe_name_;
|
std::string exe_name_;
|
||||||
@@ -1017,9 +1024,6 @@ private:
|
|||||||
std::vector<std::string> vargs_;
|
std::vector<std::string> vargs_;
|
||||||
std::vector<char*> cargv_;
|
std::vector<char*> cargv_;
|
||||||
|
|
||||||
// Pid of the child process
|
|
||||||
int child_pid_ = -1;
|
|
||||||
|
|
||||||
int retcode_ = -1;
|
int retcode_ = -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1258,8 +1262,8 @@ namespace detail {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void Child::execute_child() {
|
|
||||||
#ifndef __USING_WINDOWS__
|
#ifndef __USING_WINDOWS__
|
||||||
|
inline void Child::execute_child() {
|
||||||
int sys_ret = -1;
|
int sys_ret = -1;
|
||||||
auto& stream = parent_->stream_;
|
auto& stream = parent_->stream_;
|
||||||
|
|
||||||
@@ -1319,8 +1323,8 @@ namespace detail {
|
|||||||
// Calling application would not get this
|
// Calling application would not get this
|
||||||
// exit failure
|
// exit failure
|
||||||
_exit (EXIT_FAILURE);
|
_exit (EXIT_FAILURE);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
inline void Streams::setup_comm_channels()
|
inline void Streams::setup_comm_channels()
|
||||||
|
|||||||
Reference in new issue
Block a user