Missing guards for FOLLY_TLS in test
authorMichael Lee <mzlee@fb.com>
Tue, 15 Mar 2016 01:54:37 +0000 (18:54 -0700)
committerFacebook Github Bot 9 <facebook-github-bot-9-bot@fb.com>
Tue, 15 Mar 2016 02:05:22 +0000 (19:05 -0700)
Summary:defined(FOLLY_TLS) is guarded once in the test, so we should
guard for it throughout.  Also a missing header for some platforms.

Reviewed By: yfeldblum

Differential Revision: D3049797

fb-gh-sync-id: 5d66c71dda94c57a2e50aee96d55be1c574bf921
shipit-source-id: 5d66c71dda94c57a2e50aee96d55be1c574bf921

folly/test/ApplyTupleTest.cpp
folly/test/CacheLocalityTest.cpp

index 395cdfed1ea7409522395e2b4068914c8ecf8896..aad25c11d2a0ff7a3c17ed0a7754c6960e80f0fe 100644 (file)
@@ -19,6 +19,7 @@
 #include <folly/ApplyTuple.h>
 #include <gtest/gtest.h>
 
+#include <array>
 #include <memory>
 
 // this placates visual studio stupidity - see
index eb600fe6fb4b827f69beda6bcffc5df31df3f6f6..9c326fde4ba320b7f88b198ee8fc5ac8d695da8b 100644 (file)
@@ -387,6 +387,7 @@ TEST(ThreadId, SimplePthread) {
   EXPECT_EQ(cpu, again);
 }
 
+#ifdef FOLLY_TLS
 static FOLLY_TLS unsigned testingCpu = 0;
 
 static int testingGetcpu(unsigned* cpu, unsigned* node, void* /* unused */) {
@@ -398,6 +399,7 @@ static int testingGetcpu(unsigned* cpu, unsigned* node, void* /* unused */) {
   }
   return 0;
 }
+#endif
 
 TEST(AccessSpreader, Simple) {
   for (size_t s = 1; s < 200; ++s) {
@@ -405,6 +407,7 @@ TEST(AccessSpreader, Simple) {
   }
 }
 
+#ifdef FOLLY_TLS
 #define DECLARE_SPREADER_TAG(tag, locality, func)      \
   namespace {                                          \
   template <typename dummy>                            \
@@ -442,3 +445,4 @@ TEST(AccessSpreader, Wrapping) {
     }
   }
 }
+#endif