The compiler implements the following attributes (__attribute__ ((keyword)) ) for compatibility. Spelling the attribute keyword within double underscores, __keyword__, is also accepted.
Makes a name an alias for a declared function or variable name
Roughly equivalent to #pragma align. Generates a warning and is ignored if used on variable length arrays.
Equivalent to #pragma inline and -xinline
Causes the function specified with the attribute to be executed when the associated variable goes out of scope (exits the block in which it is declared). It can be applied only to auto function scope (local) variables, and cannot be applied to parameters or variables with static storage duration. The function must take one parameter, a pointer to a type compatible with the variable. The return value of the function (if any) is ignored. It is undefined what happens if the cleanup function does not return normally.
Equivalent to #pragma no_side_effect
Equivalent to #pragma init, except the constructor will only be called once.
Results in a warning if the variable or function is used anywhere in the source file. The optional argument msg must be a string and will be included in the warning message if issued.
Equivalent to #pragma fini
Equivalent to #pragma returns_new_memory
Equivalent to #pragma no_inline and -xinline
Equivalent to #pragma does_not_return
Equivalent to #pragma does_not_write_global_data
Equivalent to #pragma pack()
Equivalent to #pragma unknown_control_flow
Sets the thread-local storage model. The tls_model argument should be one of global-dynamic, local-dynamic, initial-exec, or local-exec.
Indicates that a variable or a type name (created using typedef) represents a vector.
Provides linker scoping as described in Linker Scoping Specifiers. Syntax is: __attribute__((visibility(“visibility-type”))), where visibility-type is one of:
Same as __global linker scoping
Same as __hidden linker scoping
Same as __symbolic linker scoping
Equivalent to #pragma weak
The predefined function-like macro
__has_attribute(attr)
evaluates to 1 if attr is a supported attribute. It evaluates to 0 otherwise. Example usage:
#ifndef __has_attribute // if we don't have __has_attribute, ignore it #define __has_attribute(x) 0 #endif #if __has_attribute(deprecated) #define DEPRECATED __attribute__((deprecated)) #else #define DEPRECATED // attribute "deprecated" not available #endif void DEPRECATED old_func(int); // use the attribute if available