clang vs boost

Hi,

I decided to see how well clang++ currently does at compiling boost.headers on my linux box.
So I took all the files from /usr/include/boost and compiled them.
In my test it turns out that clang successfully compiled about 80% of the boost headers.

Headers successfully compiled where:

#include <boost/integer.hpp>
#include <boost/exception.hpp>
#include <boost/shared_array.hpp>
#include <boost/shared_container_iterator.hpp>
#include <boost/aligned_storage.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/any.hpp>
#include <boost/foreach.hpp>
#include <boost/multi_index_container_fwd.hpp>
#include <boost/signal.hpp>
#include <boost/multi_index_container.hpp>
#include <boost/array.hpp>
#include <boost/next_prior.hpp>
#include <boost/signals.hpp>
#include <boost/noncopyable.hpp>
#include <boost/smart_cast.hpp>
#include <boost/nondet_random.hpp>
#include <boost/smart_ptr.hpp>
#include <boost/assert.hpp>
#include <boost/functional.hpp>
#include <boost/none.hpp>
#include <boost/function_equal.hpp>
#include <boost/none_t.hpp>
#include <boost/function.hpp>
#include <boost/non_type.hpp>
#include <boost/function_output_iterator.hpp>
#include <boost/state_saver.hpp>
#include <boost/operators.hpp>
#include <boost/static_assert.hpp>
#include <boost/static_warning.hpp>
#include <boost/bind.hpp>
#include <boost/generator_iterator.hpp>
#include <boost/optional.hpp>
#include <boost/strong_typedef.hpp>
#include <boost/blank_fwd.hpp>
#include <boost/get_pointer.hpp>
#include <boost/blank.hpp>
#include <boost/call_traits.hpp>
#include <boost/cast.hpp>
#include <boost/implicit_cast.hpp>
#include <boost/pfto.hpp>
#include <boost/cerrno.hpp>
#include <boost/indirect_reference.hpp>
#include <boost/pointee.hpp>
#include <boost/throw_exception.hpp>
#include <boost/checked_delete.hpp>
#include <boost/pointer_cast.hpp>
#include <boost/timer.hpp>
#include <boost/integer_fwd.hpp>
#include <boost/pointer_to_other.hpp>
#include <boost/token_functions.hpp>
#include <boost/circular_buffer_fwd.hpp>
#include <boost/integer.hpp>
#include <boost/token_iterator.hpp>
#include <boost/integer_traits.hpp>
#include <boost/tokenizer.hpp>
#include <boost/preprocessor.hpp>
#include <boost/compressed_pair.hpp>
#include <boost/intrusive_ptr.hpp>
#include <boost/program_options.hpp>
#include <boost/type.hpp>
#include <boost/concept_archetype.hpp>
#include <boost/progress.hpp>
#include <boost/io_fwd.hpp>
#include <boost/type_traits.hpp>
#include <boost/is_placeholder.hpp>
#include <boost/config.hpp>
#include <boost/crc.hpp>
#include <boost/iterator_adaptors.hpp>
#include <boost/cregex.hpp>
#include <boost/iterator.hpp>
#include <boost/cstdint.hpp>
#include <boost/cstdlib.hpp>
#include <boost/last_value.hpp>
#include <boost/random.hpp>
#include <boost/utility.hpp>
#include <boost/current_function.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/limits.hpp>
#include <boost/range.hpp>
#include <boost/variant.hpp>
#include <boost/rational.hpp>
#include <boost/make_shared.hpp>
#include <boost/ref.hpp>
#include <boost/version.hpp>
#include <boost/visit_each.hpp>
#include <boost/math_fwd.hpp>
#include <boost/mem_fn.hpp>
#include <boost/regex.h>
#include <boost/memory_order.hpp>
#include <boost/weak_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/scoped_array.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/exception.hpp>
#include <boost/regex_fwd.hpp>

The following files failed. Sometimes with assertion failures
and somethings with error messages.

#include <boost/regex.hpp>
#include <boost/assign.hpp>
#include <boost/bimap.hpp>
#include <boost/thread.hpp>
#include <boost/spirit.hpp>
#include <boost/property_map.hpp>
#include <boost/mpi.hpp>
#include <boost/property_map_iterator.hpp>
#include <boost/unordered_map.hpp>
#include <boost/parameter.hpp>
#include <boost/concept_check.hpp>
#include <boost/format.hpp>
#include <boost/filesystem.hpp>
#include <boost/dynamic_bitset.hpp>
#include <boost/unordered_set.hpp>
#include <boost/circular_buffer.hpp>
#include <boost/date_time.hpp>
#include <boost/dynamic_property_map.hpp>
#include <boost/dynamic_bitset_fwd.hpp>
#include <boost/multi_array.hpp>
#include <boost/vector_property_map.hpp>
#include <boost/asio.hpp>
#include <boost/python.hpp>

I’ll see if I can file bugs where pertinent.

Go Clang!
Maurice

I'll see if I can file bugs where pertinent.

Go Clang!
Maurice

Awesome!

Once you find some bugs, you should probably also file a metabug that
can be used to track which bugs Boost still needs fixed in order to
parse successfully.

Thanks,
Sean

Very cool. Just for kicks, I ran the testsuite for Boost.MPL, and we're passing all but 4 tests there. Not bad!

To tackle Boost, it's worth starting with the regression tests for the lowest-level libraries and working upward. We're not going to get it all in one shot, and it's best to grow the set of libraries that works over time.

  - Doug

I’m using a Mac, so my ~/user-config.jam contains:

using darwin : 4.2.1 : clang++ ;

which basically treats Clang like GCC with a funny name. It isn’t perfect, because bjam inspects the output of

clang++ -dumpversion

and concludes that Clang is GCC 1.1 :slight_smile:

On non-darwin platforms, something like

using gcc : 4.2.1 : clang++ ;

should work.

That all assumes that clang++ is in your path; otherwise, use a full pathname.

Once we get more working, it’s probably worth teaching bjam and Boost.Config about Clang. GCC emulation will only take us so far.

Thanks Doug. I’ll try to get it running.

BTW, did you mean to send your message to the cfe-dev list as well? Others might want to use bjam with clang.

I’m afraid that I inadvertently did not send the message to the list. Sorry,

Kind regards,
Maurice

PS: I just filed another boost related bug report and I (optimistically) suspect that clang++ will be close to compiling
100% of boost when the boost-bugs I submitted get fixed up. Maybe I need to try to fix one of them :slight_smile:

PS: I just filed another boost related bug report and I (optimistically) suspect that clang++ will be close to compiling
100% of boost when the boost-bugs I submitted get fixed up.

You're far more optimistic than I am :slight_smile:

Maybe I need to try to fix one of them :slight_smile:

Go for it!

  - Doug