You copied the Doc URL to your clipboard.

__attribute__((deprecated)) variable attribute

The deprecated variable attribute enables the declaration of a deprecated variable without any warnings or errors being issued by the compiler. However, any access to a deprecated variable creates a warning but still compiles.

The warning gives the location where the variable is used and the location where it is defined. This helps you to determine why a particular definition is deprecated.


extern int deprecated_var __attribute__((deprecated));
void foo()

Compiling this example generates a warning:

armclang --target=aarch64-arm-none-eabi -c test_deprecated.c
test_deprecated.c:4:3: warning: 'deprecated_var' is deprecated [-Wdeprecated-declarations]
test_deprecated.c:1:12: note: 'deprecated_var' has been explicitly marked deprecated here
  extern int deprecated_var __attribute__((deprecated));
1 warning generated.
Was this page helpful? Yes No