Merge pull request #77 from BartSiwek/fix_zero_as_null_pointer_constant

Fix GCC zero-as-null-pointer-constat warnings
This commit is contained in:
Antony Polukhin 2020-04-03 13:35:51 +03:00 committed by GitHub
commit 1ba33a580e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 78 additions and 53 deletions

View File

@ -261,13 +261,13 @@ public: // structors
public: // visitor interfaces
template <typename Value2>
decltype(auto) operator()(Value2&& value2, typename enable_if_c<MoveSemantics && is_same<Value2, Value2>::value>::type* = 0)
decltype(auto) operator()(Value2&& value2, typename enable_if_c<MoveSemantics && is_same<Value2, Value2>::value, bool>::type = true)
{
return visitor_(::boost::move(value1_), ::boost::forward<Value2>(value2));
}
template <typename Value2>
decltype(auto) operator()(Value2&& value2, typename disable_if_c<MoveSemantics && is_same<Value2, Value2>::value>::type* = 0)
decltype(auto) operator()(Value2&& value2, typename disable_if_c<MoveSemantics && is_same<Value2, Value2>::value, bool>::type = true)
{
return visitor_(value1_, ::boost::forward<Value2>(value2));
}
@ -293,7 +293,7 @@ public: // structors
public: // visitor interfaces
template <typename Value1>
decltype(auto) operator()(Value1&& value1, typename enable_if_c<MoveSemantics && is_same<Value1, Value1>::value>::type* = 0)
decltype(auto) operator()(Value1&& value1, typename enable_if_c<MoveSemantics && is_same<Value1, Value1>::value, bool>::type = true)
{
apply_visitor_binary_invoke_cpp14<
Visitor
@ -305,7 +305,7 @@ public: // visitor interfaces
}
template <typename Value1>
decltype(auto) operator()(Value1&& value1, typename disable_if_c<MoveSemantics && is_same<Value1, Value1>::value>::type* = 0)
decltype(auto) operator()(Value1&& value1, typename disable_if_c<MoveSemantics && is_same<Value1, Value1>::value, bool>::type = true)
{
apply_visitor_binary_invoke_cpp14<
Visitor
@ -325,8 +325,9 @@ private:
template <typename Visitor, typename Visitable1, typename Visitable2>
inline decltype(auto) apply_visitor(Visitor& visitor, Visitable1&& visitable1, Visitable2&& visitable2,
typename boost::disable_if<
boost::detail::variant::has_result_type<Visitor>
>::type* = 0)
boost::detail::variant::has_result_type<Visitor>,
bool
>::type = true)
{
::boost::detail::variant::apply_visitor_binary_unwrap_cpp14<
Visitor, Visitable2, ! ::boost::is_lvalue_reference<Visitable2>::value
@ -338,8 +339,9 @@ inline decltype(auto) apply_visitor(Visitor& visitor, Visitable1&& visitable1, V
template <typename Visitor, typename Visitable1, typename Visitable2>
inline decltype(auto) apply_visitor(const Visitor& visitor, Visitable1&& visitable1, Visitable2&& visitable2,
typename boost::disable_if<
boost::detail::variant::has_result_type<Visitor>
>::type* = 0)
boost::detail::variant::has_result_type<Visitor>,
bool
>::type = true)
{
::boost::detail::variant::apply_visitor_binary_unwrap_cpp14<
const Visitor, Visitable2, ! ::boost::is_lvalue_reference<Visitable2>::value

View File

@ -130,8 +130,9 @@ struct result_wrapper1
template <typename Visitor, typename Visitable>
inline decltype(auto) apply_visitor(Visitor&& visitor, Visitable&& visitable,
typename boost::disable_if<
boost::detail::variant::has_result_type<Visitor>
>::type* = 0)
boost::detail::variant::has_result_type<Visitor>,
bool
>::type = true)
{
boost::detail::variant::result_wrapper1<Visitor, Visitable> cpp14_vis(::boost::forward<Visitor>(visitor));
return ::boost::forward<Visitable>(visitable).apply_visitor(cpp14_vis);

View File

@ -106,8 +106,9 @@ namespace detail { namespace variant {
template <class Visitor, class T1, class T2, class T3, class... TN>
inline decltype(auto) apply_visitor(const Visitor& visitor, T1&& v1, T2&& v2, T3&& v3, TN&&... vn,
typename boost::disable_if<
boost::detail::variant::has_result_type<Visitor>
>::type* = 0)
boost::detail::variant::has_result_type<Visitor>,
bool
>::type = true)
{
return boost::apply_visitor(
::boost::detail::variant::make_one_by_one_visitor_and_value_referer_cpp14(
@ -127,8 +128,9 @@ namespace detail { namespace variant {
template <class Visitor, class T1, class T2, class T3, class... TN>
inline decltype(auto) apply_visitor(Visitor& visitor, T1&& v1, T2&& v2, T3&& v3, TN&&... vn,
typename boost::disable_if<
boost::detail::variant::has_result_type<Visitor>
>::type* = 0)
boost::detail::variant::has_result_type<Visitor>,
bool
>::type = true)
{
return ::boost::apply_visitor(
::boost::detail::variant::make_one_by_one_visitor_and_value_referer_cpp14(

View File

@ -58,6 +58,13 @@
#endif
// Define a compiler generic null pointer value
#if defined(BOOST_NO_NULLPTR)
#define BOOST_VARIANT_NULL 0
#else
#define BOOST_VARIANT_NULL nullptr
#endif
namespace boost {
namespace detail { namespace variant {
@ -177,7 +184,7 @@ inline typename Visitor::result_type
visitation_impl(
int, int, Visitor&, VPCV
, mpl::true_ // is_apply_visitor_unrolled
, NBF, W* = 0, S* = 0
, NBF, W* = BOOST_VARIANT_NULL, S* = BOOST_VARIANT_NULL
)
{
// should never be here at runtime!
@ -196,7 +203,7 @@ visitation_impl(
, Visitor& visitor, VoidPtrCV storage
, mpl::false_ // is_apply_visitor_unrolled
, NoBackupFlag no_backup_flag
, Which* = 0, step0* = 0
, Which* = BOOST_VARIANT_NULL, step0* = BOOST_VARIANT_NULL
)
{
// Typedef apply_visitor_unrolled steps and associated types...

View File

@ -102,8 +102,13 @@ public: // visitor interfaces
# if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0551))
# define BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(t)
# else
# if defined(BOOST_NO_NULLPTR)
# define BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(t) \
, t* = 0
# else
# define BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(t) \
, t* = nullptr
# endif
# endif
#endif

View File

@ -135,8 +135,13 @@ public: // visitor interfaces
# if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0551))
# define BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(t)
# else
# if defined(BOOST_NO_NULLPTR)
# define BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(t) \
, t* = 0
# else
# define BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(t) \
, t* = nullptr
# endif
# endif
#endif

View File

@ -1714,7 +1714,8 @@ public: // structors, cont.
mpl::not_< boost::is_same<T, variant> >,
boost::detail::variant::is_variant_constructible_from<const T&, internal_types>
>,
boost::is_same<T, boost::recursive_variant_> > >::type* = 0)
boost::is_same<T, boost::recursive_variant_> >,
bool >::type = true)
{
convert_construct(operand, 1L);
}
@ -1728,7 +1729,8 @@ public: // structors, cont.
mpl::not_< boost::is_same<T, variant> >,
boost::detail::variant::is_variant_constructible_from<T&, internal_types>
>,
boost::is_same<T, boost::recursive_variant_> > >::type* = 0
boost::is_same<T, boost::recursive_variant_> >,
bool >::type = true
)
{
convert_construct(operand, 1L);
@ -1744,7 +1746,8 @@ public: // structors, cont.
mpl::not_< boost::is_same<T, variant> >,
boost::detail::variant::is_variant_constructible_from<T&&, internal_types>
>,
boost::is_same<T, boost::recursive_variant_> > >::type* = 0)
boost::is_same<T, boost::recursive_variant_> >,
bool >::type = true)
{
convert_construct( detail::variant::move(operand), 1L);
}

View File

@ -79,7 +79,7 @@ struct rvalue_ref_decltype_visitor
#endif
template <typename Checker, typename Variant>
inline void unary_test(Variant& var, Checker* = 0)
inline void unary_test(Variant& var, Checker* = BOOST_VARIANT_NULL)
{
Checker checker;
const Checker& const_checker = checker;
@ -97,7 +97,7 @@ inline void unary_test(Variant& var, Checker* = 0)
}
template <typename Checker, typename Variant1, typename Variant2>
inline void binary_test(Variant1& var1, Variant2& var2, Checker* = 0)
inline void binary_test(Variant1& var1, Variant2& var2, Checker* = BOOST_VARIANT_NULL)
{
Checker checker;
const Checker& const_checker = checker;