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

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Good morning.

I've imported Eigen 3.2.2 in a project where the policy is to have everything compile
without warning with the clang flag -Weverything, and I ran in a couple of issues
with Eigen headers.

We're compiling in C++11 mode.

The first is that -Wdocumentation and Wdocumentation-unkown-command trigger
basically everywhere, complaining about a lot of unknown commands or missing
arguments.
I'm not an expert of Doxygen, and I don't know if clang is correct or not, but it would
be nice if someone that knows how Eigen doc is structured to have a look, so I would
know if I have to file a bug to clang. This is not a big problem however, we can live 
without -Wdocumentation.

The second triggers on the throw_std_bad_alloc() function in Memory.h.
The compiler triggers -Wmissing-noreturn, which suggests that the function
could be declared with the [[noreturn]] attribute, because it only throws an
exception (when exceptions are enabled, of course).

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?

The third issue trigger on the 
EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF and similar macros.
They declare operators with the throw() dynamic exception specification, which
is deprecated in C++11 and with much probability will become ill-formed in C++17.
Even in C++98 it's not a brilliant idea anyway, for performance reasons.
I would like to add a macro such as EIGEN_NOTHROW that would expand
to throw() or noexcept() depending on the language version (that's how a lot
of other libraries deal with the issue).
How do you test for C++11 mode in eigen sources? Is there a feature test macro,
or should I simply use __cplusplus?


Globally, would you accept patches for those issues?

Thanks,
Nicola


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/