From 58132d0716e0326285520aec7e5dc42463d8851d Mon Sep 17 00:00:00 2001 From: Sean Cannella Date: Thu, 9 Oct 2014 12:40:37 -0700 Subject: [PATCH] Port compilation fixes (1/3) Test Plan: existing tests Reviewed By: meyering@fb.com Subscribers: trunkagent, bmatheny, ranjeeth, njormrod, subodh FB internal diff: D1605942 Tasks: 5183325 --- folly/RWSpinLock.h | 6 +++--- folly/SocketAddress.h | 2 +- folly/String.cpp | 5 +++-- folly/ThreadName.h | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/folly/RWSpinLock.h b/folly/RWSpinLock.h index 995c466f..9ba6390e 100644 --- a/folly/RWSpinLock.h +++ b/folly/RWSpinLock.h @@ -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; } diff --git a/folly/SocketAddress.h b/folly/SocketAddress.h index 5ae966af..41f41f2d 100644 --- a/folly/SocketAddress.h +++ b/folly/SocketAddress.h @@ -20,13 +20,13 @@ #include #include #include -#include #include #include #include #include #include +#include namespace folly { diff --git a/folly/String.cpp b/folly/String.cpp index 9ccd0928..b4573917 100644 --- a/folly/String.cpp +++ b/folly/String.cpp @@ -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)); diff --git a/folly/ThreadName.h b/folly/ThreadName.h index f2b7d063..3926a829 100644 --- a/folly/ThreadName.h +++ b/folly/ThreadName.h @@ -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 -- 2.34.1