base: Deprecate the GEM5_DEPRECATED macro.
The [[deprecated()]] attribute is now standard, so we don't need to hide it behind a macro. Change-Id: Icfa6ad8b75ac64330f50f72fa310e104161bbf9d Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48508 Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br> Maintainer: Daniel Carvalho <odanrc@yahoo.com.br> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -106,16 +106,13 @@
|
||||
# define GEM5_LIKELY(cond) __builtin_expect(!!(cond), 1)
|
||||
# define GEM5_UNLIKELY(cond) __builtin_expect(!!(cond), 0)
|
||||
|
||||
// Mark a c++ declaration as deprecated, with a message explaining what to do
|
||||
// to update to a non-deprecated alternative.
|
||||
# define GEM5_DEPRECATED(message) [[gnu::deprecated(message)]]
|
||||
// Mark a C++ emum value as deprecated, with a message explaining what to do
|
||||
// to update to a non-deprecated alternative. This wraps GEM5_DEPRECATED but
|
||||
// is guarded by a preprocessor if directive to ensure it is not included
|
||||
// when compiled in GCC < 6, as deprecation of enum values was introduced in
|
||||
// GCC 6. All supported clang compilers allow enum value deprecation.
|
||||
# if defined(__clang__) || __GNUC__ >= 6
|
||||
# define GEM5_DEPRECATED_ENUM_VAL(message) GEM5_DEPRECATED(message)
|
||||
# define GEM5_DEPRECATED_ENUM_VAL(message) [[deprecated(message)]]
|
||||
# else
|
||||
# define GEM5_DEPRECATED_ENUM_VAL(message)
|
||||
# endif
|
||||
@@ -125,7 +122,7 @@
|
||||
// The definition must be an c++ expression and not a statement because of how
|
||||
// the original macro is wrapped.
|
||||
# define GEM5_DEPRECATED_MACRO(name, definition, message) \
|
||||
([](){GEM5_DEPRECATED(message) int name{}; return name;}(), (definition))
|
||||
([](){[[deprecated(message)]] int name{}; return name;}(), (definition))
|
||||
// This version is for macros which are statement-like, which frequently use
|
||||
// "do {} while (0)" to make their syntax look more like normal c++ statements.
|
||||
# define GEM5_DEPRECATED_MACRO_STMT(name, definition, message) \
|
||||
@@ -136,7 +133,7 @@
|
||||
// This macro should be used *after* the new class has been defined.
|
||||
# define GEM5_DEPRECATED_CLASS(old_class, new_class) \
|
||||
using old_class \
|
||||
GEM5_DEPRECATED("Please use the new class name: '" #new_class "'") = \
|
||||
[[deprecated("Please use the new class name: '" #new_class "'")]] = \
|
||||
new_class
|
||||
|
||||
// These macros should be used when namespaces are deprecated in favor of
|
||||
@@ -147,8 +144,8 @@
|
||||
# if HAVE_DEPRECATED_NAMESPACE
|
||||
# define GEM5_DEPRECATED_NAMESPACE(old_namespace, new_namespace) \
|
||||
namespace new_namespace {} \
|
||||
namespace GEM5_DEPRECATED("Please use the new namespace: '" \
|
||||
#new_namespace "'") old_namespace { \
|
||||
namespace [[deprecated("Please use the new namespace: '" \
|
||||
#new_namespace "'")]] old_namespace { \
|
||||
using namespace new_namespace; \
|
||||
}
|
||||
# else
|
||||
@@ -198,5 +195,8 @@ do { GEM5_VAR_USED int i[] = { 0, ((void)(__VA_ARGS__), 0)... }; } while (0)
|
||||
|
||||
#define GEM5_FALLTHROUGH GEM5_DEPRECATED_MACRO_STMT(GEM5_FALLTHROUGH,,\
|
||||
"Please use the [[fallthrough]] attribute directly."); [[fallthrough]]
|
||||
#define GEM5_DEPRECATED(message) \
|
||||
[[deprecated(message " The GEM5_DEPRECATED macro is also deprecated, "\
|
||||
"please use the [[deprecated()]] attribute directly.")]]
|
||||
|
||||
#endif // __BASE_COMPILER_HH__
|
||||
|
||||
Reference in New Issue
Block a user