From: Keith Daigle Date: Thu, 4 Jan 2018 14:37:27 +0000 (-0800) Subject: Make FOLLY_HAS_COROUTINES dependent on header X-Git-Tag: v2018.01.08.00~15 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=commitdiff_plain;h=c60784b8bc21ff4a420da59e29fa0aec3abd0f8a Make FOLLY_HAS_COROUTINES dependent on header Summary: This breaks while building on aarch64 each time because the headers aren't in the repo. I did a quick grep and I don't see anything in folly that uses OptionalAwaitable or OptionalPromise so perhaps it's possible to remove instead, can do that if preferred. Depends on D6611609 to complete build of tests cleanly. Reviewed By: yfeldblum Differential Revision: D6643759 fbshipit-source-id: f480d50383f85fbe905daaad74198b6557609347 --- diff --git a/folly/CPortability.h b/folly/CPortability.h index 3b362d2a..1c63ec8a 100644 --- a/folly/CPortability.h +++ b/folly/CPortability.h @@ -1,5 +1,5 @@ /* - * Copyright 2017 Facebook, Inc. + * Copyright 2017-present Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -57,6 +57,12 @@ #define FOLLY_HAS_FEATURE(...) 0 #endif +#if defined(__has_include) +#define FOLLY_HAS_INCLUDE(...) __has_include(__VA_ARGS__) +#else +#define FOLLY_HAS_INCLUDE(...) 0 +#endif + /* Define a convenience macro to test when address sanitizer is being used * across the different compilers (e.g. clang, gcc) */ #if FOLLY_HAS_FEATURE(address_sanitizer) || __SANITIZE_ADDRESS__ diff --git a/folly/Portability.h b/folly/Portability.h index b41893b5..3831f04d 100644 --- a/folly/Portability.h +++ b/folly/Portability.h @@ -366,7 +366,9 @@ constexpr auto kMscVer = 0; #define FOLLY_CPP14_CONSTEXPR inline #endif -#if __cpp_coroutines >= 201703L || (_MSC_VER && _RESUMABLE_FUNCTIONS_SUPPORTED) +#if __cpp_coroutines >= 201703L && FOLLY_HAS_INCLUDE() +#define FOLLY_HAS_COROUTINES 1 +#elif _MSC_VER && _RESUMABLE_FUNCTIONS_SUPPORTED #define FOLLY_HAS_COROUTINES 1 #endif