浏览代码

Allow deprecation warnings to be disabled

One can now define them on a per-case basis to disable them.

Signed-off-by: Steffen Jaeckel <[email protected]>
Steffen Jaeckel 2 月之前
父节点
当前提交
c9259ffa31
共有 1 个文件被更改,包括 13 次插入4 次删除
  1. 13 4
      src/headers/tomcrypt_cfg.h

+ 13 - 4
src/headers/tomcrypt_cfg.h

@@ -329,21 +329,30 @@ typedef unsigned long ltc_mp_digit;
 #   define LTC_NULL_TERMINATED
 #endif
 
+#ifndef LTC_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(s) __declspec(deprecated("replaced by " #s))
-#  define LTC_DEPRECATED_PRAGMA(s) __pragma(message(s))
 #else
 #  define LTC_DEPRECATED(s)
+#endif
+#endif
+
+#ifndef LTC_DEPRECATED_PRAGMA
+#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 405)
+#  define PRIVATE_LTC_DEPRECATED_PRAGMA(s) _Pragma(#s)
+#  define LTC_DEPRECATED_PRAGMA(s) PRIVATE_LTC_DEPRECATED_PRAGMA(GCC warning s)
+#elif defined(_MSC_VER) && _MSC_VER >= 1500
+   /* supported since Visual Studio 2008 */
+#  define LTC_DEPRECATED_PRAGMA(s) __pragma(message(s))
+#else
 #  define LTC_DEPRECATED_PRAGMA(s)
 #endif
+#endif
 
 #if defined(__GNUC__) || defined(__clang__)
 #  define LTC_ATTRIBUTE(x) __attribute__(x)