From: Joel Rosdahl Date: Fri, 31 Jul 2020 17:35:53 +0000 (+0200) Subject: Remove unnecessary x_exit function X-Git-Tag: v4.0~242 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=47e5952ede1609489a51eb6f5086692edcf880d3;p=thirdparty%2Fccache.git Remove unnecessary x_exit function It’s no longer necessary to use it after 91aa70754c3816537b080fef1c6630313b400721. --- diff --git a/src/ccache.cpp b/src/ccache.cpp index 8d58ef7b5..b09e7411b 100644 --- a/src/ccache.cpp +++ b/src/ccache.cpp @@ -2294,7 +2294,7 @@ handle_main_options(int argc, const char* const* argv) case 'h': // --help fmt::print(stdout, USAGE_TEXT, MYNAME, MYNAME); - x_exit(0); + exit(EXIT_SUCCESS); case 'k': // --get-config fmt::print("{}\n", ctx.config.get_string_value(arg)); @@ -2348,7 +2348,7 @@ handle_main_options(int argc, const char* const* argv) case 'V': // --version fprintf(stdout, VERSION_TEXT, MYNAME, CCACHE_VERSION); - x_exit(0); + exit(EXIT_SUCCESS); case 'x': // --show-compression { @@ -2386,7 +2386,7 @@ handle_main_options(int argc, const char* const* argv) default: fmt::print(stderr, USAGE_TEXT, MYNAME, MYNAME); - x_exit(1); + exit(EXIT_FAILURE); } // Some of the above switches might have changed config settings, so run the @@ -2408,7 +2408,7 @@ ccache_main(int argc, const char* const* argv) if (Util::same_program_name(program_name, MYNAME)) { if (argc < 2) { fmt::print(stderr, USAGE_TEXT, MYNAME, MYNAME); - x_exit(1); + exit(EXIT_FAILURE); } // If the first argument isn't an option, then assume we are being passed // a compiler name and options. diff --git a/src/execute.cpp b/src/execute.cpp index f17e52e9d..72e08cbd6 100644 --- a/src/execute.cpp +++ b/src/execute.cpp @@ -145,7 +145,7 @@ win32execute(const char* path, CloseHandle(pi.hProcess); CloseHandle(pi.hThread); if (!doreturn) { - x_exit(exitcode); + exit(exitcode); } return exitcode; } @@ -174,7 +174,7 @@ execute(const char* const* argv, Fd&& fd_out, Fd&& fd_err, pid_t* pid) fd_out.close(); dup2(*fd_err, STDERR_FILENO); fd_err.close(); - x_exit(execv(argv[0], const_cast(argv))); + exit(execv(argv[0], const_cast(argv))); } fd_out.close(); diff --git a/src/legacy_util.cpp b/src/legacy_util.cpp index d736f4b3b..f8f5ef4d6 100644 --- a/src/legacy_util.cpp +++ b/src/legacy_util.cpp @@ -31,20 +31,6 @@ # include #endif -// If exit() already has been called, call _exit(), otherwise exit(). This is -// used to avoid calling exit() inside an atexit handler. -void -x_exit(int status) -{ - static bool first_time = true; - if (first_time) { - first_time = false; - exit(status); - } else { - _exit(status); - } -} - // Rename oldpath to newpath (deleting newpath). int x_rename(const char* oldpath, const char* newpath) diff --git a/src/legacy_util.hpp b/src/legacy_util.hpp index d032a1531..2de2d1586 100644 --- a/src/legacy_util.hpp +++ b/src/legacy_util.hpp @@ -22,7 +22,6 @@ #include -void x_exit(int status) ATTR_NORETURN; int x_rename(const char* oldpath, const char* newpath); void set_cloexec_flag(int fd); double time_seconds(); diff --git a/src/logging.cpp b/src/logging.cpp index 94e55a4d0..2ed326b3c 100644 --- a/src/logging.cpp +++ b/src/logging.cpp @@ -143,7 +143,7 @@ warn_log_fail() "ccache: error: Failed to write to %s: %s\n", logfile_path.c_str(), strerror(errno)); - x_exit(EXIT_FAILURE); + exit(EXIT_FAILURE); } static void