https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61754
--- Comment #7 from Martin Sebor <msebor at gcc dot gnu.org> --- I suspect __attribute__((deprecated)) doesn't work quite the way you would like in C++ either. It only happens to do what you expect (i.e., not trigger a warning) in the case in comment #0 but not in others, and the difference in its effect based on its position seems too subtle to me to be intuitive or desirable. $ cat u.C && gcc -S -Wall -Wextra -Wpedantic u.C struct __attribute__((deprecated)) A { }; __attribute__((deprecated)) struct A a0; // -Wdeprecated-declarations (C++ only) struct A __attribute__((deprecated)) a1; // -Wdeprecated-declarations (C++ only) struct A a2 __attribute__((deprecated)); // no warning here (both C and C++) u.C:3:38: warning: ‘A’ is deprecated [-Wdeprecated-declarations] __attribute__((deprecated)) struct A a0; // -Wdeprecated-declarations (C++ only) ^~ u.C:1:36: note: declared here struct __attribute__((deprecated)) A { }; ^ u.C:4:38: warning: ‘A’ is deprecated [-Wdeprecated-declarations] struct A __attribute__((deprecated)) a1; // -Wdeprecated-declarations (C++ only) ^~ u.C:1:36: note: declared here struct __attribute__((deprecated)) A { }; ^ In C, the above emits no warnings, so that would let you do what you want to do for objects. But it doesn't behave the same way for functions, so it doesn't make it possible to declare deprecated API that uses a deprecated struct without triggering a deprecated warning: struct __attribute__((deprecated)) A { int i; }; __attribute__((deprecated)) void f (struct A); // -Wdeprecated-declarations void __attribute__((deprecated)) g (struct A); // -Wdeprecated-declarations void h (struct A) __attribute__((deprecated)); // -Wdeprecated-declarations (C only) u.C:3:44: warning: ‘A’ is deprecated [-Wdeprecated-declarations] __attribute__((deprecated)) void f (struct A); // -Wdeprecated-declarations ^ u.C:1:36: note: declared here struct __attribute__((deprecated)) A { int i; }; ^ u.C:4:44: warning: ‘A’ is deprecated [-Wdeprecated-declarations] void __attribute__((deprecated)) g (struct A); // -Wdeprecated-declarations ^ u.C:1:36: note: declared here struct __attribute__((deprecated)) A { int i; }; ^ u.C:5:16: warning: ‘A’ is deprecated [-Wdeprecated-declarations] void h (struct A) __attribute__((deprecated)); // -Wdeprecated-declarations (C only) ^ u.C:1:36: note: declared here struct __attribute__((deprecated)) A { int i; }; ^ I would like the attributes to work consistently regardless of their placement (where it's allowed) and regardless of the language. I don't yet know to what extent that will be possible. I hope to look into it in stage 1.