Add -Wmissing-declarations to the SelfTest project

This required some clean-up in our test files
This commit is contained in:
Martin Hořeňovský
2018-07-02 11:13:07 +02:00
parent 4846ad59e1
commit e1d81174db
7 changed files with 56 additions and 31 deletions

View File

@@ -16,6 +16,16 @@ std::string fallbackStringifier(T const&) {
#include "catch.hpp"
#if defined(__GNUC__)
// This has to be left enabled until end of the TU, because the GCC
// frontend reports operator<<(std::ostream& os, const has_maker_and_operator&)
// as unused anyway
# pragma GCC diagnostic ignored "-Wunused-function"
#endif
namespace {
struct has_operator { };
struct has_maker {};
struct has_maker_and_operator {};
@@ -38,6 +48,8 @@ StreamT& operator<<(StreamT& os, const has_template_operator&) {
return os;
}
} // end anonymous namespace
namespace Catch {
template<>
struct StringMaker<has_maker> {
@@ -100,6 +112,8 @@ TEST_CASE( "stringify( vectors<has_maker_and_operator> )", "[toString]" ) {
REQUIRE( ::Catch::Detail::stringify( v ) == "{ StringMaker<has_maker_and_operator> }" );
}
namespace {
// Range-based conversion should only be used if other possibilities fail
struct int_iterator {
using iterator_category = std::input_iterator_tag;
@@ -139,6 +153,8 @@ struct stringmaker_range {
int_iterator end() const { return {}; }
};
} // end anonymous namespace
namespace Catch {
template <>
struct StringMaker<stringmaker_range> {
@@ -148,6 +164,8 @@ struct StringMaker<stringmaker_range> {
};
}
namespace {
struct just_range {
int_iterator begin() const { return int_iterator{ 1 }; }
int_iterator end() const { return {}; }
@@ -158,6 +176,8 @@ struct disabled_range {
int_iterator end() const { return {}; }
};
} // end anonymous namespace
namespace Catch {
template <>
struct is_range<disabled_range> {