Make FOLLY_HAS_COROUTINES dependent on header
authorKeith Daigle <kdaigle@fb.com>
Thu, 4 Jan 2018 14:37:27 +0000 (06:37 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 4 Jan 2018 14:51:50 +0000 (06:51 -0800)
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

folly/CPortability.h
folly/Portability.h

index 3b362d2a885b96781ea4a7bbf000574694cb3387..1c63ec8adbdbb9c3af8f03cea902f5dc6ee6d327 100644 (file)
@@ -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.
 #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__
index b41893b59a017223bad2e590a8954495b945ad79..3831f04d43580d5601cb8919be6c5952af891221 100644 (file)
@@ -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(<experimental/coroutine>)
+#define FOLLY_HAS_COROUTINES 1
+#elif _MSC_VER && _RESUMABLE_FUNCTIONS_SUPPORTED
 #define FOLLY_HAS_COROUTINES 1
 #endif