|Re: [eigen] Dynamic exception specifications are deprecated in C++11 mode and other warnings|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Dynamic exception specifications are deprecated in C++11 mode and other warnings
- From: Nicola Gigante <nicola.gigante@xxxxxxxxx>
- Date: Sat, 23 Aug 2014 15:28:02 +0200
- Cc: Nicola Gigante <nicola.gigante@xxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=VQEK+2KkxibrsPhfvp1f0Wo0oR+8tY2+qUZCpNbNPIM=; b=ZMdQj2+1lnP3AVXiLqyyEe5nmxuuNO9jGsU29+KCe02JIl3VP3VznOUP/rkTSuvCr8 b0BVBTBJabOlLS8C/9Ag0ExOOlt/QhNeLGm8hAFdVzBV+XjzbcBa8RT6vkpZU0g9/SEX 3n23t578AfUbIdV52Ghe7Ll/FWch22+56cyspXbr6gw2YCxQC14llQtgO3PyDeddJxSn lOG8YDGaxzwKBeb6TGqKIRjkrl3OPXfQn9fS70OUhhTVdIHy0rorM6vrhGosWn7xaR7G O/oB9TpUP4kdymP91qLY3krHCk+CygYu37jiQNZvbFhe9gu3Swl/57SH5vI0kTvrsJqB r19Q==
Il giorno 23/ago/2014, alle ore 14:16, Moritz Klammler <moritz@xxxxxxxxxxx> ha scritto:
>> 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 `configure.ac`, add
> and in your source code
> #include <config.h>
> #if HAVE_FUNC_ATTRIBUTE_NORETURN
> # define MY_NORETURN __attribute__((noreturn))
> # define MY_NORETURN /* empty */
These are warnings from Eigen sources, so I'd like to add the check to Eigen, not
to my sources. What I would like to do is to patch Eigen to silence that warning
by adding the attribute to the throw_std_bad_alloc() function.
Since Eigen is header-only I have to find a way to check the availability of the
attribute without external configuration tools. I think testing for __GNUC__ is
sufficient as any gnu-compatible compiler has that syntax for attributes, and
I don't think eigen supports gcc versions that don't provide the noreturn attribute.
Do you know which is the corresponding syntax for MSVC, if any?
>> 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.
The last time I've looked, I've seen some move constructor conditionally
declared in C++11 mode, but now I can't find them. How do you support
move semantics in C++11 mode without testing the language version?
> 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.
Nice, but again, I'm not talking about external configuration tools here...
If you need per-feature availability macros in Eigen to support more C++11
constructs, you need to enable them based on the compiler version, I think.
So, in the end, I'll try to patch Eigen to silence those warnings and I'll
send you patches, only then you'll be able to tell me if they can be included or not.