[libc-commits] [libc] c623a68 - [libc] Fix warning in ExecuteFunctionUnix.cpp
Alex Brachet via libc-commits
libc-commits at lists.llvm.org
Wed Jan 25 08:52:05 PST 2023
Author: Alex Brachet
Date: 2023-01-25T16:51:56Z
New Revision: c623a6865fde1b5c89c52eb1301b086091ff75ba
URL: https://github.com/llvm/llvm-project/commit/c623a6865fde1b5c89c52eb1301b086091ff75ba
DIFF: https://github.com/llvm/llvm-project/commit/c623a6865fde1b5c89c52eb1301b086091ff75ba.diff
LOG: [libc] Fix warning in ExecuteFunctionUnix.cpp
WIFEXITED and friends expect an `int *` but these methods
were marked `const` so they instead got a `const int *`.
This macros aren't actually modifying their argument, but
we were never using these functions on an immutable
`ProcessStatus` type anyway.
Added:
Modified:
libc/utils/testutils/ExecuteFunction.h
libc/utils/testutils/ExecuteFunctionUnix.cpp
Removed:
################################################################################
diff --git a/libc/utils/testutils/ExecuteFunction.h b/libc/utils/testutils/ExecuteFunction.h
index 2df8291b0d4e3..d1105ac3fd382 100644
--- a/libc/utils/testutils/ExecuteFunction.h
+++ b/libc/utils/testutils/ExecuteFunction.h
@@ -35,9 +35,9 @@ struct ProcessStatus {
return failure == reinterpret_cast<const char *>(TIMEOUT);
}
const char *get_error() const { return timed_out() ? nullptr : failure; }
- bool exited_normally() const;
- int get_exit_code() const;
- int get_fatal_signal() const;
+ bool exited_normally();
+ int get_exit_code();
+ int get_fatal_signal();
};
ProcessStatus invoke_in_subprocess(FunctionCaller *func,
diff --git a/libc/utils/testutils/ExecuteFunctionUnix.cpp b/libc/utils/testutils/ExecuteFunctionUnix.cpp
index 0076c3143ce83..1caaa24b8d414 100644
--- a/libc/utils/testutils/ExecuteFunctionUnix.cpp
+++ b/libc/utils/testutils/ExecuteFunctionUnix.cpp
@@ -20,16 +20,14 @@
namespace __llvm_libc {
namespace testutils {
-bool ProcessStatus::exited_normally() const {
- return WIFEXITED(platform_defined);
-}
+bool ProcessStatus::exited_normally() { return WIFEXITED(platform_defined); }
-int ProcessStatus::get_exit_code() const {
+int ProcessStatus::get_exit_code() {
assert(exited_normally() && "Abnormal termination, no exit code");
return WEXITSTATUS(platform_defined);
}
-int ProcessStatus::get_fatal_signal() const {
+int ProcessStatus::get_fatal_signal() {
if (exited_normally())
return 0;
return WTERMSIG(platform_defined);
More information about the libc-commits
mailing list