fixed a few warnings and expected failures in tests

This commit is contained in:
Lorenzo Caminiti 2019-05-30 21:30:38 -07:00
parent 5a72a905dd
commit ebe44e53a7
18 changed files with 76 additions and 88 deletions

View File

@ -198,8 +198,12 @@ struct call_if_statement<true, Then, ThenResult> { // Copyable (as *).
if-statement static predicate is @c true).
*/
template<bool ElseIfPred, typename ElseIfThen>
call_if_statement<true, Then, ThenResult> else_if_c(ElseIfThen const& f)
const { return *this; }
call_if_statement<true, Then, ThenResult> else_if_c(
ElseIfThen const&
#ifdef BOOST_CONTRACT_DETAIL_DOXYGEN // Avoid unused param warning.
f
#endif
) const { return *this; }
/**
Specify an else-if-branch functor template (using a nullary boolean
@ -222,8 +226,12 @@ struct call_if_statement<true, Then, ThenResult> { // Copyable (as *).
if-statement static predicate is @c true).
*/
template<class ElseIfPred, typename ElseIfThen>
call_if_statement<true, Then, ThenResult> else_if(ElseIfThen const& f)
const { return *this; }
call_if_statement<true, Then, ThenResult> else_if(
ElseIfThen const&
#ifdef BOOST_CONTRACT_DETAIL_DOXYGEN // Avoid unused param warning.
f
#endif
) const { return *this; }
private:
boost::shared_ptr<ThenResult> r_;
@ -294,9 +302,12 @@ struct call_if_statement<true, Then, void> { // Copyable (no data).
(because the then-branch functor template calls return void).
*/
template<bool ElseIfPred, typename ElseIfThen>
call_if_statement<true, Then, void> else_if_c(ElseIfThen const& f) const {
return *this;
}
call_if_statement<true, Then, void> else_if_c(
ElseIfThen const&
#ifdef BOOST_CONTRACT_DETAIL_DOXYGEN // Avoid unused param warning.
f
#endif
) const { return *this; }
/**
Specify an else-if-branch functor template (using a nullary boolean
@ -319,9 +330,12 @@ struct call_if_statement<true, Then, void> { // Copyable (no data).
(because the then-branch functor template calls return void).
*/
template<class ElseIfPred, typename ElseIfThen>
call_if_statement<true, Then, void> else_if(ElseIfThen const& f) const {
return *this;
}
call_if_statement<true, Then, void> else_if(
ElseIfThen const&
#ifdef BOOST_CONTRACT_DETAIL_DOXYGEN // Avoid unused param warning.
f
#endif
) const { return *this; }
};
/**

View File

@ -42,7 +42,9 @@ specified in that order.
// is used instead of `check c = ...` but only up to C++17. C++17 strong copy
// elision on function return values prevents this lib from generating a
// compile-time error in those cases, but the lib will still generate a run-time
// error according with ON_MISSING_CHECK_DECL.
// error according with ON_MISSING_CHECK_DECL. Furthermore, on some C++98
// compilers, this private copy ctor gives a warning (because of lack of copy
// optimization on those compilers), this warning can be ignored.
#if !defined(BOOST_CONTRACT_NO_CONDITIONS) || \
defined(BOOST_CONTRACT_STATIC_LINK)
#define BOOST_CONTRACT_SPECIFY_CLASS_IMPL_(class_type, cond_type) \
@ -222,9 +224,12 @@ public:
by this function does not allow to specify any additional contract.
*/
template<typename F>
specify_nothing except(F const& f) {
BOOST_CONTRACT_SPECIFY_EXCEPT_IMPL_
}
specify_nothing except(
F const&
#ifndef BOOST_CONTRACT_NO_EXCEPTS // Avoid unused param warning.
f
#endif
) { BOOST_CONTRACT_SPECIFY_EXCEPT_IMPL_ }
/** @cond */
private:
@ -326,9 +331,12 @@ public:
by this function does not allow to specify any additional contract.
*/
template<typename F>
specify_nothing except(F const& f) {
BOOST_CONTRACT_SPECIFY_EXCEPT_IMPL_
}
specify_nothing except(
F const&
#ifndef BOOST_CONTRACT_NO_EXCEPTS // Avoid unused param warning.
f
#endif
) { BOOST_CONTRACT_SPECIFY_EXCEPT_IMPL_ }
/** @cond */
private:
@ -463,9 +471,12 @@ public:
by this function does not allow to specify any additional contract.
*/
template<typename F>
specify_nothing except(F const& f) {
BOOST_CONTRACT_SPECIFY_EXCEPT_IMPL_
}
specify_nothing except(
F const&
#ifndef BOOST_CONTRACT_NO_EXCEPTS // Avoid unused param warning.
f
#endif
) { BOOST_CONTRACT_SPECIFY_EXCEPT_IMPL_ }
/** @cond */
private:
@ -633,9 +644,12 @@ public:
by this function does not allow to specify any additional contract.
*/
template<typename F>
specify_nothing except(F const& f) {
BOOST_CONTRACT_SPECIFY_EXCEPT_IMPL_
}
specify_nothing except(
F const&
#ifndef BOOST_CONTRACT_NO_EXCEPTS // Avoid unused param warning.
f
#endif
) { BOOST_CONTRACT_SPECIFY_EXCEPT_IMPL_ }
/** @cond */
private:

