diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2002-02-22 00:09:04 +0000 |
---|---|---|
committer | Aldy Hernandez <aldyh@gcc.gnu.org> | 2002-02-22 00:09:04 +0000 |
commit | 6aa77e6c394b8d61c25d146e7d106f4ddf17ca54 (patch) | |
tree | 81ecf94407355c68f26f5bc1ca604c5ff588e9da /gcc/doc | |
parent | c410d49e434d06e93c9163eda0a26891e6116a7e (diff) | |
download | gcc-6aa77e6c394b8d61c25d146e7d106f4ddf17ca54.tar.gz |
attr-alwaysinline.c: New.
2002-02-21 Aldy Hernandez <aldyh@redhat.com>
* gcc.dg/attr-alwaysinline.c: New.
* c-common.c (c_common_post_options): Set inline trees by
default.
* doc/extend.texi (Function Attributes): Document always_inline
attribute.
Update documentation about inlining when not optimizing.
* cp/decl.c (duplicate_decls): Merge always_inline attribute.
* cp/tree.c (cp_cannot_inline_tree_fn): Do not inline at -O0
unless DECL_ALWAYS_INLINE.
* c-objc-common.c (c_cannot_inline_tree_fn): Do not inline at -O0
unless DECL_ALWAYS_INLINE.
(c_disregard_inline_limits): Disregard if always_inline set.
* langhooks.c (lhd_tree_inlining_disregard_inline_limits):
Disregard if always_inline set.
(lhd_tree_inlining_cannot_inline_tree_fn): Do not inline at -O0
unless DECL_ALWAYS_INLINE.
* attribs.c (handle_always_inline_attribute): New.
(c_common_attribute_table): Add always_inline.
* config/rs6000/altivec.h: Add prototypes for builtins
requiring the always_inline attribute.
From-SVN: r49947
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/extend.texi | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 39e0fb9d260..68d0146bad8 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -1880,7 +1880,8 @@ 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. The following attributes are currently defined for functions on all targets: -@code{noreturn}, @code{noinline}, @code{pure}, @code{const}, +@code{noreturn}, @code{noinline}, @code{always_inline}, +@code{pure}, @code{const}, @code{format}, @code{format_arg}, @code{no_instrument_function}, @code{section}, @code{constructor}, @code{destructor}, @code{used}, @code{unused}, @code{deprecated}, @code{weak}, @code{malloc}, and @@ -1946,6 +1947,12 @@ volatile voidfn fatal; This function attribute prevents a function from being considered for inlining. +@cindex @code{always_inline} function attribute +@item always_inline +Generally, functions are not inlined unless optimization is specified. +For functions declared inline, this attribute inlines the function even +if no optimization level was specified. + @cindex @code{pure} function attribute @item pure Many functions have no effects except the return value and their @@ -3388,10 +3395,13 @@ existing semantics will remain available when @option{-std=gnu89} is specified, but eventually the default will be @option{-std=gnu99} and that will implement the C99 semantics, though it does not do so yet.) -GCC does not inline any functions when not optimizing. It is not -clear whether it is better to inline or not, in this case, but we found -that a correct implementation when not optimizing was difficult. So we -did the easy thing, and turned it off. +GCC does not inline any functions when not optimizing unless you specify +the @samp{always_inline} attribute for the function, like this: + +@example +/* Prototype. */ +inline void foo (const char) __attribute__((always_inline)); +@end example @node Extended Asm @section Assembler Instructions with C Expression Operands |