A compromise for C++17 ports.

Remove abseil build config for such targets.
Include headers (which should fall through by definition).
Macintosh can go fuck itself.
This commit is contained in:
Rick V 2019-02-06 10:13:58 -06:00
parent 406e3a6b6c
commit 4c19f562f0
No known key found for this signature in database
GPG Key ID: C0EDC8723FDC3465
6 changed files with 12 additions and 56 deletions

View File

@ -44,11 +44,13 @@ if (WIN32 AND NOT STATIC_LINK_RUNTIME)
#set(STATIC_LINK_RUNTIME ON)
endif(WIN32 AND NOT STATIC_LINK_RUNTIME)
# still need the headers unconditionally
set(ABSEIL_DIR vendor/abseil-cpp)
include_directories(${ABSEIL_DIR})
if (NOT WIN32)
add_compile_options(-fPIC)
set(ABSEIL_DIR vendor/abseil-cpp)
add_subdirectory(${ABSEIL_DIR})
include_directories(${ABSEIL_DIR})
endif(NOT WIN32)
# turns off those annoying warnings for

View File

@ -5,11 +5,7 @@
#include <service/types.hpp>
#include <util/bencode.hpp>
#if __cplusplus >= 201703L
#include <optional>
#else
#include <absl/types/optional.h>
#endif
namespace llarp
{
@ -26,11 +22,7 @@ namespace llarp
public:
VanityNonce vanity;
#if __cplusplus >= 201703L
using OptNonce = std::optional< VanityNonce >;
#else
using OptNonce = absl::optional< VanityNonce >;
#endif
ServiceInfo() = default;

View File

@ -4,12 +4,8 @@
#include <util/queue_manager.hpp>
#include <util/threading.hpp>
#include <atomic>
#if __cplusplus >= 201703L
#include <optional>
#else
#include <absl/types/optional.h>
#endif
#include <atomic>
#include <tuple>
namespace llarp
@ -76,11 +72,8 @@ namespace llarp
// Remove an element from the queue. Block until an element is available
Type
popFront();
#if __cplusplus >= 201703L
std::optional< Type >
#else
absl::optional< Type >
#endif
tryPopFront();
// Remove all elements from the queue. Note this is not atomic, and if
@ -267,11 +260,7 @@ namespace llarp
}
template < typename Type >
#if __cplusplus >= 201703L
std::optional< Type >
#else
absl::optional< Type >
#endif
Queue< Type >::tryPopFront()
{
uint32_t generation;
@ -296,11 +285,7 @@ namespace llarp
// - notify any waiting pushers
QueuePopGuard< Type > popGuard(*this, generation, index);
#if __cplusplus >= 201703L
return std::optional< Type >(std::move(m_data[index]));
#else
return absl::optional< Type >(std::move(m_data[index]));
#endif
}
template < typename Type >

View File

@ -572,12 +572,8 @@ TEST(TestQueue, moveIt)
(void)popped;
ASSERT_EQ(5u, counter);
#if __cplusplus >= 201703L
std::optional< MoveTester >
#else
absl::optional< MoveTester >
#endif
optPopped = queue.tryPopFront();
absl::optional< MoveTester > optPopped = queue.tryPopFront();
ASSERT_TRUE(optPopped.has_value());

View File

@ -1,10 +1,6 @@
#include <util/queue_manager.hpp>
#if __cplusplus >= 201703L
#include <optional>
#else
#include <absl/types/optional.h>
#endif
#include <vector>
#include <gtest/gtest.h>
@ -78,11 +74,8 @@ class IntQueue
return false;
}
}
#if __cplusplus >= 201703L
std::optional< int >
#else
absl::optional< int >
#endif
tryPopFront()
{
uint32_t gen = 0;

View File

@ -365,18 +365,6 @@
#error "absl endian detection needs to be set up for your compiler"
#endif
// MacOS 10.13 doesn't let you use <any>, <optional>, or <variant> even though
// the headers exist and are publicly noted to work. See
// https://github.com/abseil/abseil-cpp/issues/207 and
// https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes
#if defined(__APPLE__) && defined(_LIBCPP_VERSION) && \
defined(__MAC_OS_X_VERSION_MIN_REQUIRED__) && \
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101400
#define ABSL_INTERNAL_MACOS_HAS_CXX_17_TYPES 1
#else
#define ABSL_INTERNAL_MACOS_HAS_CXX_17_TYPES 0
#endif
// ABSL_HAVE_STD_ANY
//
// Checks whether C++17 std::any is available by checking whether <any> exists.
@ -386,7 +374,7 @@
#ifdef __has_include
#if __has_include(<any>) && __cplusplus >= 201703L && \
ABSL_INTERNAL_MACOS_HAS_CXX_17_TYPES
!(__APPLE__ && __MACH__)
#define ABSL_HAVE_STD_ANY 1
#endif
#endif
@ -400,7 +388,7 @@
#ifdef __has_include
#if __has_include(<optional>) && __cplusplus >= 201703L && \
ABSL_INTERNAL_MACOS_HAS_CXX_17_TYPES
!(__APPLE__ && __MACH__)
#define ABSL_HAVE_STD_OPTIONAL 1
#endif
#endif
@ -414,7 +402,7 @@
#ifdef __has_include
#if __has_include(<variant>) && __cplusplus >= 201703L && \
ABSL_INTERNAL_MACOS_HAS_CXX_17_TYPES
!(__APPLE__ && __MACH__)
#define ABSL_HAVE_STD_VARIANT 1
#endif
#endif