[Xapian-discuss] C++11

Olly Betts olly at survex.com
Wed May 6 03:08:54 BST 2015


On Thu, Jun 05, 2014 at 06:51:00AM +0100, Olly Betts wrote:
> I think we should seriously consider requiring a compiler with C++11
> support for the next Xapian stable release series (i.e. Xapian 1.4.x).

This suggestion didn't trigger any mailing list traffic, but there was
some IRC discussion, and I've discussed it with a few people in person
too - everyone who spoke up was for the idea.

So in git master, configure now checks that the compiler has C++11
support (trying common options to enable it if necessary), and will
error out if it doesn't find one.

If you're using GCC, the minimum requirement documented is currently 
GCC 4.4 - I haven't tested this, but it is the oldest version which has
any chance of working from looking at the C++11 support tables.
Depending what C++11 features we want, we may well need to raise this.

I've done some clean-up work removing checks and special cases which
are no longer useful - special handling for the following platforms and
toolchains is gone:

* OS/2 using EMX (EMX was last updated in 2001 and has GCC 3.2.1)
* IRIX (last released 2006, end of life was 2013)
* SGI compiler (seems to have died with IRIX)
* Compaq compiler (Compaq acquired by HP, who favoured their own compiler)
* STLport (last released 2008, no C++11 support)

I've tested with GCC and clang so far.

I've not tested with the compilers from HP, IBM, Microsoft or Sun,
which have all successfully built Xapian at some point in the past,
and which all seem to have C++11 support.

If you have access to these compilers (or any other compilers with
C++11 support), please test build from git master (or the snapshot
tarballs) and report if it works or not.

When building code which uses Xapian, it's easier for users if we
don't force them to turn on C++11 mode in the compiler, and at least
so far it seems easy to keep the API headers working with both C++11
and older C++, so I suggest we aim to do that for 1.4.x.

> * We need to decide on a set of C++11 features which we can assume.
>   I know people will be using GCC, clang, and MSVC.  What other
>   compilers are people using, and can you point to some documentation
>   of their level of C++11 support?

I've not attempted to define a subset of allowed features - I suggest we
simple document anything we find to be problematic as we go.

We want to backport bug fixes to 1.2.x still, so it would be unhelpful
to launch into refactoring everything to make use of C++11, and we should
avoid relying on C++11 features in bug fixes.  It's likely to work
against actually getting 1.4.0 released too, by absorbing developer time
and risking introducing bugs.

New code which isn't a candidate for backporting can certainly use C++11
features which are widely supported.

Cheers,
    Olly



More information about the Xapian-discuss mailing list