From 5952392494dbdcd1db7a230526df30c15195b996 Mon Sep 17 00:00:00 2001 From: Maximilien Colange Date: Thu, 24 Nov 2016 15:06:46 +0100 Subject: [PATCH] Use the [[deprecated]] standard attribute when possible. * spot/misc/common.hh: Change SPOT_DEPRECATED definition. --- spot/misc/common.hh | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/spot/misc/common.hh b/spot/misc/common.hh index cb31eefba..e5d062883 100644 --- a/spot/misc/common.hh +++ b/spot/misc/common.hh @@ -30,12 +30,19 @@ #define SPOT_UNLIKELY(expr) (expr) #endif -#ifdef __GNUC__ -#define SPOT_DEPRECATED __attribute__ ((deprecated)) -#elif defined(_MSC_VER) -#define SPOT_DEPRECATED __declspec(deprecated) -#else -#define SPOT_DEPRECATED func +#ifdef __has_cpp_attribute +# if __has_cpp_attribute(deprecated) +# define SPOT_DEPRECATED [[deprecated]] +# endif +#endif +#ifndef SPOT_DEPRECATED +# ifdef __GNUC__ +# define SPOT_DEPRECATED __attribute__ ((deprecated)) +# elif defined(_MSC_VER) +# define SPOT_DEPRECATED __declspec(deprecated) +# else +# define SPOT_DEPRECATED +# endif #endif #if defined _WIN32 || defined __CYGWIN__