Opened 12 years ago

Closed 12 years ago

#5112 closed Patches (fixed)

[config][intel] Patch to detect C++0x features under Intel C++ compiler

Reported by: spillner@… Owned by: John Maddock
Milestone: To Be Determined Component: config
Version: Boost Development Trunk Severity: Not Applicable
Keywords: Cc:

Description

The attached patch attempts to add correct detection of C++0x features when enabled with -std=c++0x. I tested this against libs/config/tests/* using ICC 11.0.084, 11.1.073, and 12.0.0 under Linux; I also verified that ICC's static_assert (ICC 11 & 12), rvalue reference (ICC 12), and decltype (ICC 12 only) support appear to work reliably in my own applications.

Since I have neither a Windows machine nor a Windows license for ICC I wrote the BOOST_INTEL_WIN case based solely on the description at http://software.intel.com/en-us/forums/showthread.php?t=64287 ; can anyone verify that this does indeed work for ICC 11 and/or 12 under Windows?

Attachments (1)

intel-c++0x-v1.patch (1.8 KB ) - added by spillner@… 12 years ago.
Patches boost/config/compiler/intel.hpp to detect C++0x features when the -std=c++0x switch is passed to icpc

Download all attachments as: .zip

Change History (6)

by spillner@…, 12 years ago

Attachment: intel-c++0x-v1.patch added

Patches boost/config/compiler/intel.hpp to detect C++0x features when the -std=c++0x switch is passed to icpc

comment:1 by anonymous, 12 years ago

This seems to work OK on Linux - I'm a little wary of using STDC_HOSTED for this as conceptually it could/should be set for C99 conforming mode as well (but appears not to be).

On Win32, I'm a little concerned because their are other ways of disabling MSVC extensions besides -std=c++0x. Traditionally the Intel and MSVC compilers haven't really been usable without MSVC extensions anyway... although I don't know if this is still the case.

For now just applying the Linux patches...

comment:2 by John Maddock, 12 years ago

(In [68420]) Add preliminary C++0x support. Refs #5112.

comment:3 by anonymous, 12 years ago

I wonder did you test any of the other C++0x features? Intel 11.1 appears not to require:

# undef BOOST_NO_LAMBDAS # undef BOOST_NO_DECLTYPE # undef BOOST_NO_AUTO_DECLARATIONS # undef BOOST_NO_AUTO_MULTIDECLARATIONS

and Intel 12.0 appears not to need:

# undef BOOST_NO_SCOPED_ENUMS # undef BOOST_NO_DELETED_FUNCTIONS # undef BOOST_NO_DEFAULTED_FUNCTIONS

All in C++0x mode of course.

Thanks, John.

comment:4 by spillner@…, 12 years ago

I know that there's some decltype support in 11.1, but I received number of compilation warnings (specifically on things like

template < class T > struct Z {

T dummy; typedef decltype(dummy.get()) retval;

};

) that went away when shifting to ICC 12 or GCC, so I enabled that only in 12 and up. This seems consistent with http://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler/ , which is more conservative than e.g. http://wiki.apache.org/stdcxx/C%2B%2B0xCompilerSupport .

I didn't have a mature use case for the other features, so I confined my attention to the three in the patch. They're also all supported by GCC, which gave me greater confidence in testing. Bottom line, I don't have any reason to believe that the features you named don't work well, I just haven't proven that they do.

comment:5 by John Maddock, 12 years ago

Resolution: fixed
Status: newclosed

(In [68472]) Fix up Intel C++0x features. Fixes #5112.

Note: See TracTickets for help on using tickets.