diff options
author | Laszlo Csomor <laszlocsomor@google.com> | 2016-12-21 17:36:00 +0000 |
---|---|---|
committer | Klaus Aehlig <aehlig@google.com> | 2016-12-22 09:54:25 +0000 |
commit | e86b04c9fc5a2142fab0199f4fbefea37f80e7f3 (patch) | |
tree | f65361e68cb19ad0353543ff1654571de5f3bd4c | |
parent | a475087fee62486e5f575219543f4066f9b45960 (diff) |
Bazel client: add comments, delete dead code
In this change:
- add TODOs and comments
- inline blaze::ExitImmediately at call sites
--
PiperOrigin-RevId: 142671757
MOS_MIGRATED_REVID=142671757
-rw-r--r-- | src/main/cpp/blaze_util_platform.h | 5 | ||||
-rw-r--r-- | src/main/cpp/blaze_util_posix.cc | 6 | ||||
-rw-r--r-- | src/main/cpp/blaze_util_windows.cc | 11 | ||||
-rw-r--r-- | src/main/cpp/util/file_platform.h | 1 |
4 files changed, 3 insertions, 20 deletions
diff --git a/src/main/cpp/blaze_util_platform.h b/src/main/cpp/blaze_util_platform.h index 9fd0338857..c196dd2119 100644 --- a/src/main/cpp/blaze_util_platform.h +++ b/src/main/cpp/blaze_util_platform.h @@ -185,11 +185,6 @@ void SetEnv(const std::string& name, const std::string& value); void UnsetEnv(const std::string& name); -// Terminate the process immediately. -// This is a wrapper around POSIX's _exit(2). -// WARNING! This function can be called from a signal handler! -ATTRIBUTE_NORETURN void ExitImmediately(int exit_code); - // Ensure we have open file descriptors for stdin/stdout/stderr. void SetupStdStreams(); diff --git a/src/main/cpp/blaze_util_posix.cc b/src/main/cpp/blaze_util_posix.cc index 9be1c4e7ce..6c223704d1 100644 --- a/src/main/cpp/blaze_util_posix.cc +++ b/src/main/cpp/blaze_util_posix.cc @@ -66,7 +66,7 @@ static void handler(int signum) { if (SignalHandler::Get().GetGlobals()->server_pid != -1) { KillServerProcess(SignalHandler::Get().GetGlobals()->server_pid); } - ExitImmediately(1); + _exit(1); } SigPrintf( "\n%s caught interrupt signal; shutting down.\n\n", @@ -388,10 +388,6 @@ void UnsetEnv(const string& name) { unsetenv(name.c_str()); } -ATTRIBUTE_NORETURN void ExitImmediately(int exit_code) { - _exit(exit_code); -} - void SetupStdStreams() { // Set non-buffered output mode for stderr/stdout. The server already // line-buffers messages where it makes sense, so there's no need to do set diff --git a/src/main/cpp/blaze_util_windows.cc b/src/main/cpp/blaze_util_windows.cc index fbabf07297..47882e6434 100644 --- a/src/main/cpp/blaze_util_windows.cc +++ b/src/main/cpp/blaze_util_windows.cc @@ -132,7 +132,7 @@ static void handler(int signum) { if (SignalHandler::Get().GetGlobals()->server_pid != -1) { KillServerProcess(SignalHandler::Get().GetGlobals()->server_pid); } - ExitImmediately(1); + _exit(1); } SigPrintf( "\n%s caught interrupt signal; shutting down.\n\n", @@ -1145,15 +1145,6 @@ void UnsetEnv(const string& name) { #endif // COMPILER_MSVC } -ATTRIBUTE_NORETURN void ExitImmediately(int exit_code) { -#ifdef COMPILER_MSVC - // TODO(bazel-team): implement this. - pdie(255, "blaze::ExitImmediately is not implemented on Windows"); -#else // not COMPILER_MSVC - _exit(exit_code); -#endif // COMPILER_MSVC -} - void SetupStdStreams() { #ifdef COMPILER_MSVC // TODO(bazel-team): implement this. diff --git a/src/main/cpp/util/file_platform.h b/src/main/cpp/util/file_platform.h index daed1998d5..5354052d81 100644 --- a/src/main/cpp/util/file_platform.h +++ b/src/main/cpp/util/file_platform.h @@ -89,6 +89,7 @@ bool SetMtimeMillisec(const std::string& path, time_t mtime); bool MakeDirectories(const std::string &path, unsigned int mode); // Returns the current working directory. +// The path is platform-specific (e.g. Windows path of Windows) and absolute. std::string GetCwd(); // Changes the current working directory to `path`, returns true upon success. |