C++11
Stephan Bergmann
sbergman at redhat.com
Mon Sep 15 00:45:06 PDT 2014
As discussed previously (ESC meeting minutes
<http://lists.freedesktop.org/archives/libreoffice/2014-May/061146.html>
and
<http://lists.freedesktop.org/archives/libreoffice/2014-May/061294.html>),
we intended to start using at least some C++11 features unconditionally
on master towards LO 4.4.
That implies new minimum requirements for the various toolchains, and we
piggybacked on the research done by the LLVM team on this and settled on
Clang 3.1
GCC 4.7
MSVC 2012
intended to offer a good subset of C++11, bringing both core and library
improvements.
For the "official" TDF Linux baseline builds (CentOS 5, GCC 4.1) this
requires building against the <http://people.centos.org/tru/devtools-2/>
toolchain (GCC 4.8). Christian already took care of that.
For Mac OS X, this is achieved by abandoning the deprecated 32-bit
builds requiring OS X 10.6 at a minimum (as announced at
<https://wiki.documentfoundation.org/ReleaseNotes/4.3#Mac>) and only
supporting 64-bit builds requiring OS X 10.8. (For C++11, it would
suffice to require only 10.7, but there were other reasons that made us
pick 10.8 as the minimum requirement for the 64-bit builds.)
Technically, our configure.ac currently still allows some GCC < 4.7, and
some tinderboxes still make use of that (esp. the logerrit buildbot
Linux machines), but I urge all tinderbox owners to upgrade to the above
minimum compiler versions as soon as possible. (I disabled Markus'
Linux-with-check at 50 tinderbox until he is back from vacation, it is
based on an old SUSE release with a too-old GCC rejected by configure.ac
now.)
Two commits went into master over the last few days,
<http://cgit.freedesktop.org/libreoffice/core/commit/?id=fcf015832466f4d902e8aeb1466309a1bc230475>
"(Rudimentary) C++11 support is a hard requirement now" to require a
compiler supporting C++11 (at least to some degree) in configure.ac, and
<http://cgit.freedesktop.org/libreoffice/core/commit/?id=ea733ab5b632109d28bb8f1dc37116340b26229b>
"Turn SfxItemState into a C++11 scoped enumeration" as a test balloon to
actually unconditionally use a C++11 feature (scoped enumerations) in
the code. Both of them pass the logerrit buildbots and the tinderboxes.
But, unfortunately, the minimum compiler versions still do not support
the full C++11 Standard.
<http://wiki.apache.org/stdcxx/C++0xCompilerSupport> gives a somewhat
useful overview of what features (concentrating on core language, not
standard library, though) are available in which compiler release (for
MSVC, 11.0 means 2012), but at least the claim made there that MSVC 2012
supports variadic templates appears to be false.
So, when intending to use a new C++11 feature in our code base, check
first whether it is actually supported by the various toolchains (by
e.g. running it past the logerrit buildbots), and be prepared to fix up
any tinderbox breakage it might cause.
And check out Scott Meyers' helpful "Effective Modern C++,"
<http://shop.oreilly.com/product/0636920033707.do>, if only to make you
realize that C++ is still a baroque pile of gotchas.
Happy coding,
Stephan
More information about the LibreOffice
mailing list