Skip to content

Commit 3e454b7

Browse files
committed
fix warnings
1 parent 73f663f commit 3e454b7

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
build*
44
site/*
55
/.vscode/
6+
.vs/
67

78
# clangd cache
89
/.cache/*
10+
CMakeSettings.json

CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ if(USE_V3_COMPATIBLE_NAMES)
6060
endif()
6161

6262
#---- Find other packages ----
63-
find_package(Threads)
63+
find_package(Threads REQUIRED)
6464
find_package(ZMQ)
6565

6666
if( ZMQ_FOUND )
@@ -112,10 +112,12 @@ elseif(BTCPP_UNIT_TESTS)
112112
include(FetchContent)
113113
FetchContent_Declare(
114114
googletest
115-
URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip
116-
)
115+
GIT_REPOSITORY https://github.com/google/googletest.git
116+
GIT_TAG release-1.12.1)
117117
# For Windows: Prevent overriding the parent project's compiler/linker settings
118118
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
119+
set(BUILD_GMOCK OFF CACHE BOOL "" FORCE)
120+
set(BUILD_GTEST ON CACHE BOOL "" FORCE)
119121
FetchContent_MakeAvailable(googletest)
120122
endif()
121123
endif()
@@ -195,7 +197,7 @@ endif()
195197

196198
target_link_libraries(${BEHAVIOR_TREE_LIBRARY}
197199
PUBLIC
198-
${CMAKE_THREAD_LIBS_INIT}
200+
Threads::Threads
199201
${CMAKE_DL_LIBS}
200202
PRIVATE
201203
$<BUILD_INTERFACE:foonathan::lexy>

include/behaviortree_cpp/utils/convert_impl.hpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,16 @@ inline void checkUpperLimit(const From& from)
7373
template <typename From, typename To>
7474
inline void checkLowerLimit(const From& from)
7575
{
76-
if (from < std::numeric_limits<To>::min()){
77-
throw std::runtime_error("Value outside the lovest numerical limit.");
76+
if constexpr (std::is_same<To, bool>::value)
77+
{
78+
if (from !=0 && from != 1)
79+
{
80+
throw std::runtime_error("Implicit casting to bool is not allowed");
7881
}
82+
}
83+
else if (from < std::numeric_limits<To>::min()){
84+
throw std::runtime_error("Value outside the lovest numerical limit.");
85+
}
7986
}
8087

8188
template <typename From, typename To>

tools/bt_log_cat.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ int main(int argc, char* argv[])
5757

5858
for (size_t i = 0; i < node->children_uid()->size(); i++)
5959
{
60-
recursiveStep(node->children_uid()->Get(i), indent + 1);
60+
recursiveStep(node->children_uid()->Get(uint16_t(i)), indent + 1);
6161
}
6262
};
6363

0 commit comments

Comments
 (0)