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 */