View File

@ -143,7 +143,10 @@ public:
boost::contract::from from,
boost::contract::virtual_* v,
C* obj,
VR& r
VR&
#ifndef BOOST_CONTRACT_NO_POSTCONDITIONS // Avoid unused param warning.
r
#endif
BOOST_CONTRACT_DETAIL_TVARIADIC_COMMA(BOOST_CONTRACT_MAX_ARGS)
BOOST_CONTRACT_DETAIL_TVARIADIC_FPARAMS_Z(1,
BOOST_CONTRACT_MAX_ARGS, Args, &, args)

View File

@ -311,7 +311,7 @@ public:
"otherwise use old_ptr_if_copyable<T>"
);
if(typed_copy_) return &typed_copy_->old();
return 0;
return static_cast<T const*>(0); // Explicit cast avoids warning.
}
#ifndef BOOST_CONTRACT_DETAIL_DOXYGEN
@ -433,7 +433,7 @@ public:
*/
T const* const operator->() const {
if(typed_copy_) return &typed_copy_->old();
return 0;
return static_cast<T const*>(0); // Explicit cast avoids warning.
}
#ifndef BOOST_CONTRACT_DETAIL_DOXYGEN
@ -497,7 +497,11 @@ public:
*/
template<typename T>
/* implicit */ old_value(
T const& old,
T const&
#ifndef BOOST_CONTRACT_NO_OLDS // Avoid unused param warning.
old
#endif
,
typename boost::enable_if<boost::contract::is_old_value_copyable<T>
>::type* = 0
)

View File

