Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 7a74a42

Browse files
committed
Merging r308483:
------------------------------------------------------------------------ r308483 | hans | 2017-07-19 08:03:38 -0700 (Wed, 19 Jul 2017) | 12 lines 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. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@308487 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent d7a44b9 commit 7a74a42

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/Support/ErrorHandling.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@ void llvm::report_bad_alloc_error(const char *Reason, bool GenCrashDiag) {
169169
// Don't call the normal error handler. It may allocate memory. Directly write
170170
// an OOM to stderr and abort.
171171
char OOMMessage[] = "LLVM ERROR: out of memory\n";
172-
(void)::write(2, OOMMessage, strlen(OOMMessage));
172+
ssize_t written = ::write(2, OOMMessage, strlen(OOMMessage));
173+
(void)written;
173174
abort();
174175
#endif
175176
}

0 commit comments

Comments
 (0)