fix build (gtest 1.6 -> 1.7)
authorPhilip Pronin <philipp@fb.com>
Thu, 14 Aug 2014 07:07:59 +0000 (00:07 -0700)
committerSara Golemon <sgolemon@fb.com>
Thu, 14 Aug 2014 18:49:04 +0000 (11:49 -0700)
Summary:
D1494614 migrated us to gtest 1.7 which broke multiple builds (with
"error: 'tuple' is already declared in this scope" coming from
https://code.google.com/p/googletest/source/detail?spec=svn621&r=621).
This diff makes folly compatible with both versions of gtest, and the rest
of fbcode is now compatible with gtest 1.7.

Test Plan: fbconfig -r folly unicorn/diskindex4 && fbmake opt -j32

Reviewed By: jiayan@fb.com

Subscribers: fbcode-common-diffs@, chaoyc, search-fbcode-diffs@, sdoroshenko, cold-storage-diffs@, unicorn-diffs@

FB internal diff: D1497389

Tasks: 4909974491054749105674909983

folly/io/test/CompressionTest.cpp
folly/io/test/IOBufTest.cpp

index 42487012d0ba9d01eb20aca9ad5d664e5fbacf74..ea22fca298b2cb3ff5d8b9fc6b0b140a55da0cf7 100644 (file)
 
 #include <folly/io/Compression.h>
 
-// Yes, tr1, as that's what gtest requires
 #include <random>
 #include <thread>
-#include <tr1/tuple>
 #include <unordered_map>
 
 #include <boost/noncopyable.hpp>
index 71804bb57436f19d19739f36b473c3bdc28b5ea4..b0169370cb8359ddb333d0d6184929a4cc8b20c3 100644 (file)
@@ -17,9 +17,6 @@
 #include <folly/io/IOBuf.h>
 #include <folly/io/TypedIOBuf.h>
 
-// googletest requires std::tr1::tuple, not std::tuple
-#include <tr1/tuple>
-
 #include <gflags/gflags.h>
 #include <boost/random.hpp>
 #include <gtest/gtest.h>
@@ -836,7 +833,11 @@ class MoveToFbStringTest
   : public ::testing::TestWithParam<std::tr1::tuple<int, int, bool, BufType>> {
  protected:
   void SetUp() {
-    std::tr1::tie(elementSize_, elementCount_, shared_, type_) = GetParam();
+    elementSize_ = std::tr1::get<0>(GetParam());
+    elementCount_ = std::tr1::get<1>(GetParam());
+    shared_ = std::tr1::get<2>(GetParam());
+    type_ = std::tr1::get<3>(GetParam());
+
     buf_ = makeBuf();
     for (int i = 0; i < elementCount_ - 1; ++i) {
       buf_->prependChain(makeBuf());