Commit 9b7a5507 authored by Adam Simpkins's avatar Adam Simpkins Committed by Facebook Github Bot

subprocess: disable -Wclobbered around spawnInternal()

Summary:
When compiling with optimization enabled, gcc 7.2 complains about the
`childDir` variable potentially being clobbered by the child process after
`vfork()`.  This shouldn't matter since `childDir` is only used in the child
process, and not in the parent after the `vfork()`.

Reviewed By: yfeldblum

Differential Revision: D7035993

fbshipit-source-id: c80a4e18ad4f629a3d08e310cfd4500ebaf70994
parent 2adc542f
...@@ -310,6 +310,11 @@ void Subprocess::spawn( ...@@ -310,6 +310,11 @@ void Subprocess::spawn(
pipesGuard.dismiss(); pipesGuard.dismiss();
} }
// With -Wclobbered, gcc complains about vfork potentially cloberring the
// childDir variable, even though we only use it on the child side of the
// vfork.
FOLLY_PUSH_WARNING
FOLLY_GCC_DISABLE_WARNING("-Wclobbered")
void Subprocess::spawnInternal( void Subprocess::spawnInternal(
std::unique_ptr<const char*[]> argv, std::unique_ptr<const char*[]> argv,
const char* executable, const char* executable,
...@@ -446,6 +451,7 @@ void Subprocess::spawnInternal( ...@@ -446,6 +451,7 @@ void Subprocess::spawnInternal(
pid_ = pid; pid_ = pid;
returnCode_ = ProcessReturnCode::makeRunning(); returnCode_ = ProcessReturnCode::makeRunning();
} }
FOLLY_POP_WARNING
int Subprocess::prepareChild(const Options& options, int Subprocess::prepareChild(const Options& options,
const sigset_t* sigmask, const sigset_t* sigmask,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment