| deprecated

Previous | Specifying Attributes of Types |

The `deprecated` attribute results in a warning if the type is used anywhere in the source file. This is useful when identifying types that are expected to be removed in a future version of a program. If possible, the warning also includes the location of the declaration of the deprecated type, to enable users to easily find further information about why the type is deprecated, or what they should do instead. Note that the warnings only occur for uses and then only if the type is being applied to an identifier that itself is not being declared as deprecated.

    typedef int T1 __attribute__ ((deprecated));
    T1 x;
    typedef T1 T2;
    T2 y;
    typedef T1 T3 __attribute__ ((deprecated));
    T3 z __attribute__ ((deprecated));

results in a warning on line 2 and 3 but not lines 4, 5, or 6. No warning is issued for line 4 because T2 is not explicitly deprecated. Line 5 has no warning because T3 is explicitly deprecated. Similarly for line 6.
The `deprecated` attribute can also be used for functions and variables.