mirror of
https://github.com/boostorg/openmethod.git
synced 2026-01-19 04:22:12 +00:00
b2: treat warnings as errors, fix the few remaining
This commit is contained in:
@@ -104,7 +104,8 @@ struct is_unambiguous_accessible_base_of : std::is_base_of<Base, Derived> {
|
||||
static_assert(
|
||||
std::is_base_of_v<Base, Derived> ==
|
||||
std::is_convertible_v<Derived&, Base&>,
|
||||
"class must be an accessible unambiguous base, repeated inheritance is not "
|
||||
"class must be an accessible unambiguous base, repeated inheritance is "
|
||||
"not "
|
||||
"supported");
|
||||
};
|
||||
|
||||
|
||||
@@ -37,8 +37,7 @@ namespace boost::openmethod {
|
||||
//! including those pulled from libraries.
|
||||
struct default_registry
|
||||
: registry<
|
||||
policies::std_rtti, policies
|
||||
::vptr_vector,
|
||||
policies::std_rtti, policies ::vptr_vector,
|
||||
policies::fast_perfect_hash, policies::default_error_handler,
|
||||
policies::stderr_output
|
||||
#ifdef BOOST_OPENMETHOD_ENABLE_RUNTIME_CHECKS
|
||||
|
||||
@@ -150,7 +150,7 @@ struct fast_perfect_hash : type_hash {
|
||||
//! arguments.
|
||||
//! @param options Zero or more option objects.
|
||||
template<class... Options>
|
||||
static auto finalize(std::tuple<Options...> opts) -> void {
|
||||
static auto finalize(std::tuple<Options...>) -> void {
|
||||
detail::fast_perfect_hash_control<Registry>.clear();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -48,7 +48,7 @@ class vptr_map : public vptr {
|
||||
template<class ForwardIterator, class... Options>
|
||||
static void initialize(
|
||||
ForwardIterator first, ForwardIterator last,
|
||||
std::tuple<Options...> opts) {
|
||||
std::tuple<Options...>) {
|
||||
decltype(vptrs) new_vptrs;
|
||||
|
||||
for (auto iter = first; iter != last; ++iter) {
|
||||
|
||||
@@ -112,7 +112,7 @@ template<class Registry>
|
||||
template<class R>
|
||||
std::size_t odr_check<Registry>::inc = count++;
|
||||
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
//! Registry not initialized
|
||||
struct not_initialized : openmethod_error {
|
||||
|
||||
@@ -23,9 +23,10 @@ project
|
||||
|
||||
<warnings>extra
|
||||
|
||||
# <toolset>msvc:<warnings-as-errors>on
|
||||
# <toolset>gcc:<warnings-as-errors>on
|
||||
# <toolset>clang:<warnings-as-errors>on
|
||||
<toolset>msvc:<warnings-as-errors>on
|
||||
<toolset>gcc:<warnings-as-errors>on
|
||||
<toolset>clang,<os>!NT:<warnings-as-errors>on
|
||||
# !NT because it causes errors when builting unit-test
|
||||
;
|
||||
|
||||
alias unit_test_framework
|
||||
|
||||
@@ -10,6 +10,7 @@ struct Cat {};
|
||||
int main() {
|
||||
Cat felix;
|
||||
boost::openmethod::virtual_ptr<Cat> p(felix);
|
||||
(void)p;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ struct poke;
|
||||
auto poke_cat(virtual_ptr<Cat>) -> void {
|
||||
}
|
||||
|
||||
BOOST_OPENMETHOD_REGISTER(method<poke, void(virtual_ptr<Animal>)>::override<poke_cat>);
|
||||
|
||||
BOOST_OPENMETHOD_REGISTER(
|
||||
method<poke, void(virtual_ptr<Animal>)>::override<poke_cat>);
|
||||
|
||||
int main() {
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ BOOST_AUTO_TEST_CASE(unknown_class_overrider) {
|
||||
|
||||
} // namespace TEST_NS
|
||||
|
||||
|
||||
namespace TEST_NS {
|
||||
|
||||
struct registry : test_registry_<__COUNTER__>::with<
|
||||
@@ -62,7 +61,6 @@ BOOST_AUTO_TEST_CASE(missing_base_class) {
|
||||
|
||||
} // namespace TEST_NS
|
||||
|
||||
|
||||
namespace TEST_NS {
|
||||
|
||||
struct registry : test_registry_<__COUNTER__>::with<
|
||||
|
||||
@@ -340,10 +340,9 @@ BOOST_AUTO_TEST_CASE(simple) {
|
||||
BOOST_TEST(
|
||||
!detail::vptr_vector_vptrs<test_registry::registry_type>.empty());
|
||||
test_registry::finalize();
|
||||
static_assert(
|
||||
detail::has_finalize_aux<
|
||||
void,
|
||||
test_registry::policy<policies::vptr>, std::tuple<>>::value);
|
||||
static_assert(detail::has_finalize_aux<
|
||||
void, test_registry::policy<policies::vptr>,
|
||||
std::tuple<>>::value);
|
||||
BOOST_TEST(
|
||||
detail::vptr_vector_vptrs<test_registry::registry_type>.empty());
|
||||
}
|
||||
|
||||
@@ -43,7 +43,9 @@ struct Pet : bom::inplace_vptr_base<Pet> {
|
||||
std::ostream& os;
|
||||
};
|
||||
|
||||
struct DomesticCat : Cat, Pet, bom::inplace_vptr_derived<DomesticCat, Cat, Pet> {
|
||||
struct DomesticCat : Cat,
|
||||
Pet,
|
||||
bom::inplace_vptr_derived<DomesticCat, Cat, Pet> {
|
||||
explicit DomesticCat(std::ostream& os);
|
||||
~DomesticCat();
|
||||
};
|
||||
|
||||
@@ -45,8 +45,9 @@ BOOST_OPENMETHOD_OVERRIDE(
|
||||
return std::make_unique<matrix>();
|
||||
}
|
||||
|
||||
static_assert(std::is_same_v<
|
||||
detail::virtual_type<std::unique_ptr<matrix>, test_registry>, matrix>);
|
||||
static_assert(
|
||||
std::is_same_v<
|
||||
detail::virtual_type<std::unique_ptr<matrix>, test_registry>, matrix>);
|
||||
|
||||
BOOST_AUTO_TEST_CASE(covariant_return_type) {
|
||||
auto compiler = boost::openmethod::initialize<test_registry>(n2216());
|
||||
|
||||
@@ -35,7 +35,8 @@ struct Taxi : Expense {};
|
||||
struct PrivateJet : Expense {};
|
||||
|
||||
BOOST_OPENMETHOD_CLASSES(
|
||||
Role, Employee, Manager, Founder, Expense, Public, Bus, Metro, Taxi, PrivateJet);
|
||||
Role, Employee, Manager, Founder, Expense, Public, Bus, Metro, Taxi,
|
||||
PrivateJet);
|
||||
|
||||
BOOST_OPENMETHOD(pay, (virtual_ptr<Employee>), double);
|
||||
BOOST_OPENMETHOD(
|
||||
|
||||
@@ -194,7 +194,7 @@ BOOST_AUTO_TEST_CASE(bad_call) {
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(bad_call_type_ids) {
|
||||
auto report = initialize<registry>().report;
|
||||
initialize<registry>();
|
||||
registry::capture capture;
|
||||
|
||||
try {
|
||||
|
||||
@@ -68,7 +68,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(
|
||||
BOOST_TEST(p.get() == snoopy.get());
|
||||
BOOST_TEST(p.vptr() == Registry::template static_vptr<Dog>);
|
||||
|
||||
p = p;
|
||||
p = *&p;
|
||||
BOOST_TEST(p.get() == snoopy.get());
|
||||
BOOST_TEST(p.vptr() == Registry::template static_vptr<Dog>);
|
||||
|
||||
@@ -294,7 +294,7 @@ BOOST_AUTO_TEST_CASE(cast_shared_ptr_lvalue_reference) {
|
||||
|
||||
bool cast_moves() {
|
||||
std::shared_ptr<Animal> animal = std::make_shared<Dog>();
|
||||
std::static_pointer_cast<Dog>(animal);
|
||||
(void) std::static_pointer_cast<Dog>(animal);
|
||||
|
||||
return animal.get() == nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user