Port compilation fixes (1/3)
authorSean Cannella <seanc@fb.com>
Thu, 9 Oct 2014 19:40:37 +0000 (12:40 -0700)
committerAndrii Grynenko <andrii@fb.com>
Wed, 15 Oct 2014 00:57:55 +0000 (17:57 -0700)
Test Plan: existing tests

Reviewed By: meyering@fb.com

Subscribers: trunkagent, bmatheny, ranjeeth, njormrod, subodh

FB internal diff: D1605942

Tasks: 5183325

folly/RWSpinLock.h
folly/SocketAddress.h
folly/String.cpp
folly/ThreadName.h

index 995c466f61786058bd1c7bf07ac1758a40bb41fc..9ba6390ed61d750d8e34483de1422c5c934e5732 100644 (file)
@@ -274,7 +274,7 @@ class RWSpinLock : boost::noncopyable {
       lock_->lock_shared();
     }
 
-    ReadHolder(ReadHolder&& other) : lock_(other.lock_) {
+    ReadHolder(ReadHolder&& other) noexcept : lock_(other.lock_) {
       other.lock_ = nullptr;
     }
 
@@ -333,7 +333,7 @@ class RWSpinLock : boost::noncopyable {
       if (lock_) lock_->unlock_and_lock_upgrade();
     }
 
-    UpgradedHolder(UpgradedHolder&& other) : lock_(other.lock_) {
+    UpgradedHolder(UpgradedHolder&& other) noexcept : lock_(other.lock_) {
       other.lock_ = nullptr;
     }
 
@@ -383,7 +383,7 @@ class RWSpinLock : boost::noncopyable {
       if (lock_) lock_->unlock_upgrade_and_lock();
     }
 
-    WriteHolder(WriteHolder&& other) : lock_(other.lock_) {
+    WriteHolder(WriteHolder&& other) noexcept : lock_(other.lock_) {
       other.lock_ = nullptr;
     }
 
index 5ae966afa40a5f3251cdfcfec3263ee7e4b00ed9..41f41f2d0e7004d4ddf66838bffa14f32ba5f1c7 100644 (file)
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <netinet/in.h>
-#include <features.h>
 #include <netdb.h>
 #include <cstddef>
 #include <iostream>
 #include <string>
 
 #include <folly/IPAddress.h>
+#include <folly/Portability.h>
 
 namespace folly {
 
index 9ccd09288e36159332a59f0f8fde13d62c46e8c0..b457391746de64cf0ef90b93cd73f90b7a31b8d4 100644 (file)
@@ -93,7 +93,7 @@ std::string stringVPrintf(const char* format, va_list ap) {
   // the format string size, or 32 bytes, whichever is larger.  This
   // is a hueristic that doesn't affect correctness but attempts to be
   // reasonably fast for the most common cases.
-  std::string ret(std::max(32UL, strlen(format) * 2), '\0');
+  std::string ret(std::max(size_t(32), strlen(format) * 2), '\0');
   ret.resize(0);
 
   stringPrintfImpl(ret, format, ap);
@@ -330,7 +330,8 @@ fbstring errnoStr(int err) {
 
   // https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/strerror_r.3.html
   // http://www.kernel.org/doc/man-pages/online/pages/man3/strerror.3.html
-#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__CYGWIN__) ||\
+#if defined(__APPLE__) || defined(__FreeBSD__) ||\
+    defined(__CYGWIN__) || defined(__ANDROID__) ||\
     ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE)
   // Using XSI-compatible strerror_r
   int r = strerror_r(err, buf, sizeof(buf));
index f2b7d063cc2930bf8978d7727b4a45f245446c23..3926a829149e8aa1af1b2e16ff34b1ee73440adb 100644 (file)
@@ -23,7 +23,7 @@ namespace folly {
 
 // This looks a bit weird, but it's necessary to avoid
 // having an undefined compiler function called.
-#if defined(__GLIBC__) && !defined(__APPLE__)
+#if defined(__GLIBC__) && !defined(__APPLE__) && !defined(__ANDROID__)
 #if __GLIBC_PREREQ(2, 12)
 # define FOLLY_GLIBC_2_12
 #endif