From 34d865488ba134e02cacf6f6347345faae055da5 Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Tue, 1 Oct 2019 23:54:02 +0200 Subject: [PATCH] update LTC_DEPRECATED macro from ltm --- src/headers/tomcrypt_cfg.h | 16 +++++++++++----- src/headers/tomcrypt_misc.h | 6 +++--- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/headers/tomcrypt_cfg.h b/src/headers/tomcrypt_cfg.h index 9c4e00f1..81d9454a 100644 --- a/src/headers/tomcrypt_cfg.h +++ b/src/headers/tomcrypt_cfg.h @@ -294,15 +294,21 @@ typedef unsigned long ltc_mp_digit; #define LTC_HAVE_ROTATE_BUILTIN #endif -#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 301) - #define LTC_DEPRECATED __attribute__((deprecated)) +#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 405) +# define LTC_DEPRECATED(s) __attribute__((deprecated("replaced by " #s))) +# define PRIVATE_LTC_DEPRECATED_PRAGMA(s) _Pragma(#s) +# define LTC_DEPRECATED_PRAGMA(s) PRIVATE_LTC_DEPRECATED_PRAGMA(GCC warning s) +#elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 301) +# define LTC_DEPRECATED(s) __attribute__((deprecated)) +# define LTC_DEPRECATED_PRAGMA(s) #elif defined(_MSC_VER) && _MSC_VER >= 1500 /* supported since Visual Studio 2008 */ - #define LTC_DEPRECATED __declspec(deprecated) +# define LTC_DEPRECATED(s) __declspec(deprecated("replaced by " #s)) +# define LTC_DEPRECATED_PRAGMA(s) __pragma(message(s)) #else - #define LTC_DEPRECATED +# define LTC_DEPRECATED(s) +# define LTC_DEPRECATED_PRAGMA(s) #endif - /* ref: $Format:%D$ */ /* git commit: $Format:%H$ */ /* commit time: $Format:%ai$ */ diff --git a/src/headers/tomcrypt_misc.h b/src/headers/tomcrypt_misc.h index 78e233d7..cad857bb 100644 --- a/src/headers/tomcrypt_misc.h +++ b/src/headers/tomcrypt_misc.h @@ -102,13 +102,13 @@ int crypt_get_size(const char* namein, unsigned int *sizeout); int crypt_list_all_sizes(char *names_list, unsigned int *names_list_size); #ifdef LTM_DESC -LTC_DEPRECATED void init_LTM(void); +LTC_DEPRECATED(crypt_mp_init) void init_LTM(void); #endif #ifdef TFM_DESC -LTC_DEPRECATED void init_TFM(void); +LTC_DEPRECATED(crypt_mp_init) void init_TFM(void); #endif #ifdef GMP_DESC -LTC_DEPRECATED void init_GMP(void); +LTC_DEPRECATED(crypt_mp_init) void init_GMP(void); #endif int crypt_mp_init(const char* mpi);