gcc: Enumerator Attributes
1
1 6.35 Enumerator Attributes
1 ==========================
1
11 GCC allows attributes to be set on enumerators. ⇒Attribute
Syntax, for details of the exact syntax for using attributes. Other
1 attributes are available for functions (⇒Function Attributes),
DONTPRINTYET 1 variables (⇒Variable Attributes), labels (*noteLabel
1DONTPRINTYET 1 variables (⇒Variable Attributes), labels (⇒Label
Attributes), statements (⇒Statement Attributes), and for types
1 (⇒Type Attributes).
1
1 This example uses the 'deprecated' enumerator attribute to indicate the
1 'oldval' enumerator is deprecated:
1
1 enum E {
1 oldval __attribute__((deprecated)),
1 newval
1 };
1
1 int
1 fn (void)
1 {
1 return oldval;
1 }
1
1 'deprecated'
1 The 'deprecated' attribute results in a warning if the enumerator
1 is used anywhere in the source file. This is useful when
1 identifying enumerators that are expected to be removed in a future
1 version of a program. The warning also includes the location of
1 the declaration of the deprecated enumerator, to enable users to
1 easily find further information about why the enumerator is
1 deprecated, or what they should do instead. Note that the warnings
1 only occurs for uses.
1