Small changes for cygwin build
authorElizabeth Smith <elizabeths@fb.com>
Thu, 10 Jul 2014 22:52:22 +0000 (15:52 -0700)
committerTudor Bosman <tudorb@fb.com>
Mon, 14 Jul 2014 19:13:58 +0000 (12:13 -0700)
Summary:
Folly is almost "out of the box" working with cygwin

This has the proper ifdefs to include cygwin in two areas and a workaround for a cygwin bug when including headers

Test Plan: fbconfig -r folly && fbmake runtests

Reviewed By: delong.j@fb.com

FB internal diff: D1413303

folly/String.cpp
folly/Synchronized.h

index f6fc8def03af8f6b44950b13c651bb94cb38eb34..091cd67d3f578a4995d064588808d4fc99e22398 100644 (file)
@@ -308,7 +308,7 @@ 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__) || \
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__CYGWIN__) ||\
     ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE)
   // Using XSI-compatible strerror_r
   int r = strerror_r(err, buf, sizeof(buf));
index 83ca833dfa8595b7847ae62edb4debe942685a2a..0e69278958a13f8074cf0fb9ed5347695a59fd84 100644 (file)
@@ -49,7 +49,8 @@ struct HasLockUnlock {
   enum { value = IsOneOf<T,
          std::mutex, std::recursive_mutex,
          boost::mutex, boost::recursive_mutex, boost::shared_mutex
-#ifndef __APPLE__ // OSX doesn't have timed mutexes
+// OSX and Cygwin don't have timed mutexes
+#if !defined(__APPLE__) && !defined(__CYGWIN__)
         ,std::timed_mutex, std::recursive_timed_mutex,
          boost::timed_mutex, boost::recursive_timed_mutex
 #endif
@@ -97,7 +98,8 @@ acquireReadWrite(T& mutex) {
   mutex.lock();
 }
 
-#ifndef __APPLE__ // OSX doesn't have timed mutexes
+// OSX and Cygwin don't have timed mutexes
+#if !defined(__APPLE__) && !defined(__CYGWIN__)
 /**
  * Acquires a mutex for reading and writing with timeout by calling
  * .try_lock_for(). This applies to two of the std mutex classes as