Skip to content

Commit

Permalink
Merge pull request #12 from tnakazato/fix-clang-compile-warning
Browse files Browse the repository at this point in the history
Fix clang compile warning
  • Loading branch information
tnakazato authored Nov 18, 2022
2 parents c1e8d72 + fa28bb8 commit 018e32c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 28 deletions.
9 changes: 7 additions & 2 deletions libsakura/python-binding/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,13 @@ if(APPLE)
endif(APPLE)
message("default CMAKE_CXX_FLAGS_RELEASE is ${CMAKE_CXX_FLAGS_RELEASE}")
message("default CMAKE_CXX_FLAGS_DEBUG is ${CMAKE_CXX_FLAGS_DEBUG}")
set(CMAKE_CXX_FLAGS_RELEASE "-funroll-all-loops -O3 -DNDEBUG ${VECT_VERB} ${PROF_MODE}")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -funroll-all-loops -O3 -DNDEBUG ${VECT_VERB} ${PROF_MODE}")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(UNROLL_OPTION "-funroll-loops")
else()
set(UNROLL_OPTION "-funroll-all-loops")
endif()
set(CMAKE_CXX_FLAGS_RELEASE "${UNROLL_OPTION} -O3 -DNDEBUG ${VECT_VERB} ${PROF_MODE}")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g ${UNROLL_OPTION} -O3 -DNDEBUG ${VECT_VERB} ${PROF_MODE}")
message("CMAKE_CXX_FLAGS_RELEASE was set to ${CMAKE_CXX_FLAGS_RELEASE}")

