diff options
author | Hans Wennborg <hans@hanshq.net> | 2017-07-19 15:03:38 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2017-07-19 15:03:38 +0000 |
commit | 8276556b624cbff4d1e39e661dbc6a0e004d02a5 (patch) | |
tree | c1bc64ed4f61b15fece8dc27d1d755b80694e428 | |
parent | ccbf7987a3804dfad44ba1fbfb370283f380f198 (diff) | |
download | bcm5719-llvm-8276556b624cbff4d1e39e661dbc6a0e004d02a5.tar.gz bcm5719-llvm-8276556b624cbff4d1e39e661dbc6a0e004d02a5.zip |
Defeat a GCC -Wunused-result warning
It was warning like:
../llvm-project/llvm/lib/Support/ErrorHandling.cpp:172:51: warning:
ignoring return value of ‘ssize_t write(int, const void*, size_t)’,
declared with attribute warn_unused_result [-Wunused-result]
(void)::write(2, OOMMessage, strlen(OOMMessage));
Work around the warning by storing the return value in a variable and
casting that to void instead. We already did this for the other write()
call in this file.
llvm-svn: 308483
-rw-r--r-- | llvm/lib/Support/ErrorHandling.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Support/ErrorHandling.cpp b/llvm/lib/Support/ErrorHandling.cpp index 2fd4f3ea0d4..fb8ae4c1cd5 100644 --- a/llvm/lib/Support/ErrorHandling.cpp +++ b/llvm/lib/Support/ErrorHandling.cpp @@ -169,7 +169,8 @@ void llvm::report_bad_alloc_error(const char *Reason, bool GenCrashDiag) { // Don't call the normal error handler. It may allocate memory. Directly write // an OOM to stderr and abort. char OOMMessage[] = "LLVM ERROR: out of memory\n"; - (void)::write(2, OOMMessage, strlen(OOMMessage)); + ssize_t written = ::write(2, OOMMessage, strlen(OOMMessage)); + (void)written; abort(); #endif } |