Skip to main content

IAR Embedded Workbench for RISC-V 3.40

deprecated

In this section:
Syntax
#pragma deprecated
Description

If you place this pragma directive immediately before the declaration of a type, variable, function, field, or constant, any use of that type, variable, function, field, or constant will result in a warning.

This pragma directive has the same effect as the C++ attribute [[deprecated]], but is available in C as well.

Example
#pragma deprecated
typedef int * intp_t;  // typedef intp_t is deprecated

#pragma deprecated
extern int fun(void);  // function fun is deprecated

#pragma deprecated
struct xx {            // struct xx is deprecated
  int x;
};

struct yy {
#pragma deprecated
  int y;               // field y is deprecated
};

intp_t fun(void)       // Warning here
{
  struct xx ax;        // Warning here
  struct yy ay;
  fun();               // Warning here
  return ay.y;         // Warning here
}
See also

Annex K (Bounds-checking interfaces) of the C standard.