Re: [eigen] Dynamic exception specifications are deprecated in C++11 mode and other warnings

[ Thread Index | Date Index | More Archives ]

> I would like to add the attribute to the function.  Note that
> [[noreturn]] is a C++11 attribute syntax, but on clang and g++ (and
> ICC, I suppose) it is the same as __attribute__((noreturn)) which is
> supported and could be useful also in C++98 mode.
> Do you have a feature test macro in eigen for the support of the
> noreturn attribute?  If not, do you have a feature test macro for
> GNU-like compilers?

I did not understand from your message whether you are working on a
header-only library that uses Eigen as part of it or are compiling Eigen
into the source code of whatever.  In the second case, if you are using
the GNU Autotools, you can use the macro `AX_GCC_FUNC_ATTRIBUTE` from
the Autoconf macro archive:

In your ``, add


and in your source code

    #include <config.h>
    #  define MY_NORETURN __attribute__((noreturn))
    #  define MY_NORETURN /* empty */

> How do you test for C++11 mode in eigen sources?  Is there a feature
> test macro, or should I simply use __cplusplus?

I think that this is a reasonable check.

    #if __cplusplus >= 201103L
    // using C++11 or newer
    // using pre-C++11

At least, it's how GNU system headers do it.  I did a

    $ grep -r __cplusplus ~/include/Eigen

but it seems that the C++ version is not checked anywhere.

Again, if you are using Autoconf, use the `AX_CXX_COMPILE_STDCXX_11`
macro from the macro archive:

It will test what the compiler actually supports, not what it claims to
support, and will `#define HAVE_CXX11` accordingly.  As a nice extra, it
will try figure out whether you need to pass the `-std=c++11` or
whatever flag and add it to the `CXXFLAGS` variable.


Public Key:
Fingerprint:  2732 DA32 C8D0 EEEC A081  BE9D CF6C 5166 F393 A9C0

Attachment: pgp7kwNXVa0k4.pgp
Description: PGP signature

Mail converted by MHonArc 2.6.19+