From: Timo Sirainen Date: Sat, 21 Apr 2018 13:19:43 +0000 (+0300) Subject: lib: Add ATTR_DEPRECATED macro X-Git-Tag: 2.3.4~246 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=21dfb293b749a081dfeea23beb36bfdfdf907e18;p=thirdparty%2Fdovecot%2Fcore.git lib: Add ATTR_DEPRECATED macro --- diff --git a/src/lib/compat.h b/src/lib/compat.h index d287b6572c..dbda02f809 100644 --- a/src/lib/compat.h +++ b/src/lib/compat.h @@ -27,6 +27,7 @@ #if (defined(__GNUC__) && __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)) || \ (defined(__clang__) && (__has_extension(attribute_deprecated_with_message))) +# define HAVE_ATTR_DEPRECATED int rand(void) __attribute__((deprecated("Do not use rand, use i_rand"))); int rand_r(unsigned int*) __attribute__((deprecated("Do not use rand_r, use i_rand"))); #endif diff --git a/src/lib/macros.h b/src/lib/macros.h index eec7cd2f02..6924b3c145 100644 --- a/src/lib/macros.h +++ b/src/lib/macros.h @@ -150,6 +150,11 @@ #else # define ATTR_RETURNS_NONNULL #endif +#ifdef HAVE_ATTR_DEPRECATED +# define ATTR_DEPRECATED(str) __attribute__((deprecated(str))) +#else +# define ATTR_DEPRECATED(str) +#endif /* Macros to provide type safety for callback functions' context parameters */ #ifdef HAVE_TYPE_CHECKS