DeprecationMacros.h file new in Git master
Macro CORRADE_
Defines
- #define CORRADE_DEPRECATED(message)
- Deprecation mark.
- #define CORRADE_DEPRECATED_ALIAS(message)
- Alias deprecation mark.
- #define CORRADE_DEPRECATED_NAMESPACE(message)
- Namespace deprecation mark.
- #define CORRADE_DEPRECATED_ENUM(message)
- Enum deprecation mark.
- #define CORRADE_DEPRECATED_FILE(message)
- File deprecation mark.
- #define CORRADE_DEPRECATED_MACRO(macro, message)
- Macro deprecation mark.
- #define CORRADE_IGNORE_DEPRECATED_PUSH
- Begin code section with deprecation warnings ignored.
- #define CORRADE_IGNORE_DEPRECATED_POP
- End code section with deprecation warnings ignored.
Define documentation
#define CORRADE_DEPRECATED(message)
Deprecation mark.
Marked function, class or typedef will emit deprecation warning on supported compilers:
class CORRADE_DEPRECATED("use Bar instead") Foo; CORRADE_DEPRECATED("use bar() instead") void foo(); typedef CORRADE_DEPRECATED("use Fizz instead") Fizz Buzz; CORRADE_DEPRECATED("use Value instead") constexpr int Vauel = 3;
Defined as a compiler-specific annotation if compiling on GCC, Clang or MSVC, empty otherwise. May not work for template aliases, namespaces and enum values on all compilers, use CORRADE_
Note that on MSVC and GCC 9 and older this doesn't warn when using nested names of deprecated classes or typedefs, only when the type is instantiated — i.e., DeprecatedStruct a; will warn, but DeprecatedStruct::Value will not.
#define CORRADE_DEPRECATED_ALIAS(message)
Alias deprecation mark.
Marked alias will emit deprecation warning on supported compilers:
template<class T> using Foo CORRADE_DEPRECATED_ALIAS("use Bar instead") = Bar<T>;
Defined as the [[deprecated(message)]] attribute if compiling as C++14 or newer, with a compiler-specific variant if compiling as C++11 on GCC, Clang or MSVC 2017+, empty otherwise.
Note that on MSVC and GCC 9 and older this doesn't warn when using nested names of deprecated aliases, only when the type is instantiated — i.e., DeprecatedAlias a; will warn, but DeprecatedAlias::Value will not.
#define CORRADE_DEPRECATED_NAMESPACE(message)
Namespace deprecation mark.
Marked enum or enum value will emit deprecation warning on supported compilers:
namespace CORRADE_DEPRECATED_NAMESPACE("use Bar instead") Foo { using namespace Bar; }
Defined as the [[deprecated(message)]] attribute if compiling as C++17 or newer, with a compiler-specific variant if compiling as C++14 or older on GCC 10+, Clang or MSVC, empty otherwise. Note that this doesn't work on namespace aliases — i.e., marking namespace Bar = Foo; with this macro will result in a compile error.
#define CORRADE_DEPRECATED_ENUM(message)
Enum deprecation mark.
Marked enum or enum value will emit deprecation warning on supported compilers:
enum class CORRADE_DEPRECATED_ENUM("use Bar instead") Foo {}; enum class Bar { Fizz = 0, Buzz = 1, Baz CORRADE_DEPRECATED_ENUM("use Bar::Buzz instead") = 1 };
Defines as the [[deprecated(message)]] attribute if compiling as C++17 or newer, with a compiler-specific variant if compiling as C++14 or older on GCC 6+, Clang or MSVC, empty otherwise.
Note that on MSVC and GCC 9 and older this doesn't warn when using values of deprecated enums, only when the enum is instantiated — i.e., DeprecatedEnum e; will warn, but DeprecatedEnum::Value will not. Moreover, on MSVC this doesn't warn when an enum value marked as deprecated is used. MSVC 2015 supports the annotation, but ignores it for both enums and enum values.
#define CORRADE_DEPRECATED_FILE(message)
File deprecation mark.
Putting this in a file will emit deprecation warning when given file is included or compiled on supported compilers:
CORRADE_DEPRECATED_FILE("use Bar.h instead") // yes, no semicolon at the end
On Clang the message is prepended with this file is deprecated, on GCC that's not possible so only the message alone is printed. Note that the warning is suppressed in case given directory is included as system (-isystem on GCC and Clang).
On MSVC the message is prepended with warning: <file> is deprecated. The message just appears in the log output without any association to a particular file, so the filename is included in the message. Due to MSVC limitations, the message doesn't contribute to the warning log or warning count in any way.
On compilers other than GCC, Clang and MSVC the macro does nothing.
#define CORRADE_DEPRECATED_MACRO(macro, message)
Macro deprecation mark.
Putting this in a macro definition will emit deprecation warning when given macro is used on supported compilers:
#define MAKE_FOO(args) \ CORRADE_DEPRECATED_MACRO(MAKE_FOO(),"use MAKE_BAR() instead") MAKE_BAR(args)
On Clang and MSVC the message is prepended with this macro is deprecated, on GCC that's not possible so only the message alone is printed.
On MSVC the message is prepended with <file> warning: <macro> is deprecated, where the macro name is taken from the first argument. The message just appears in the log output without any association to a particular file, so the file is included in the message. Due to MSVC limitations, the message doesn't contribute to the warning log or warning count in any way.
On compilers other than GCC, Clang and MSVC the macro does nothing.
#define CORRADE_IGNORE_DEPRECATED_PUSH
Begin code section with deprecation warnings ignored.
Suppresses compiler warnings when using a deprecated API on supported compilers. Useful when testing or writing APIs that depend on deprecated functionality. In order to avoid warning suppressions to leak, for every CORRADE_
CORRADE_DEPRECATED("use bar() instead") void foo(int); CORRADE_IGNORE_DEPRECATED_PUSH foo(42); CORRADE_IGNORE_DEPRECATED_POP
In particular, warnings from CORRADE_
#define CORRADE_IGNORE_DEPRECATED_POP
End code section with deprecation warnings ignored.
See CORRADE_