[llvm] r223389 - Silence warning: variable 'buffer' set but not used.

Yaron Keren yaron.keren at gmail.com
Thu Dec 4 13:36:38 PST 2014


Author: yrnkrn
Date: Thu Dec  4 15:36:38 2014
New Revision: 223389

URL: http://llvm.org/viewvc/llvm-project?rev=223389&view=rev
Log:
Silence warning: variable 'buffer' set but not used.


Modified:
    llvm/trunk/lib/Support/Errno.cpp

Modified: llvm/trunk/lib/Support/Errno.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Errno.cpp?rev=223389&r1=223388&r2=223389&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Errno.cpp (original)
+++ llvm/trunk/lib/Support/Errno.cpp Thu Dec  4 15:36:38 2014
@@ -35,12 +35,14 @@ std::string StrError() {
 #endif  // HAVE_ERRNO_H
 
 std::string StrError(int errnum) {
-  const int MaxErrStrLen = 2000;
-  char buffer[MaxErrStrLen];
-  buffer[0] = '\0';
   std::string str;
   if (errnum == 0)
     return str;
+#if defined(HAVE_STRERROR_R) || HAVE_DECL_STRERROR_S
+  const int MaxErrStrLen = 2000;
+  char buffer[MaxErrStrLen];
+  buffer[0] = '\0';
+#endif  
 
 #ifdef HAVE_STRERROR_R
   // strerror_r is thread-safe.





More information about the llvm-commits mailing list