160
An identifier. For example,
•
An identifier followed by a comma and a non-empty comma-separated list of expressions. For
•
example,
format
A possibly empty comma-separated list of expressions. For example,
•
this form with the list being a single integer constant expression, and
form with the list being a single string constant.
An attribute specifier list is a sequence of one or more attribute specifiers, not separated by any other
tokens.
In GNU C, an attribute specifier list may appear after the colon following a label, other than a
or
label. The only attribute it makes sense to use after a label is
default
intended for code generated by programs which contains labels that may be unused but which is
compiled with
-Wall
it could be useful in cases where the code that jumps to the label is contained within an
conditional. GNU C++ does not permit such placement of attribute lists, as it is permissible for a
declaration, which could begin with an attribute list, to be labelled in C++. Declarations cannot be
labelled in C90 or C99, so the ambiguity does not arise there.
An attribute specifier list may appear as part of a
immediately after the
if the content of the structure, union or enumerated type is not defined in the specifier in which the
attribute specifier list is used--that is, in usages such as
no following opening brace. Where attribute specifiers follow the closing brace, they are considered
to relate to the structure, union or enumerated type defined, not to any enclosing declaration the type
specifier appears in, and the type defined is not complete until after the attribute specifiers.
Otherwise, an attribute specifier appears as part of a declaration, counting declarations of unnamed pa-
rameters and type names, and relates to that declaration (which may be nested in another declaration,
for example in the case of a parameter declaration), or to a particular declarator within a declaration.
Where an attribute specifier is applied to a parameter declared as a function or an array, it should apply
to the function or array rather than the pointer to which the parameter is implicitly converted, but this
is not yet correctly implemented.
Any list of specifiers and qualifiers at the start of a declaration may contain attribute specifiers, whether
or not such a list may in that context contain storage class specifiers. (Some attributes, however, are
essentially in the nature of storage class specifiers, and only make sense where storage class specifiers
may be used; for example,
style parameter declaration in a function definition cannot begin with an attribute specifier, because
such an attribute applies to the function instead by syntax described below (which, however, is not yet
implemented in this case). In some other cases, attribute specifiers are permitted by this grammar but
not yet supported by the compiler. All attribute specifiers in this place relate to the declaration as a
whole. In the obsolescent usage where a type of
a list of specifiers and qualifiers may be an attribute specifier list with no other specifiers or qualifiers.
An attribute specifier list may appear immediately before a declarator (other than the first) in a comma-
separated list of declarators in a declaration of more than one identifier using a single list of specifiers
and qualifiers. Such attribute specifiers apply only to the identifier before whose declarator they ap-
pear. For example, in
__attribute__((noreturn)) void d0 (void),
__attribute__((format(printf, 1, 2))) d1 (const char *, ...),
d2 (void)
the
attribute applies to all the functions declared; the
noreturn
attributes use this form.
mode
attributes use this form.
. It would not normally be appropriate to use in it human-written code, though
,
or
struct
union
.) There is one necessary limitation to this syntax: the first old-
section
Chapter 6. Extensions to the C Language Family
,
struct
union
keyword, or after the closing brace. It is ignored
enum
struct __attribute__((foo)) bar
is implied by the absence of type specifiers, such
int
format_arg
attributes use this
alias
. This feature is
unused
or
specifier. It may go either
enum
attribute only applies to
format
attributes use
case
#ifdef
with
.
d1
Need help?
Do you have a question about the ENTERPRISE LINUX 4 and is the answer not in the manual?
Questions and answers