#1682 Silence spurious deprecation warnings for Capabilities::isParallel specializations
Metadata
Property | Value |
---|---|
Reported by | Steffen Müthing (steffen.muething@iwr.uni-heidelberg.de) |
Reported at | Jun 30, 2015 16:58 |
Type | Bug Report |
Version | Git (pre2.4) [cmake] |
Operating System | Unspecified / All |
Last edited by | Carsten Gräser (graeser@math.fu-berlin.de) |
Last edited at | Sep 25, 2015 14:34 |
Description
On newer compilers (GCC 5, clang 3.6), all compilations which include a grid trigger spurious deprecation warnings because the grids have to specialize the Capabilities::isParallel struct. As that capability is deprecated, the base template of the struct has a deprecated attribute, and as a specialization amounts to a use of the base template, all of those specializations trigger a deprecation warning.
I tried to find a way to suppress those warnings and stumbled over GCC's #pragma
diagnostic infrastructure. Basically, by writing the following:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
template<class Grid>
struct
#ifndef DUNE_AVOID_CAPABILITIES_IS_PARALLEL_DEPRECATION_WARNING
DUNE_DEPRECATED_MSG("Will be removed after dune-grid-2.4.")
#endif
isParallel<const Grid>
{
static const bool v = Dune::Capabilities::isParallel<Grid>::v;
};
#pragma GCC diagnostic pop
we can make the spurious warnings due to the specializations disappear. Any other use of the capability (e.g. in user code) still triggers the warning. Before preparing a full patch for all core grids I'd like to gather some feedback. Would you be fine with this fix? It could also be wrapped in a macro to make it look like this:
DUNE_BEGIN_DISABLE_DIAGNOSTIC(-Wdeprecated-declarations)
struct do_something_deprecated {};
DUNE_END_DISABLE_DIAGNOSTIC(-Wdeprecated-declarations)
That would also make it possible to call other pragmas (e.g. for ICC).