Red Hat ENTERPRISE LINUX 4 Manual page 162

Hide thumbs Also See for ENTERPRISE LINUX 4:
Table of Contents

Advertisement

154
used
This attribute, attached to a function, means that code must be emitted for the function even if
it appears that the function is not referenced. This is useful, for example, when the function is
referenced only in inline assembly.
deprecated
The
deprecated
This is useful when identifying functions that are expected to be removed in a future version of
a program. The warning also includes the location of the declaration of the deprecated function,
to enable users to easily find further information about why the function is deprecated, or what
they should do instead. Note that the warnings only occurs for uses:
int old_fn () __attribute__ ((deprecated));
int old_fn ();
int (*fn_ptr)() = old_fn;
results in a warning on line 3 but not line 2.
The
deprecated
Attributes of Variables, Section 6.33 Specifying Attributes of Types.)
warn_unused_result
The
warn_unused_result
with this attribute does not use its return value. This is useful for functions where not checking
the result is either a security problem or always a bug, such as
int fn () __attribute__ ((warn_unused_result));
int foo ()
{
if (fn ()
fn ();
return 0;
}
results in warning on line 5.
weak
The
attribute causes the declaration to be emitted as a weak symbol rather than a global.
weak
This is primarily useful in defining library functions which can be overridden in user code, though
it can also be used with non-function declarations. Weak symbols are supported for ELF targets,
and also for a.out targets when using the GNU assembler and linker.
malloc
The
attribute is used to tell the compiler that a function may be treated as if any non-
malloc
pointer it returns cannot alias any other pointer valid when the function returns. This will
NULL
often improve optimization. Standard functions with this property include
-like functions have this property as long as the old pointer is never referred to (includ-
realloc
ing comparing it to the new pointer) after the function returns a non-
alias ("
")
target
The
attribute causes the declaration to be emitted as an alias for another symbol, which
alias
must be specified. For instance,
void __f () { /* Do something. */; }
void f () __attribute__ ((weak, alias ("__f")));
declares
to be a weak alias for
f
Not all target machines support this attribute.
attribute results in a warning if the function is used anywhere in the source file.
attribute can also be used for variables and types (Section 6.32 Specifying
attribute causes a warning to be emitted if a caller of the function
0) return -1;
. In C++, the mangled name for the target must be used.
__f
Chapter 6. Extensions to the C Language Family
realloc
.
and
malloc
calloc
value.
NULL
.

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ENTERPRISE LINUX 4 and is the answer not in the manual?

Questions and answers

Table of Contents