[llvm] 34e3bc0 - [llvm-exegesis] Replace size_t with ssize_t where relevant
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 22 23:44:25 PDT 2023
Author: Aiden Grossman
Date: 2023-08-22T23:44:05-07:00
New Revision: 34e3bc0b92d7fdc59477c93d187546a2566fbc22
URL: https://github.com/llvm/llvm-project/commit/34e3bc0b92d7fdc59477c93d187546a2566fbc22
DIFF: https://github.com/llvm/llvm-project/commit/34e3bc0b92d7fdc59477c93d187546a2566fbc22.diff
LOG: [llvm-exegesis] Replace size_t with ssize_t where relevant
Currently BenchmarkRunner.cpp stores the return code of recvmsg as
size_t. Not only is this incorrect (as recvmsg returns ssize_t), but it
also makes the error code check after the statement completely irrelvant
as it checks if the number of bytes read is greater than zero (which
will always be true for an unsigned type).
Added:
Modified:
llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
index 96ac1ae998e465..0bafb05b7a1d73 100644
--- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
@@ -221,7 +221,7 @@ class SubProcessFunctionExecutorImpl
Message.msg_control = ControlBuffer;
Message.msg_controllen = sizeof(ControlBuffer);
- size_t BytesRead = recvmsg(SocketFD, &Message, 0);
+ ssize_t BytesRead = recvmsg(SocketFD, &Message, 0);
if (BytesRead < 0)
return make_error<Failure>("Failed to read FD from socket");
More information about the llvm-commits
mailing list