Skip to content
Snippets Groups Projects
Commit a3947bae authored by Steffen Müthing's avatar Steffen Müthing
Browse files

Merge branch 'feature/no-deprecated-blocks' into 'master'

Add `DUNE_NO_DEPRECATED_BEGIN` and `DUNE_NO_DEPRECATED_END` macros

These macros can be used to mark a block in which deprecation warnings
are ignored.  This can be useful for implementations of deprecated
methods that call other deprecated methods or for testing deprecated
methods in the testsuite.

See also the discussion in dune-grid!61

See merge request !99
parents e7b5168a f1826045
No related branches found
No related tags found
1 merge request!99Add `DUNE_NO_DEPRECATED_BEGIN` and `DUNE_NO_DEPRECATED_END` macros
......@@ -171,6 +171,53 @@
#define DUNE_DEPRECATED_MSG(text) __attribute__((deprecated(# text)))
#endif
#ifdef DOXYGEN
/**
* \brief Ignore deprecation warnings (start)
*
* This macro can be used together with `DUNE_NO_DEPRECATED_END` to mark a
* block in which deprecation warnings are ignored. This can be useful for
* implementations of deprecated methods that call other deprecated methods
* or for testing deprecated methods in the testsuite.
*
* \code
DUNE_NO_DEPRECATED_BEGIN
some_deprecated_function();
another_deprecated_function();
DUNE_NO_DEPRECATED_END
* \endcode
*
* \warning This macro must always be used together with `DUNE_NO_DEPRECATED_END`
*/
#define DUNE_NO_DEPRECATED_BEGIN ...
/**
* \brief Ignore deprecation warnings (end)
*
* \warning This macro must always be used together with `DUNE_NO_DEPRECATED_BEGIN`
*/
#define DUNE_NO_DEPRECATED_END ...
#else
# if defined __clang__
# define DUNE_NO_DEPRECATED_BEGIN \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
# define DUNE_NO_DEPRECATED_END _Pragma("clang diagnostic pop")
# elif defined __INTEL_COMPILER
# define DUNE_NO_DEPRECATED_BEGIN \
_Pragma("warning push") \
_Pragma("warning(disable:1478)")
# define DUNE_NO_DEPRECATED_END _Pragma("warning pop")
# elif defined __GNUC__
# define DUNE_NO_DEPRECATED_BEGIN \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
# define DUNE_NO_DEPRECATED_END _Pragma("GCC diagnostic pop")
# else
# define DUNE_NO_DEPRECATED_BEGIN /* Noop. */
# define DUNE_NO_DEPRECATED_END /* Noop. */
# endif
#endif
//! @}
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment