Search notes:
gcc: __attribute__((deprecated))
With
__attribute__((deprecated))
,
gcc allows to declare variables, structs and functions as
deprecated.
When the respective compilation unit is compiled with the
-Wdeprecated-declaration
, the compiler will print a warning like
main.c:11:11: warning: ‘tq84_struct’ is deprecated [-Wdeprecated-declarations]
struct tq84_struct s;
struct tq84_struct {
int i;
} __attribute__ ((deprecated));
__attribute__((deprecated)) int func() {
return 42;
}
int main() {
struct tq84_struct s;
int tq84_var __attribute((deprecated));
int y;
s.i = 42;
tq84_var = 42;
y = func();
}