Skip to content

Commit 4d9f86f

Browse files
committed
fix coverity violations
1 parent d41717e commit 4d9f86f

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

include/boost/openmethod/core.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2740,6 +2740,8 @@ method<Id, ReturnType(Parameters...), Registry>::override_impl<
27402740
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
27412741
#endif
27422742

2743+
// zero-initalized static variable
2744+
// coverity[uninit_use:FALSE]
27432745
if (overrider_info::method) {
27442746
BOOST_ASSERT(overrider_info::method == &fn);
27452747
return;

include/boost/openmethod/initialize.hpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ struct registry<Policies...>::compiler : detail::generic_compiler {
401401
compiler(Options... opts);
402402

403403
auto compile();
404-
auto initialize();
404+
void initialize();
405405
void install_global_tables();
406406

407407
void augment_classes();
@@ -461,13 +461,10 @@ auto registry<Policies...>::compiler<Options...>::compile() {
461461

462462
template<class... Policies>
463463
template<class... Options>
464-
auto registry<Policies...>::compiler<Options...>::initialize() {
464+
void registry<Policies...>::compiler<Options...>::initialize() {
465465
compile();
466466
install_global_tables();
467-
468467
registry<Policies...>::initialized = true;
469-
470-
return *this;
471468
}
472469

473470
template<class... Policies>

include/boost/openmethod/policies/default_error_handler.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ struct default_error_handler : error_handler {
9696
//! @return The previous function.
9797
static auto set(function_type new_handler) -> function_type {
9898
auto prev = handler;
99-
handler = new_handler;
99+
handler = std::move(new_handler);
100100

101101
return prev;
102102
}

include/boost/openmethod/policies/vptr_map.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,11 @@ class vptr_map : public vptr {
9898
}
9999

100100
if constexpr (Registry::has_indirect_vptr) {
101+
// check for valid iterator is done if runtime_checks is enabled
102+
// coverity[deref_iterator:SUPPRESS]
101103
return *iter->second;
102104
} else {
105+
// coverity[deref_iterator:SUPPRESS]
103106
return iter->second;
104107
}
105108
}

0 commit comments

Comments
 (0)