From 67bdae6fd7902ccb16835b450ba2ea61b3e0dd72 Mon Sep 17 00:00:00 2001 From: mutouyun Date: Sun, 27 Feb 2022 23:50:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=B8=80=E4=BA=9Bbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 2 -- include/libipc/detect_plat.h | 4 ++-- test/test_detect_plat.cpp | 12 ++++++++++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1eb24a0..d90529d 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,8 +13,6 @@ if(NOT MSVC) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2") endif() -add_definitions(-DLIBIPC_CPP_14 -DLIBIPC_CPP_17) - if (MSVC) set(CompilerFlags CMAKE_CXX_FLAGS diff --git a/include/libipc/detect_plat.h b/include/libipc/detect_plat.h index 196796f..a90aef2 100644 --- a/include/libipc/detect_plat.h +++ b/include/libipc/detect_plat.h @@ -85,7 +85,7 @@ #if (__cplusplus >= 201703L) && !defined(LIBIPC_CPP_17) # define LIBIPC_CPP_17 #endif -#if (__cplusplus >= 201402L) && !defined(LIBIPC_CPP_14) +#if /*(__cplusplus >= 201402L) &&*/ !defined(LIBIPC_CPP_14) # define LIBIPC_CPP_14 #endif @@ -123,7 +123,7 @@ #if !defined(LIBIPC_UNUSED) # if defined(LIBIPC_CC_GNUC) # define LIBIPC_UNUSED __attribute__((__unused__)) -# elif defined(LIBIPC_CC_MSVC_) +# elif defined(LIBIPC_CC_MSVC) # define LIBIPC_UNUSED __pragma(warning(suppress: 4100 4101 4189)) # else # define LIBIPC_UNUSED diff --git a/test/test_detect_plat.cpp b/test/test_detect_plat.cpp index 001a350..99ec8a2 100644 --- a/test/test_detect_plat.cpp +++ b/test/test_detect_plat.cpp @@ -36,6 +36,18 @@ TEST(detect_plat, cc) { #endif } +TEST(detect_plat, cpp) { +#if defined(LIBIPC_CPP_20) + std::cout << "LIBIPC_CPP_20\n"; +#elif defined(LIBIPC_CPP_17) + std::cout << "LIBIPC_CPP_17\n"; +#elif defined(LIBIPC_CPP_14) + std::cout << "LIBIPC_CPP_14\n"; +#else + ASSERT_TRUE(false); +#endif +} + TEST(detect_plat, byte_order) { auto is_endian_little = [] { union {