diff options
| author | Martin Hořeňovský | 2018-07-02 11:13:07 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2018-07-02 17:36:13 +0200 |
| commit | e1d81174dba1a7d81eb348490005dfc02a648c7e (patch) | |
| tree | 946dd410cd355691d62b93b52cf61b7c45577370 /projects/SelfTest/UsageTests/ToStringWhich.tests.cpp | |
| parent | 4846ad59e10e6174df1c4679cfef5bc80fe3f5d7 (diff) | |
| download | catch3-e1d81174dba1a7d81eb348490005dfc02a648c7e.tar.gz | |
Add -Wmissing-declarations to the SelfTest project
This required some clean-up in our test files
Diffstat (limited to 'projects/SelfTest/UsageTests/ToStringWhich.tests.cpp')
| -rw-r--r-- | projects/SelfTest/UsageTests/ToStringWhich.tests.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/projects/SelfTest/UsageTests/ToStringWhich.tests.cpp b/projects/SelfTest/UsageTests/ToStringWhich.tests.cpp index 26afa3b1..cd4a1518 100644 --- a/projects/SelfTest/UsageTests/ToStringWhich.tests.cpp +++ b/projects/SelfTest/UsageTests/ToStringWhich.tests.cpp @@ -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> { |