1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 #ifndef DUNE_DEPRECATED_HH
4 #define DUNE_DEPRECATED_HH
5 
6 /** \file
7  * \brief Definition of the DUNE_DEPRECATED macro for the case that config.h
8  *      is not available
9  */
10 
11 //! @addtogroup CxxUtilities
12 //! @{
13 #if defined(DOXYGEN) || !defined(HAS_ATTRIBUTE_DEPRECATED)
14 //! Mark some entity as deprecated
15 /**
16  * \deprecated Use C++14's \code[[deprecated]]\endcode instead. It will be
17  * removed after Dune 2.8. Be aware that it must be sometimes placed at
18  * different position in the code.
19  */
20 #define DUNE_DEPRECATED
21 #else // defined(HAS_ATTRIBUTE_DEPRECATED)
22 #define DUNE_DEPRECATED __attribute__((deprecated))
23 #endif
24 
25 #if defined(DOXYGEN) || !defined(HAS_ATTRIBUTE_DEPRECATED_MSG)
26 //! Mark some entity as deprecated
27 /**
28  * \deprecated Use C++14's \code[[deprecated(msg)]]\endcode instead. It
29  * will be removed after Dune 2.8. Be aware that it must be sometimes
30  * placed at different position in the code.
31  */
32 #define DUNE_DEPRECATED_MSG(text) DUNE_DEPRECATED
33 #else // defined(HAS_ATTRIBUTE_DEPRECATED_MSG)
34 #define DUNE_DEPRECATED_MSG(text) __attribute__((deprecated(# text)))
35 #endif
36 
37 #ifdef DOXYGEN
38 /**
39  * \brief Ignore deprecation warnings (start)
40  *
41  * This macro can be used together with `DUNE_NO_DEPRECATED_END` to mark a
42  * block in which deprecation warnings are ignored.  This can be useful for
43  * implementations of deprecated methods that call other deprecated methods
44  * or for testing deprecated methods in the testsuite.
45  *
46  * \code
47      DUNE_NO_DEPRECATED_BEGIN
48      some_deprecated_function();
49      another_deprecated_function();
50      DUNE_NO_DEPRECATED_END
51  * \endcode
52  *
53  * \warning This macro must always be used together with `DUNE_NO_DEPRECATED_END`
54  */
55 #define DUNE_NO_DEPRECATED_BEGIN ...
56 /**
57  * \brief Ignore deprecation warnings (end)
58  *
59  * \warning This macro must always be used together with `DUNE_NO_DEPRECATED_BEGIN`
60  */
61 #define DUNE_NO_DEPRECATED_END   ...
62 #else
63 #  if defined __clang__
64 #    define DUNE_NO_DEPRECATED_BEGIN \
65          _Pragma("clang diagnostic push") \
66          _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
67 #    define DUNE_NO_DEPRECATED_END _Pragma("clang diagnostic pop")
68 #  elif defined __INTEL_COMPILER
69 #    define DUNE_NO_DEPRECATED_BEGIN \
70          _Pragma("warning push") \
71          _Pragma("warning(disable:1478)") \
72          _Pragma("warning(disable:1786)")
73 #    define DUNE_NO_DEPRECATED_END _Pragma("warning pop")
74 #  elif defined __GNUC__
75 #    define DUNE_NO_DEPRECATED_BEGIN \
76          _Pragma("GCC diagnostic push") \
77          _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
78 #    define DUNE_NO_DEPRECATED_END _Pragma("GCC diagnostic pop")
79 #  else
80 #    define DUNE_NO_DEPRECATED_BEGIN /* Noop. */
81 #    define DUNE_NO_DEPRECATED_END   /* Noop. */
82 #  endif
83 #endif
84 
85 //! @}
86 
87 #endif
88