diff options
author | green <green@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-11-28 20:45:34 +0000 |
---|---|---|
committer | green <green@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-11-28 20:45:34 +0000 |
commit | 7259f3f876369b3b76f7e0a2d45328706ac8ad7b (patch) | |
tree | 64c16fe212dcb5f1d77505bd5b8e158441e8665e /gcc/extend.texi | |
parent | 6577f1275b48d4bf43060cea1d3feea2ce13fbc6 (diff) | |
download | gcc-7259f3f876369b3b76f7e0a2d45328706ac8ad7b.tar.gz |
* tree.h (struct tree_decl): Add malloc_flag.
(DECL_IS_MALLOC): Define.
* c-common.c (attrs): Add A_MALLOC attribute.
(init_attributes): Add this attribute to the table.
(decl_attributes): Handle malloc attribute.
* calls.c (special_function_p): Check for the malloc attribute.
* extend.texi (Function Attributes): Document malloc attribute.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30689 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/extend.texi')
-rw-r--r-- | gcc/extend.texi | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/gcc/extend.texi b/gcc/extend.texi index 17f12c95d92..be217a35c8c 100644 --- a/gcc/extend.texi +++ b/gcc/extend.texi @@ -1310,6 +1310,7 @@ hack ((union foo) x); @cindex functions that never return @cindex functions that have no side effects @cindex functions in arbitrary sections +@cindex functions that bahave like malloc @cindex @code{volatile} applied to function @cindex @code{const} applied to function @cindex functions with @code{printf}, @code{scanf} or @code{strftime} style arguments @@ -1323,10 +1324,10 @@ carefully. The keyword @code{__attribute__} allows you to specify special attributes when making a declaration. This keyword is followed by an -attribute specification inside double parentheses. Nine attributes, +attribute specification inside double parentheses. Ten attributes, @code{noreturn}, @code{const}, @code{format}, -@code{no_instrument_function}, @code{section}, -@code{constructor}, @code{destructor}, @code{unused} and @code{weak} are +@code{no_instrument_function}, @code{section}, @code{constructor}, +@code{destructor}, @code{unused}, @code{weak} and @code{malloc} are currently defined for functions. Other attributes, including @code{section} are supported for variables declarations (@pxref{Variable Attributes}) and for types (@pxref{Type Attributes}). @@ -1540,6 +1541,13 @@ 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. +@item malloc +@cindex @code{malloc} attribute +The @code{malloc} attribute is used to tell the compiler that a function +may be treated as if it were the malloc function. The compiler assumes +that calls to malloc result in a pointers that cannot alias anything. +This will often improve optimization. + @item alias ("target") @cindex @code{alias} attribute The @code{alias} attribute causes the declaration to be emitted as an |