Skip to content

Commit

Permalink
Pass EXIT_SUCCESS or EXIT_FAILURE to exit() and _exit()
Browse files Browse the repository at this point in the history
  • Loading branch information
Arfrever Frehtes Taifersar Arahesis authored and Arfrever Frehtes Taifersar Arahesis committed Feb 19, 2022
1 parent 612a7d2 commit 6d3f70a
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ by :cpp:`InstallFailureFunction`.
void YourFailureFunction() {
// Reports something...
exit(1);
exit(EXIT_FAILURE);
}
int main(int argc, char* argv[]) {
Expand Down
2 changes: 1 addition & 1 deletion src/glog/logging.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -1954,7 +1954,7 @@ class GLOG_EXPORT NullStreamFatal : public NullStream {
#pragma warning(push)
#pragma warning(disable : 4722)
#endif // _MSC_VER
@ac_cv___attribute___noreturn@ ~NullStreamFatal() throw () { _exit(1); }
@ac_cv___attribute___noreturn@ ~NullStreamFatal() throw () { _exit(EXIT_FAILURE); }
#if defined(_MSC_VER)
#pragma warning(pop)
#endif // _MSC_VER
Expand Down
2 changes: 1 addition & 1 deletion src/glog/raw_logging.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
#define RAW_LOG_FATAL(...) \
do { \
@ac_google_namespace@::RawLogStub__(0, __VA_ARGS__); \
exit(1); \
exit(EXIT_FAILURE); \
} while (0)
#endif // STRIP_LOG <= 3

Expand Down
16 changes: 8 additions & 8 deletions src/googletest.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ void InitGoogleTest(int*, char**) {}
if (abs(val1 - val2) > abs_error) { \
fprintf(stderr, "Check failed: %s within %s of %s\n", #val1, #abs_error, \
#val2); \
exit(1); \
exit(EXIT_FAILURE); \
} \
} while (0)

#define EXPECT_TRUE(cond) \
do { \
if (!(cond)) { \
fprintf(stderr, "Check failed: %s\n", #cond); \
exit(1); \
exit(EXIT_FAILURE); \
} \
} while (0)

Expand All @@ -148,7 +148,7 @@ void InitGoogleTest(int*, char**) {}
do { \
if (!((val1) op (val2))) { \
fprintf(stderr, "Check failed: %s %s %s\n", #val1, #op, #val2); \
exit(1); \
exit(EXIT_FAILURE); \
} \
} while (0)

Expand All @@ -161,31 +161,31 @@ void InitGoogleTest(int*, char**) {}
do { \
if (!isnan(arg)) { \
fprintf(stderr, "Check failed: isnan(%s)\n", #arg); \
exit(1); \
exit(EXIT_FAILURE); \
} \
} while (0)

#define EXPECT_INF(arg) \
do { \
if (!isinf(arg)) { \
fprintf(stderr, "Check failed: isinf(%s)\n", #arg); \
exit(1); \
exit(EXIT_FAILURE); \
} \
} while (0)

#define EXPECT_DOUBLE_EQ(val1, val2) \
do { \
if (((val1) < (val2) - 0.001 || (val1) > (val2) + 0.001)) { \
fprintf(stderr, "Check failed: %s == %s\n", #val1, #val2); \
exit(1); \
exit(EXIT_FAILURE); \
} \
} while (0)

#define EXPECT_STREQ(val1, val2) \
do { \
if (strcmp((val1), (val2)) != 0) { \
fprintf(stderr, "Check failed: streq(%s, %s)\n", #val1, #val2); \
exit(1); \
exit(EXIT_FAILURE); \
} \
} while (0)

Expand Down Expand Up @@ -239,7 +239,7 @@ static inline void CalledAbort() {
g_logging_fail_func = original_logging_fail_func; \
if (!g_called_abort) { \
fprintf(stderr, "Function didn't die (%s): %s\n", msg, #fn); \
exit(1); \
exit(EXIT_FAILURE); \
} \
} while (0)
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/logging_custom_prefix_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ static void TestTwoProcessesWrite() {
if (pid == 0) {
LOG(INFO) << "message to new base, child - should only appear on STDERR not on the file";
ShutdownGoogleLogging(); //for children proc
exit(0);
exit(EXIT_SUCCESS);
} else if (pid > 0) {
wait(NULL);
}
Expand Down
2 changes: 1 addition & 1 deletion src/logging_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ static void TestTwoProcessesWrite() {
if (pid == 0) {
LOG(INFO) << "message to new base, child - should only appear on STDERR not on the file";
ShutdownGoogleLogging(); //for children proc
exit(0);
exit(EXIT_SUCCESS);
} else if (pid > 0) {
wait(NULL);
}
Expand Down

0 comments on commit 6d3f70a

Please sign in to comment.