Re: [eigen] Dynamic exception specifications are deprecated in C++11 mode and other warnings |
[ Thread Index | Date Index | More lists.tuxfamily.org/eigen 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: https://www.gnu.org/software/autoconf-archive/ax_gcc_func_attribute.html#ax_gcc_func_attribute In your `configure.ac`, add AX_GCC_FUNC_ATTRIBUTE(noreturn) and in your source code #include <config.h> #if HAVE_FUNC_ATTRIBUTE_NORETURN # define MY_NORETURN __attribute__((noreturn)) #else # define MY_NORETURN /* empty */ #endif > 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 #else // using pre-C++11 #endif 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: https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html#ax_cxx_compile_stdcxx_11 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. Moritz -- OpenPGP: Public Key: http://openpgp.klammler.eu Fingerprint: 2732 DA32 C8D0 EEEC A081 BE9D CF6C 5166 F393 A9C0
Attachment:
pgp7kwNXVa0k4.pgp
Description: PGP signature
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |