[llvm-branch-commits] [llvm-branch] r308487 - Merging r308483:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jul 19 08:45:34 PDT 2017


Author: hans
Date: Wed Jul 19 08:45:34 2017
New Revision: 308487

URL: http://llvm.org/viewvc/llvm-project?rev=308487&view=rev
Log:
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.
------------------------------------------------------------------------

Modified:
    llvm/branches/release_50/   (props changed)
    llvm/branches/release_50/lib/Support/ErrorHandling.cpp

Propchange: llvm/branches/release_50/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jul 19 08:45:34 2017
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241
+/llvm/trunk:155241,308483

Modified: llvm/branches/release_50/lib/Support/ErrorHandling.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_50/lib/Support/ErrorHandling.cpp?rev=308487&r1=308486&r2=308487&view=diff
==============================================================================
--- llvm/branches/release_50/lib/Support/ErrorHandling.cpp (original)
+++ llvm/branches/release_50/lib/Support/ErrorHandling.cpp Wed Jul 19 08:45:34 2017
@@ -169,7 +169,8 @@ void llvm::report_bad_alloc_error(const
   // 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
 }




More information about the llvm-branch-commits mailing list