修正一些bug

This commit is contained in:
mutouyun 2022-02-27 23:50:28 +08:00
parent c32615dbda
commit 67bdae6fd7
3 changed files with 14 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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 {