cmake: add checks to generate folly-config.h correctly
[folly.git] / folly / Portability.h
index 1498db30bfca9f4b6512f090491e4360eadad9e2..3831f04d43580d5601cb8919be6c5952af891221 100644 (file)
@@ -34,14 +34,6 @@ constexpr bool kHasUnalignedAccess = false;
 // compiler specific attribute translation
 // msvc should come first, so if clang is in msvc mode it gets the right defines
 
-#if defined(__clang__) || defined(__GNUC__)
-# define FOLLY_ALIGNED(size) __attribute__((__aligned__(size)))
-#elif defined(_MSC_VER)
-# define FOLLY_ALIGNED(size) __declspec(align(size))
-#else
-# error Cannot define FOLLY_ALIGNED on this platform
-#endif
-
 // NOTE: this will only do checking in msvc with versions that support /analyze
 #if _MSC_VER
 # ifdef _USE_ATTRIBUTES_FOR_SAL
@@ -97,6 +89,12 @@ constexpr bool kHasUnalignedAccess = false;
 # define FOLLY_X64 0
 #endif
 
+#if defined(__arm__)
+#define FOLLY_ARM 1
+#else
+#define FOLLY_ARM 0
+#endif
+
 #if defined(__aarch64__)
 # define FOLLY_AARCH64 1
 #else
@@ -110,6 +108,7 @@ constexpr bool kHasUnalignedAccess = false;
 #endif
 
 namespace folly {
+constexpr bool kIsArchArm = FOLLY_ARM == 1;
 constexpr bool kIsArchAmd64 = FOLLY_X64 == 1;
 constexpr bool kIsArchAArch64 = FOLLY_AARCH64 == 1;
 constexpr bool kIsArchPPC64 = FOLLY_PPC64 == 1;
@@ -367,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