forked from mindspore-Ecosystem/mindspore
fix mac compile on clang++13
This commit is contained in:
parent
c3c827ff44
commit
9c13ae6fac
|
@ -19,9 +19,14 @@ if(NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O2 -Wno-inconsistent-missing-override \
|
set(MACOSX_CXX_WARNING_FLAGS "-Wno-inconsistent-missing-override \
|
||||||
-Wno-unused-lambda-capture -Wno-unneeded-internal-declaration -Wno-unused-variable \
|
-Wno-unused-lambda-capture -Wno-unneeded-internal-declaration -Wno-unused-variable \
|
||||||
-Wno-return-std-move -DHALF_ENABLE_CPP11_USER_LITERALS=0 -D_FORTIFY_SOURCE=2")
|
-Wno-return-std-move")
|
||||||
|
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 13.1)
|
||||||
|
set(MACOSX_CXX_WARNING_FLAGS "${MACOSX_CXX_WARNING_FLAGS} -Wno-unused-but-set-variable")
|
||||||
|
endif()
|
||||||
|
set(CMAKE_CXX_FLAGS_RELEASE
|
||||||
|
"$ENV{CXXFLAGS} -O2 ${MACOSX_CXX_WARNING_FLAGS} -DHALF_ENABLE_CPP11_USER_LITERALS=0 -D_FORTIFY_SOURCE=2")
|
||||||
elseif(ENABLE_SYM_FILE)
|
elseif(ENABLE_SYM_FILE)
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O2 -g -ggdb -Wl,--allow-shlib-undefined \
|
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O2 -g -ggdb -Wl,--allow-shlib-undefined \
|
||||||
-DHALF_ENABLE_CPP11_USER_LITERALS=0 -D_FORTIFY_SOURCE=2")
|
-DHALF_ENABLE_CPP11_USER_LITERALS=0 -D_FORTIFY_SOURCE=2")
|
||||||
|
@ -37,8 +42,7 @@ endif()
|
||||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -g2 -ggdb -fno-inline-functions -fno-omit-frame-pointer \
|
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -g2 -ggdb -fno-inline-functions -fno-omit-frame-pointer \
|
||||||
-D_LIBCPP_INLINE_VISIBILITY='' -D_LIBCPP_DISABLE_EXTERN_TEMPLATE=1 -DHALF_ENABLE_CPP11_USER_LITERALS=0 \
|
-D_LIBCPP_INLINE_VISIBILITY='' -D_LIBCPP_DISABLE_EXTERN_TEMPLATE=1 -DHALF_ENABLE_CPP11_USER_LITERALS=0 \
|
||||||
-D_FORTIFY_SOURCE=2 -Wno-cpp -Wno-inconsistent-missing-override -Wno-unused-lambda-capture \
|
-D_FORTIFY_SOURCE=2 -Wno-cpp ${MACOSX_CXX_WARNING_FLAGS}")
|
||||||
-Wno-unneeded-internal-declaration -Wno-unused-variable -Wno-return-std-move")
|
|
||||||
else()
|
else()
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -g2 -ggdb -fno-inline-functions -fno-omit-frame-pointer \
|
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -g2 -ggdb -fno-inline-functions -fno-omit-frame-pointer \
|
||||||
-Wl,--allow-shlib-undefined -D_LIBCPP_INLINE_VISIBILITY='' -D_LIBCPP_DISABLE_EXTERN_TEMPLATE=1 \
|
-Wl,--allow-shlib-undefined -D_LIBCPP_INLINE_VISIBILITY='' -D_LIBCPP_DISABLE_EXTERN_TEMPLATE=1 \
|
||||||
|
|
|
@ -102,7 +102,6 @@ Status CacheService::CacheRow(const std::vector<const void *> &buf, row_id_type
|
||||||
*row_id_generated = msg->row_id();
|
*row_id_generated = msg->row_id();
|
||||||
}
|
}
|
||||||
auto size_of_this = msg->size_of_this();
|
auto size_of_this = msg->size_of_this();
|
||||||
size_t total_sz = size_of_this;
|
|
||||||
auto column_hdr = msg->column();
|
auto column_hdr = msg->column();
|
||||||
// Number of tensor buffer should match the number of columns plus one.
|
// Number of tensor buffer should match the number of columns plus one.
|
||||||
if (buf.size() != column_hdr->size() + 1) {
|
if (buf.size() != column_hdr->size() + 1) {
|
||||||
|
@ -116,7 +115,6 @@ Status CacheService::CacheRow(const std::vector<const void *> &buf, row_id_type
|
||||||
all_data.emplace_back(fb, size_of_this);
|
all_data.emplace_back(fb, size_of_this);
|
||||||
for (auto i = 0; i < column_hdr->size(); ++i) {
|
for (auto i = 0; i < column_hdr->size(); ++i) {
|
||||||
all_data.emplace_back(buf.at(i + 1), msg->data_sz()->Get(i));
|
all_data.emplace_back(buf.at(i + 1), msg->data_sz()->Get(i));
|
||||||
total_sz += msg->data_sz()->Get(i);
|
|
||||||
}
|
}
|
||||||
// Now we cache the buffer.
|
// Now we cache the buffer.
|
||||||
Status rc = cp_->Insert(*row_id_generated, all_data);
|
Status rc = cp_->Insert(*row_id_generated, all_data);
|
||||||
|
|
Loading…
Reference in New Issue