From: Christopher Dykes Date: Mon, 19 Jun 2017 21:34:21 +0000 (-0700) Subject: Make semaphore.h a non-portable header X-Git-Tag: v2017.06.26.00~45 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=commitdiff_plain;h=009082dca9eeaa2f75f839ece82ae44ef8659387 Make semaphore.h a non-portable header Summary: On Windows it has include order requirements. Reviewed By: yfeldblum Differential Revision: D5277151 fbshipit-source-id: a6cf923d78e5944ac34e885e32a7cf072f904720 --- diff --git a/folly/Makefile.am b/folly/Makefile.am index b2bad52a..37d47db4 100644 --- a/folly/Makefile.am +++ b/folly/Makefile.am @@ -336,6 +336,7 @@ nobase_follyinclude_HEADERS = \ portability/Memory.h \ portability/OpenSSL.h \ portability/PThread.h \ + portability/Semaphore.h \ portability/Sockets.h \ portability/Stdio.h \ portability/Stdlib.h \ diff --git a/folly/futures/test/Benchmark.cpp b/folly/futures/test/Benchmark.cpp index 64d4a44f..e09546ff 100644 --- a/folly/futures/test/Benchmark.cpp +++ b/folly/futures/test/Benchmark.cpp @@ -20,8 +20,8 @@ #include #include #include +#include -#include #include using namespace folly; diff --git a/folly/portability/Semaphore.h b/folly/portability/Semaphore.h new file mode 100644 index 00000000..6cfb8d35 --- /dev/null +++ b/folly/portability/Semaphore.h @@ -0,0 +1,24 @@ +/* + * Copyright 2017 Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +// On Windows, the include order matters, as the pthread implementation we +// support attempts to use a different definition of `mode_t` than everything +// else, so we have to make sure our definition of it is first. +#include + +#include diff --git a/folly/test/AtomicUnorderedMapTest.cpp b/folly/test/AtomicUnorderedMapTest.cpp index 69b51e5e..957b6063 100644 --- a/folly/test/AtomicUnorderedMapTest.cpp +++ b/folly/test/AtomicUnorderedMapTest.cpp @@ -16,13 +16,13 @@ #include -#include #include #include #include #include #include +#include #include using namespace folly; diff --git a/folly/test/BatonBenchmark.cpp b/folly/test/BatonBenchmark.cpp index 11fb747c..82e3b5e3 100644 --- a/folly/test/BatonBenchmark.cpp +++ b/folly/test/BatonBenchmark.cpp @@ -16,12 +16,12 @@ #include -#include #include #include #include #include +#include #include #include diff --git a/folly/test/DeterministicSchedule.h b/folly/test/DeterministicSchedule.h index 87673423..5ec444e6 100644 --- a/folly/test/DeterministicSchedule.h +++ b/folly/test/DeterministicSchedule.h @@ -16,17 +16,10 @@ #pragma once -// This needs to be above semaphore.h due to the windows -// libevent implementation needing mode_t to be defined, -// but defining it differently than our portability -// headers do. -#include - #include #include #include #include -#include #include #include #include @@ -38,6 +31,7 @@ #include #include #include +#include namespace folly { namespace test { diff --git a/folly/test/IndexedMemPoolTest.cpp b/folly/test/IndexedMemPoolTest.cpp index cb2e258b..a5faa43a 100644 --- a/folly/test/IndexedMemPoolTest.cpp +++ b/folly/test/IndexedMemPoolTest.cpp @@ -17,12 +17,12 @@ #include #include #include +#include #include #include #include #include -#include using namespace folly; using namespace folly::test; diff --git a/folly/test/LifoSemTests.cpp b/folly/test/LifoSemTests.cpp index 69e69eee..02c112b2 100644 --- a/folly/test/LifoSemTests.cpp +++ b/folly/test/LifoSemTests.cpp @@ -16,7 +16,6 @@ #include -#include #include #include @@ -24,6 +23,7 @@ #include #include #include +#include #include using namespace folly;