Skip to content

Commit a2c229a

Browse files
committed
remove unused exceptions
1 parent 6d0bb72 commit a2c229a

File tree

4 files changed

+7
-26
lines changed

4 files changed

+7
-26
lines changed

.clang-tidy

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,14 @@ Checks: [
1010
"performance-*",
1111
"portability-*",
1212
"readability-*",
13-
"-bugprone-branch-clone",
1413
"-bugprone-easily-swappable-parameters",
1514
"-bugprone-narrowing-conversions",
16-
"-clang-analyzer-optin.cplusplus.VirtualCall",
1715
"-cppcoreguidelines-avoid-c-arrays",
1816
"-cppcoreguidelines-avoid-const-or-ref-data-members",
1917
"-cppcoreguidelines-avoid-magic-numbers",
2018
"-cppcoreguidelines-avoid-non-const-global-variables",
21-
"-cppcoreguidelines-init-variables",
2219
"-cppcoreguidelines-narrowing-conversions",
2320
"-cppcoreguidelines-owning-memory",
24-
"-cppcoreguidelines-prefer-member-initializer",
2521
"-cppcoreguidelines-pro-bounds-array-to-pointer-decay",
2622
"-cppcoreguidelines-pro-bounds-constant-array-index",
2723
"-cppcoreguidelines-pro-bounds-pointer-arithmetic",
@@ -32,8 +28,6 @@ Checks: [
3228
"-cppcoreguidelines-use-default-member-init",
3329
"-misc-no-recursion",
3430
"-modernize-avoid-c-arrays",
35-
"-modernize-use-default-member-init",
36-
"-modernize-use-designated-initializers",
3731
"-modernize-use-emplace",
3832
"-performance-avoid-const-params",
3933
"-performance-avoid-endl",

include/behaviortree_cpp/utils/convert_impl.hpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,9 @@ void convertNumber(const SRC& source, DST& target)
157157
// these conversions are always safe:
158158
// - same type
159159
// - float -> double
160-
if constexpr(is_same<SRC, DST>() || (is_same<SRC, float>() && is_same<DST, double>()))
160+
// - conversion to bool
161+
if constexpr(is_same<SRC, DST>() || (is_same<SRC, float>() && is_same<DST, double>()) ||
162+
(is_convertible_to_bool<SRC>() && is_same<DST, bool>()))
161163
{
162164
// No check needed
163165
target = static_cast<DST>(source);
@@ -179,11 +181,6 @@ void convertNumber(const SRC& source, DST& target)
179181
}
180182
target = static_cast<DST>(source);
181183
}
182-
// special case: bool accept truncation
183-
else if constexpr(is_convertible_to_bool<SRC>() && is_same<DST, bool>())
184-
{
185-
target = static_cast<DST>(source);
186-
}
187184
// casting to/from floating points might cause truncation.
188185
else if constexpr(std::is_floating_point<SRC>::value ||
189186
std::is_floating_point<DST>::value)

include/behaviortree_cpp/utils/wildcards.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ inline bool wildcards_match(std::string_view str, std::string_view pattern)
4040
return cached == 1;
4141
}
4242

43-
bool result;
43+
bool result = false;
4444
if(pattern[j] == '*')
4545
{
4646
result = match_ref(match_ref, i, j + 1);

src/xml_parsing.cpp

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,8 @@ struct XMLParser::PImpl
148148
XMLParser::XMLParser(const BehaviorTreeFactory& factory) : _p(new PImpl(factory))
149149
{}
150150

151-
XMLParser::XMLParser(XMLParser&& other) noexcept
152-
{
153-
this->_p = std::move(other._p);
154-
}
151+
XMLParser::XMLParser(XMLParser&& other) noexcept : _p(std::move(other._p))
152+
{}
155153

156154
XMLParser& XMLParser::operator=(XMLParser&& other) noexcept
157155
{
@@ -546,15 +544,7 @@ void VerifyXML(const std::string& xml_text,
546544
}
547545
}
548546
}
549-
else if(node_type == NodeType::ACTION)
550-
{
551-
if(children_count != 0)
552-
{
553-
ThrowError(line_number, std::string("The node '") + registered_name +
554-
"' must not have any child");
555-
}
556-
}
557-
else if(node_type == NodeType::CONDITION)
547+
else if(node_type == NodeType::ACTION || node_type == NodeType::CONDITION)
558548
{
559549
if(children_count != 0)
560550
{

0 commit comments

Comments
 (0)