@ -82,9 +82,7 @@ main file.
<test name="public_function-throwing_post"/>
<test name="public_function-virtual"/>
<test name="public_function-virtual_branch"/>
<toolset name="clang-linux-*~gnu++11"/>
<toolset name="clang-linux-*~gnu++14"/>
<toolset name="clang-linux-*~gnu++1z"/>
<toolset name="clang-linux-*~gnu++*"/>
<note author="Lorenzo Caminiti">
This test fails because of a libcxxrt bug on Clang for FreeBSD
which causes `std::uncaught_exception` to not work properly on
@ -96,8 +94,6 @@ main file.
<test name="old-if_copyable_macro"/>
<toolset name="gcc-4.6*"/>
<toolset name="gcc-4.7*"/>
<toolset name="msvc-10.0"/>
<toolset name="msvc-11.0"/>
<note author="Lorenzo Caminiti">
This test fails because this complier does not properly
implement SFINAE giving incorrect errors on substitution
@ -167,49 +163,6 @@ main file.
online).
</note>
</mark-expected-failures>
<mark-expected-failures>
<test name="call_if-no_equal_call_if"/>
<toolset name="msvc-10.0"/>
<note author="Lorenzo Caminiti">
This test fails because MSVC 10.0 is not able to properly deduce
a template specialization.
This is fixed in MSVC 11.0.
</note>
</mark-expected-failures>
<mark-expected-failures>
<test name="constructor-ifdef_macro"/>
<test name="constructor-smoke"/>
<toolset name="msvc-10.0"/>
<note author="Lorenzo Caminiti">
This test fails because of a MSVC 10.0 bug with lambdas within
template class initialization list.
This can be worked around using a functor bind instead of a
lambda, but it is fixed in MSVC 11.0.
</note>
</mark-expected-failures>
<mark-expected-failures>
<test name="destructor-smoke"/>
<toolset name="msvc-10.0"/>
<note author="Lorenzo Caminiti">
This test fails because of a MSVC 10.0 bug for which lambdas
cannot access typedefs declared within classes.
This can be worked around declaring typedefs outside of
classes, but it is fixed in MSVC 11.0.
</note>
</mark-expected-failures>
<mark-expected-failures>
<test name="disable-no_post_except_lib"/>
<test name="disable-no_post_except_unit"/>
<test name="disable-nothing_for_pre_prog"/>
<test name="disable-other_assertions_lib"/>
<test name="disable-other_assertions_prog"/>
<test name="disable-other_assertions_unit"/>
<toolset name="msvc-10.0"/>
<note author="Lorenzo Caminiti">
This test fails because of an internal MSVC 10.0 compiler bug.
This is fixed in MSVC 11.0.
</note>
</mark-expected-failures>
<mark-expected-failures>
<test name="invariant-ifdef"/>
<test name="invariant-ifdef_macro"/>

View File

@ -24,5 +24,5 @@ int main() {
a aa;
aa.f();
return 0;
};
}

View File

@ -24,5 +24,5 @@ int main() {
a aa;
aa.f();
return 0;
};
}

View File

@ -24,5 +24,5 @@ int main() {
a aa;
aa.f();
return 0;
};
}

View File

@ -24,5 +24,5 @@ int main() {
a aa;
aa.f();
return 0;
};
}

View File

@ -24,5 +24,5 @@ int main() {
a aa;
aa.f();
return 0;
};
}

View File

@ -24,5 +24,5 @@ int main() {
a aa;
aa.f();
return 0;
};
}

View File

@ -24,5 +24,5 @@ int main() {
a aa;
aa.f();
return 0;
};
}

View File

@ -56,7 +56,7 @@ void b::swap(i_type& i, j_type& j, boost::contract::virtual_* v) {
})
;
assert(false);
};
}
struct a
#define BASES public b

View File

@ -88,7 +88,7 @@ int main() {
a aa;
out.str("");
aa.f(123);
ok.str(); ok
ok.str(""); ok
#ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS
<< "b::static_inv" << std::endl
<< "b::inv" << std::endl

View File

@ -137,7 +137,7 @@ int main() {
a aa;
out.str("");
aa.f(123);
ok.str(); ok
ok.str(""); ok
#ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS
<< "b::static_inv" << std::endl
<< "b::inv" << std::endl

View File

@ -206,7 +206,7 @@ struct a
#pragma GCC diagnostic ignored "-Woverloaded-virtual" // For a::f.
#elif defined(BOOST_CLANG)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter" // For a::f.
#pragma clang diagnostic ignored "-Woverloaded-virtual" // For a::f.
#endif
// Must use virtual_ even if no longer decl virtual for correct overloading.

View File

@ -81,7 +81,7 @@ struct a // Test overrides with mixed access levels from base.
;
out << "a::f::body" << std::endl;
}
BOOST_CONTRACT_OVERRIDES(f);
BOOST_CONTRACT_OVERRIDES(f)
// Following do not override public members so no `override_...` param and
// they do not actually subcontract.

View File

@ -148,7 +148,7 @@ struct a // Test overrides with mixed access levels from different bases.
out << "a::h::body" << std::endl;
}
BOOST_CONTRACT_OVERRIDES(f, g, h);
BOOST_CONTRACT_OVERRIDES(f, g, h)
};
int main() {