|
Boost : |
Subject: Re: [boost] TMP error messages [ was Re: New libraries implementing C++11 features in C++03 ]
From: Maxim Yanchenko (MaximYanchenko_at_[hidden])
Date: 2011-11-24 21:04:14
Joel de Guzman <joel <at> boost-consulting.com> writes:
> Now. What else can we do about it? Here's an idea. I'd like to
> hear yours.
>
> It might be good to present that in a GUI where the types are
> collapsed by default. Qualifications in a trace can also be
> optionally collapsed.
Hi Joel, it's a very correct idea. In our team, I made a perl script that cleans
out all compiler noise (GCC) and has some special handling for common cases like
MPL_ASSERT, CONCEPT_CHECK etc.
This runs for years already and proven to be extremely effective in nailing down
errors.
Here is a couple of examples:
*BOOST_MPL_ASSERT_RELATION:
test.h:75: error: ************::assert_relation<2l == 3l>::************)'
Original error message:
test.h:75: error: no matching function for call to
'assertion_failed(mpl_::failed************
mpl_::assert_relation<(mpl_::assert_::relations)1u, 2l, 3l>::************)'
* Concept checks:
test.cpp:29: error: CONCEPT NOT SATISFIED: RandomAccessIterator<A>
test.cpp:28: error: CONCEPT CHECK FAILED:
RandomAccessIterator<list<int>::iterator >
these come from 17 lines of long error msgs that I don't want to put here for
their length, but you can easily imagine how they look like.
* BOOST_MPL_ASSERT_MSG:
test.cpp:311: error:
************::TAG_IS_NOT_IN_TAG_LIST::************(MTag<815, CharRange>,
mpl::vector<MetaTag::OrderQty, MetaTag::Price>)
this comes from this original line:
test.cpp:311: error: no matching function for call to
`assertion_failed(mpl_::failed************(ns::oc::<unnamed>::FlagChecker<Tags,
RequiredTags>::operator()(const Tag&) const [with Tag = ns::MTag<815,
ns::CharRange>, Tags = MyClass::update_from_msg(const ns::SharedMsg&)::fields,
RequiredTags = MyClass::update_from_msg(const
ns::SharedMsg&)::r_fields]::TAG_IS_NOT_IN_TAG_LIST::************)(ns::MTag<815,
ns::CharRange>, boost::mpl::vector<ns::MetaTag::OrderQty, ns::MetaTag::Price,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na>))'
here my script also unfolds "where" part and gets rid of repetitive mpl_::na
nonsense.
As you can see these filters really help to emphasize what was the problem,
without exposing too much guts.
This script is being run in makefile transparent to user, and is controlled by
environment variables, so if you want to get deeper (in case the error filter
swallowed too much) you just adjust environment variables and rerun make.
Regards,
Maxim
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk