【发布时间】:2021-12-03 20:44:51
【问题描述】:
如何弃用__STATIC_INLINE 函数。我知道我必须使用__attribute__ ((deprecated)) 但如何将其用于以下功能:
__STATIC_INLINE void Foo()
{
...
}
更新:
我的目标是使用 #define 声明弃用属性,例如:
#define THIS_IS_DEPRECATED __attribute__ ((deprecated))
并使用 #define 弃用 API。
更新 2:如果我使用,建议的解决方案工作 50%:
__STATIC_INLINE void THIS_IS_DEPRECATED Foo()
{
...
}
现在我收到了弃用警告,但出现了另一个错误:
error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Foo'
428 | __STATIC_INLINE void THIS_IS_DEPRECATED Foo(void)
| ^~~~~~~~~
【问题讨论】:
-
__attribute__ ((deprecated)) __STATIC_INLINE void Foo()不工作吗? -
No :( 不行,我觉得属性应该在最后。
-
want to use the attribute within a #define like: #define THIS_IS_DEPRECATED __attribute__((deprecated)) and use the #define instead.所以用它,你问这里干嘛?
标签: c deprecated