3.28 __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' declared here
  extern int deprecated_var __attribute__((deprecated));
1 warning generated.
Non-ConfidentialPDF file icon PDF versionARM DUI0774E
Copyright © 2014-2016 ARM. All rights reserved.