标记函数为已弃用宏:WHISPER_DEPRECATED
- 对于 GNU 编译器(
__GNUC__
),使用__attribute__((deprecated(hint)))
属性将函数标记为已弃用,并附带指定的提示信息。 - 对于微软 Visual C++ 编译器(
_MSC_VER
),使用__declspec(deprecated(hint))
属性实现相同的目的。 - 对于其他编译器,函数不会被标记为已弃用。
// 检查是否为 GNU 编译器
#ifdef __GNUC__
// 对于 GNU 编译器,使用 __attribute__((deprecated(hint))) 将函数标记为已弃用
// hint 参数用于提供关于已弃用的提示信息
#define WHISPER_DEPRECATED(func, hint) func __attribute__((deprecated(hint)))
// 检查是否为 Microsoft Visual C++ 编译器
#elif defined(_MSC_VER)
// 对于 Microsoft Visual C++ 编译器,使用 __declspec(deprecated(hint)) 将函数标记为已弃用
// hint 参数用于提供关于已弃用的提示信息
#define WHISPER_DEPRECATED