Browse Source

update LTC_DEPRECATED macro from ltm

Steffen Jaeckel 6 years ago
parent
commit
34d865488b
2 changed files with 14 additions and 8 deletions
  1. 11 5
      src/headers/tomcrypt_cfg.h
  2. 3 3
      src/headers/tomcrypt_misc.h

+ 11 - 5
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$ */

+ 3 - 3
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);