https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99975
--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Surprisingly, other variable attributes such as deprecated and alloc_size (the
latter applied to a pointer to a function) do work as expected:
$ cat z.C && gcc -S -Wall z.C
int f ()
{
extern __attribute__ ((deprecated ("I was deprecated in f()"))) int i;
return i;
}
int gv()
{
extern int i;
return i;
}
z.C: In function ‘int f()’:
z.C:5:10: warning: ‘i’ is deprecated: I was deprecated in f()
[-Wdeprecated-declarations]
5 | return i;
| ^
z.C:3:71: note: declared here
3 | extern __attribute__ ((deprecated ("I was deprecated in f()"))) int i;
| ^
z.C: In function ‘int gv()’:
z.C:12:10: warning: ‘i’ is deprecated: I was deprecated in f()
[-Wdeprecated-declarations]
12 | return i;
| ^
z.C:3:71: note: declared here
3 | extern __attribute__ ((deprecated ("I was deprecated in f()"))) int i;
| ^