[Bug c++/79078] Warnings from deprecated attribute are too noisy
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Mar 21 16:21:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79078
--- Comment #14 from Martin Sebor <msebor at gcc dot gnu.org> ---
For non-member functions that are part of a class API I would like to see about
getting the following to work for types (as it already does for functions):
1) define a class with no attribute
2) define the API that uses the class without triggering warnings
3) declare the class [[deprecated]]
4) have any subsequent uses of the class trigger warnings
Like this:
$ cat u.C && gcc -S -Wall -Wextra -Wpedantic u.C
struct A;
int f (A*);
int i = f (0);
struct A { };
int g (A); // no warning
int j = g (A ()); // no warning
struct [[deprecated]] A; // add attribute, expect no warning
int h (A); // expect warning
u.C:13:23: warning: type attributes ignored after type is already defined
[-Wattributes]
struct [[deprecated]] A; // add attribute, expect no warning
^
Currently it doesn't work because for structs, GCC doesn't apply attributes
from declarations, only on definitions (this is bug 81756, at least in part).
Does it resolve the outstanding issues? Are there any concerns with it?
More information about the Gcc-bugs
mailing list