Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/48508 )

Change subject: base: Deprecate the GEM5_DEPRECATED macro.
......................................................................

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
---
M src/base/compiler.hh
1 file changed, 8 insertions(+), 8 deletions(-)



diff --git a/src/base/compiler.hh b/src/base/compiler.hh
index a153d91..e13686c 100644
--- a/src/base/compiler.hh
+++ b/src/base/compiler.hh
@@ -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 @@

 #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__

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/48508
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Icfa6ad8b75ac64330f50f72fa310e104161bbf9d
Gerrit-Change-Number: 48508
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to