C programming: How to deprecate INLINE function

Viewed 108

How to deprecate __STATIC_INLINE function. I know that I have to use __attribute__ ((deprecated)) but how to use it for the following function:

__STATIC_INLINE void Foo()
{
  ...
}

Update: My goal is to use a #define that declare the deprecation attribute like: #define THIS_IS_DEPRECATED __attribute__ ((deprecated))

and use the #define to deprecate APIs.

Update 2: Proposed solution worked 50% if I use:

__STATIC_INLINE void THIS_IS_DEPRECATED Foo()
{
  ...
}

Now I am getting the deprecation warning, but another error appeared:

error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Foo'
  428 | __STATIC_INLINE void THIS_IS_DEPRECATED Foo(void)
      |                                         ^~~~~~~~~
1 Answers
static inline __attribute__((deprecated)) void Foo()
{
  
}

works for me. It generates a warning when I try to use it.

However I am not sure what the __STATIC_INLINE is?

EDIT according to your comment:

Do you mean something like

#define THIS_IS_DEPRECATED __attribute__((deprecated))

static inline THIS_IS_DEPRECATED void Foo()
{
  
}
Related