#set(ADDITIONAL_CXXFLAGS_Default "-mtune=generic -DARCH_SUFFIX=Default -DARCH_DEFAULT=1")
Expand Down
14 changes: 7 additions & 7 deletions libsakura/src/bool_filter_collection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
* Copyright (C) 2013-2022
* Inter-University Research Institute Corporation, National Institutes of Natural Sciences
* 2-21-1, Osawa, Mitaka, Tokyo, 181-8588, Japan.
*
*
* This file is part of Sakura.
*
*
* Sakura is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
*
* Sakura is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public License
* along with Sakura. If not, see <http://www.gnu.org/licenses/>.
* @SAKURA_LICENSE_HEADER_END@
Expand Down Expand Up @@ -903,7 +903,7 @@ extern "C" LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(Uint8ToBool)(
data = &data[end];
result = &result[end];
num_data -= end;
auto operation_for_element = [kZero](decltype(data[0]) data_value) {
auto operation_for_element = [](decltype(data[0]) data_value) {
return (data_value != kZero);
};
return DoElementFuncBoolFilter(operation_for_element, num_data, data, result);
Expand All @@ -917,7 +917,7 @@ extern "C" LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(Uint8ToBool)(
size_t num_data, uint8_t const data[/*num_data*/],
bool result[/*num_data*/]) noexcept {
constexpr uint8_t kZero = 0;
auto operation_for_element = [kZero](decltype(data[0]) data_value) {
auto operation_for_element = [](decltype(data[0]) data_value) {
return (data_value != kZero);
};
return DoElementFuncBoolFilter(operation_for_element, num_data, data,
Expand All @@ -929,7 +929,7 @@ extern "C" LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(Uint32ToBool)(
size_t num_data, uint32_t const data[/*num_data*/],
bool result[/*num_data*/]) noexcept {
constexpr uint8_t kZero = 0;
auto operation_for_element = [kZero](decltype(data[0]) data_value) {
auto operation_for_element = [](decltype(data[0]) data_value) {
return (data_value != kZero);
};
return DoElementFuncBoolFilter(operation_for_element, num_data, data,
Expand Down
20 changes: 10 additions & 10 deletions libsakura/src/libsakura/packed_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
* Copyright (C) 2013-2022
* Inter-University Research Institute Corporation, National Institutes of Natural Sciences
* 2-21-1, Osawa, Mitaka, Tokyo, 181-8588, Japan.
*
*
* This file is part of Sakura.
*
*
* Sakura is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
*
* Sakura is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public License
* along with Sakura. If not, see <http://www.gnu.org/licenses/>.
* @SAKURA_LICENSE_HEADER_END@
Expand Down Expand Up @@ -187,15 +187,15 @@ union LIBSAKURA_SYMBOL(SimdPacketMMX) {
/**
* SIMDアーキテクチャーを識別する型(MMX)
*/
typedef struct {
typedef struct LIBSAKURA_SYMBOL(SimdArchMMX) {
// 64bit
/**
* @~japanese
* @brief
* このアーキテクチャーにおけるPacket型
*/
typedef LIBSAKURA_SYMBOL(SimdPacketMMX) PacketType;
}LIBSAKURA_SYMBOL(SimdArchMMX);
} LIBSAKURA_SYMBOL(SimdArchMMX);

#if defined(__SSE4_2__)

Expand Down Expand Up @@ -278,7 +278,7 @@ union LIBSAKURA_SYMBOL(SimdPacketSSE) {
/**
* SIMDアーキテクチャーを識別する型(SSE)
*/
typedef struct {
typedef struct LIBSAKURA_SYMBOL(SimdArchSSE) {
// 128bit
/**
* @~japanese
Expand All @@ -292,7 +292,7 @@ typedef struct {
* 前の世代のSIMDアーキテクチャーの型
*/
typedef LIBSAKURA_SYMBOL(SimdArchMMX) PriorArch;
}LIBSAKURA_SYMBOL(SimdArchSSE);
} LIBSAKURA_SYMBOL(SimdArchSSE);

#if defined(__AVX__)

Expand Down Expand Up @@ -376,7 +376,7 @@ union LIBSAKURA_SYMBOL(SimdPacketAVX) {
/**
* SIMDアーキテクチャーを識別する型(AVX)
*/
typedef struct {
typedef struct LIBSAKURA_SYMBOL(SimdArchAVX) {
// 256bit
/**
* @~japanese
Expand All @@ -390,7 +390,7 @@ typedef struct {
* 前の世代のSIMDアーキテクチャーの型
*/
typedef LIBSAKURA_SYMBOL(SimdArchSSE) PriorArch;
}LIBSAKURA_SYMBOL(SimdArchAVX);
} LIBSAKURA_SYMBOL(SimdArchAVX);
#endif /* defined(__AVX__) */

#if defined(__AVX__)
Expand Down
16 changes: 7 additions & 9 deletions libsakura/test/lsq.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
* Copyright (C) 2013-2022
* Inter-University Research Institute Corporation, National Institutes of Natural Sciences
* 2-21-1, Osawa, Mitaka, Tokyo, 181-8588, Japan.
*
*
* This file is part of Sakura.
*
*
* Sakura is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
*
* Sakura is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public License
* along with Sakura. If not, see <http://www.gnu.org/licenses/>.
* @SAKURA_LICENSE_HEADER_END@
Expand Down Expand Up @@ -1435,7 +1435,6 @@ void Prologue(TestCase &tc, TestCase const &default_tc, ParamSet &ps) {
PAttr param;
PAttr default_param;
string name;
PDType dtype;
PVType vtype;
if (tc.category == TCat_kPF) {
if (tc.api_name == ApiName_kLSQFitPolynomialFloat) {
Expand Down Expand Up @@ -1619,10 +1618,9 @@ void Prologue(TestCase &tc, TestCase const &default_tc, ParamSet &ps) {
for (size_t i = 0; i < tc.param.size(); ++i) {
param = tc.param[i];
name = param.name;
dtype = param.data_type;
default_param = default_tc.param[i];
assert(name == default_param.name);
assert(dtype == default_param.data_type);
assert(param.data_type == default_param.data_type);
vtype = param.value_type;
if (vtype == PVType_kNULL) {
if ((tc.api_name == ApiName_kCreateLSQFitContextPolynomialFloat)
Expand Down Expand Up @@ -1658,9 +1656,9 @@ void Prologue(TestCase &tc, TestCase const &default_tc, ParamSet &ps) {
== ApiName_kCreateLSQFitContextCubicSplineFloat)
|| (tc.api_name
== ApiName_kCreateLSQFitContextSinusoidFloat)) {
assert(dtype == PDType_kContextPointerPointer);
assert(param.data_type == PDType_kContextPointerPointer);
} else {
assert(dtype == PDType_kContextPointer);
assert(param.data_type == PDType_kContextPointer);
for (size_t j = 0; j < LsqFuncTypeStr.size(); ++j) {
if (desc_has(LsqFuncTypeStr[j])) {
ps.ctxt[name] = ps.ctxt[LsqFuncTypeStr[j]];
Expand Down

0 comments on commit 018e32c

Please sign in to comment.