From 25c02db88cefe20eb1037b21779ec3876267e6ce Mon Sep 17 00:00:00 2001 From: "Peter D. Barnes, Jr." Date: Fri, 2 Sep 2016 21:46:31 -0400 Subject: [PATCH] [core] restore NS_DEPRECATED functionality --- src/core/doc/deprecated-example.h | 2 +- src/core/model/deprecated.h | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/core/doc/deprecated-example.h b/src/core/doc/deprecated-example.h index 963d8a890..bc14f4b00 100644 --- a/src/core/doc/deprecated-example.h +++ b/src/core/doc/deprecated-example.h @@ -30,7 +30,7 @@ * \deprecated This method will go away in future versions of ns-3. * See instead TheNewWay() */ -void SomethingUseful (void); +NS_DEPRECATED(void SomethingUseful (void) ); /* * Do something more useful. */ diff --git a/src/core/model/deprecated.h b/src/core/model/deprecated.h index c80494f6b..cd9c0ebdb 100644 --- a/src/core/model/deprecated.h +++ b/src/core/model/deprecated.h @@ -41,10 +41,21 @@ * \snippet src/core/doc/deprecated-example.h doxygen snippet */ -#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ > 1) -#define NS_DEPRECATED __attribute__ ((deprecated)) +#if defined(__GNUC__) +/* Test for GCC >= 4.1 */ +#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) +#if (GCC_VERSION >= 40100) +#define NS_DEPRECATED(x) x __attribute__ ((deprecated)) +#endif +#undef GCC_VERSION + + +#elif defined(__clang__) || defined(__llvm__) +#define NS_DEPRECATED(x) x __attribute__ ((deprecated)) +#elif defined(_MSC_VER) +#define NS_DEPRECATED __declspec(deprecated) x #else -#define NS_DEPRECATED +#define NS_DEPRECATED(x) x #endif #endif /* NS3_DEPRECATED_H */