gcc: Statement Attributes
1
1 6.36 Statement Attributes
1 =========================
1
11 GCC allows attributes to be set on null statements. ⇒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), enumerators (⇒Enumerator Attributes), and for
1 types (⇒Type Attributes).
1
1 This example uses the 'fallthrough' statement attribute to indicate
1 that the '-Wimplicit-fallthrough' warning should not be emitted:
1
1 switch (cond)
1 {
1 case 1:
1 bar (1);
1 __attribute__((fallthrough));
1 case 2:
1 ...
1 }
1
1 'fallthrough'
1 The 'fallthrough' attribute with a null statement serves as a
1 fallthrough statement. It hints to the compiler that a statement
1 that falls through to another case label, or user-defined label in
1 a switch statement is intentional and thus the
1 '-Wimplicit-fallthrough' warning must not trigger. The fallthrough
1 attribute may appear at most once in each attribute list, and may
1 not be mixed with other attributes. It can only be used in a
1 switch statement (the compiler will issue an error otherwise),
1 after a preceding statement and before a logically succeeding case
1 label, or user-defined label.
1