diff --git a/.travis.yml b/.travis.yml index 1a39323..bf7e039 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ matrix: include: - compiler: gcc env: - - MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" + - MATRIX_EVAL="CC=gcc-7 && CXX=g++-7 -std=gnu++1z" - compiler: clang - compiler: clang env: diff --git a/build/ipc.pro b/build/ipc.pro index 5871c37..6d71589 100644 --- a/build/ipc.pro +++ b/build/ipc.pro @@ -2,7 +2,7 @@ TEMPLATE = lib TARGET = ipc CONFIG -= qt -CONFIG += c++14 c++17 c++1z +CONFIG += c++14 c++1z # may be useless !msvc:QMAKE_CXXFLAGS += -Wno-attributes -Wno-missing-field-initializers -Wno-unused-variable diff --git a/build/test.pro b/build/test.pro index 3720cf8..fb4c819 100644 --- a/build/test.pro +++ b/build/test.pro @@ -4,7 +4,7 @@ QT += core testlib QT -= gui CONFIG += console -CONFIG += c++14 c++17 c++1z +CONFIG += c++14 c++1z # may be useless CONFIG -= app_bundle DESTDIR = ../output diff --git a/include/def.h b/include/def.h index 7c89992..2dc1cb7 100644 --- a/include/def.h +++ b/include/def.h @@ -103,7 +103,11 @@ struct pimpl { return make_impl(std::forward

(params)...); } +#if __cplusplus >= 201703L constexpr void clear() { +#else /*__cplusplus < 201703L*/ + void clear() { +#endif/*__cplusplus < 201703L*/ clear_impl(static_cast(const_cast(this))); } }; diff --git a/src/ipc.cpp b/src/ipc.cpp index b0b044f..0f18be1 100644 --- a/src/ipc.cpp +++ b/src/ipc.cpp @@ -48,7 +48,7 @@ constexpr static void* head_of(queue_t* que) { return static_cast(que->elems()); } -constexpr static queue_t* queue_of(handle_t h) { +constexpr static queue_t* queue_of(ipc::handle_t h) { return static_cast(h); } @@ -93,7 +93,7 @@ static auto& queues_cache() { /* API implementations */ -static handle_t connect(char const * name) { +static ipc::handle_t connect(char const * name) { auto mem = shm::acquire(name, sizeof(shm_info_t)); if (mem == nullptr) { return nullptr; @@ -101,7 +101,7 @@ static handle_t connect(char const * name) { return new queue_t { &(static_cast(mem)->elems_), name }; } -static void disconnect(handle_t h) { +static void disconnect(ipc::handle_t h) { queue_t* que = queue_of(h); if (que == nullptr) { return; @@ -111,7 +111,7 @@ static void disconnect(handle_t h) { delete que; } -static std::size_t recv_count(handle_t h) { +static std::size_t recv_count(ipc::handle_t h) { auto que = queue_of(h); if (que == nullptr) { return invalid_value; @@ -119,7 +119,7 @@ static std::size_t recv_count(handle_t h) { return que->conn_count(); } -static bool wait_for_recv(handle_t h, std::size_t r_count) { +static bool wait_for_recv(ipc::handle_t h, std::size_t r_count) { auto que = queue_of(h); if (que == nullptr) { return false; @@ -127,7 +127,7 @@ static bool wait_for_recv(handle_t h, std::size_t r_count) { return que->wait_for_connect(r_count); } -static void clear_recv(handle_t h) { +static void clear_recv(ipc::handle_t h) { auto* head = head_of(queue_of(h)); if (head == nullptr) { return; @@ -141,7 +141,7 @@ static void clear_recv(char const * name) { disconnect(h); } -static bool send(handle_t h, void const * data, std::size_t size) { +static bool send(ipc::handle_t h, void const * data, std::size_t size) { if (data == nullptr) { return false; } @@ -178,7 +178,7 @@ static bool send(handle_t h, void const * data, std::size_t size) { return true; } -static buff_t recv(handle_t h) { +static buff_t recv(ipc::handle_t h) { auto que = queue_of(h); if (que == nullptr) return {}; que->connect(); // wouldn't connect twice @@ -224,27 +224,27 @@ static buff_t recv(handle_t h) { namespace ipc { template