Make C++0x/C++11 mode of gcc/clang mandatory

RESOLVED FIXED in mozilla25

Status

defect
RESOLVED FIXED
6 years ago
Last year

People

(Reporter: glandium, Assigned: glandium)

Tracking

Trunk
mozilla25
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

No description provided.
Comment on attachment 776214 [details] [diff] [review]
Make C++0x/C++11 mode of gcc/clang mandatory

Review of attachment 776214 [details] [diff] [review]:
-----------------------------------------------------------------

We're probably going to need something to catch other compilers that don't properly support C++0x features we want to use, aren't we?
Attachment #776214 - Flags: review?(ted) → review+
(In reply to Ted Mielczarek [:ted.mielczarek] from comment #2)
> We're probably going to need something to catch other compilers that don't
> properly support C++0x features we want to use, aren't we?

You mean sun studio and others?
NOTE: I have a set of C++11 autoconf checks available at https://github.com/rhdunn/cainteoir-engine/blob/master/m4/cxx11.m4:

CXX11_CHECK_CXX11_SUPPORT -- checks what flags (if any) are needed for C++11 (double right-angle bracket support only)

CXX11_NULLPTR -- requires C++11 nullptr support
CXX11_DECLTYPE -- requires C++11 decltype support
CXX11_AUTO -- requires C++11 auto support
CXX11_RANGE_BASED_FOR -- requires C++11 range-based for support
CXX11_BRACE_INITIALIZATION -- requires C++11 brace initialization support (with a check for clang bug 12670)
CXX11_SCOPED_ENUMS -- requires C++11 scoped enums (i.e. 'enum class') support
CXX11_CONSTEXPR -- requires C++11 constexpr support
CXX11_LAMBDA -- requires basic C++11 lambda support
CXX11_LAMBDA_CAPTURE -- requires C++11 lambda capture syntax support

CXX11_HAVE_STD_INITIALIZER_LIST -- set HAVE_CXX11_STD_INITIALIZER_LIST if std::initializer_list is supported
CXX11_REQUIRE_STD_INITIALIZER_LIST -- error if std::initializer_list is not supported

CXX11_HAVE_STD_SHARED_PTR -- set HAVE_CXX11_STD_SHARED_PTR if std::shared_ptr is supported
CXX11_REQUIRE_STD_SHARED_PTR -- error if std::shared_ptr is not supported

CXX11_HAVE_STD_BEGIN -- set HAVE_CXX11_STD_BEGIN if std::begin is supported
CXX11_REQUIRE_STD_BEGIN -- error if std::begin is not supported

CXX11_HAVE_STD_END -- set HAVE_CXX11_STD_END if std::end is supported
CXX11_REQUIRE_STD_END -- error if std::end is not supported

I can move this out to a separate project on GitHub and add more C++11 (and C++1y features -- like std::make_unique) as needed. I can also support HAVE vs REQUIRE macros for the language features, if needed.
(In reply to Mike Hommey [:glandium] from comment #3)
> (In reply to Ted Mielczarek [:ted.mielczarek] from comment #2)
> > We're probably going to need something to catch other compilers that don't
> > properly support C++0x features we want to use, aren't we?
> 
> You mean sun studio and others?

Yes. AFAIK we haven't unsupported building with non-GCC/clang, but I'm fine with requiring C++11 features even if that means unsupporting them as a side effect.
(In reply to Reece H. Dunn from comment #4)
> NOTE: I have a set of C++11 autoconf checks available at
> https://github.com/rhdunn/cainteoir-engine/blob/master/m4/cxx11.m4:

Testing implementation bugs might be a good thing, but testing the features we're going to use (we're not going to conditionally use them), besides the fact that it will make the build error out at configure time instead of build time, I'm not sure it's worth bothering.
(In reply to Mike Hommey [:glandium] from comment #6)
> (In reply to Reece H. Dunn from comment #4)
> > NOTE: I have a set of C++11 autoconf checks available at
> > https://github.com/rhdunn/cainteoir-engine/blob/master/m4/cxx11.m4:
> 
> Testing implementation bugs might be a good thing, but testing the features
> we're going to use (we're not going to conditionally use them), besides the
> fact that it will make the build error out at configure time instead of
> build time, I'm not sure it's worth bothering.

If we can error for clean, obvious reasons in the build early on, then a configure check strikes me as superfluous. I'm biased towards trying to do as little in configure as possible.
Depends on: 770625
Blocks: 895322
Depends on: 895582
https://hg.mozilla.org/mozilla-central/rev/1d17f497c474
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.