diff mbox

c/67925 - update documentation on `inline'

Message ID 20151013224721.GA540@comp.lan
State New
Headers show

Commit Message

Arkadiusz Drabczyk Oct. 13, 2015, 10:47 p.m. UTC
* gcc/doc/extend.texi: documentation says that functions declared
`inline' would not be integrated if they are called before they are
defined or if they are recursive. Both of these statements is now
false as shown in examples on Bugzilla.
---
 gcc/doc/extend.texi | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Martin Sebor Oct. 14, 2015, 2:36 p.m. UTC | #1
On 10/13/2015 04:47 PM, Arkadiusz Drabczyk wrote:
> * gcc/doc/extend.texi: documentation says that functions declared
> `inline' would not be integrated if they are called before they are
> defined or if they are recursive. Both of these statements is now
> false as shown in examples on Bugzilla.

It might also be worth updating the note in the subsequent
paragraph and removing the mention of variable-length data types
which no longer prevent inlining.

FWIW, the list of most -Winline warnings issued by GCC is here
(there are two more in Ada which, AFAICT, have to do with nested
functions):

$ grep -A1 "can never be inlined" gcc/tree-inline.c
	    = G_("function %q+F can never be inlined because it uses "
		 "alloca (override using the always_inline attribute)");
--
	    = G_("function %q+F can never be inlined because it uses setjmp");
	  *handled_ops_p = true;
--
	      = G_("function %q+F can never be inlined because it "
		   "uses variable argument lists");
--
	      = G_("function %q+F can never be inlined because "
		   "it uses setjmp-longjmp exception handling");
--
	      = G_("function %q+F can never be inlined because "
		   "it uses non-local goto");
--
	      = G_("function %q+F can never be inlined because "
		   "it uses __builtin_return or __builtin_apply_args");
--
	    = G_("function %q+F can never be inlined "
		 "because it contains a computed goto");
--
         warning (OPT_Winline, "function %q+F can never be inlined 
because it "
                  "is suppressed using -fno-inline", fn);
--
         warning (OPT_Winline, "function %q+F can never be inlined 
because it "
                  "uses attributes conflicting with inlining", fn);

Martin

> ---
>   gcc/doc/extend.texi | 9 +++------
>   1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
> index 79440d3..7ea4b62 100644
> --- a/gcc/doc/extend.texi
> +++ b/gcc/doc/extend.texi
> @@ -7088,12 +7088,9 @@ function are integrated into the caller, and the function's address is
>   never used, then the function's own assembler code is never referenced.
>   In this case, GCC does not actually output assembler code for the
>   function, unless you specify the option @option{-fkeep-inline-functions}.
> -Some calls cannot be integrated for various reasons (in particular,
> -calls that precede the function's definition cannot be integrated, and
> -neither can recursive calls within the definition).  If there is a
> -nonintegrated call, then the function is compiled to assembler code as
> -usual.  The function must also be compiled as usual if the program
> -refers to its address, because that can't be inlined.
> +If there is a nonintegrated call, then the function is compiled to
> +assembler code as usual.  The function must also be compiled as usual if
> +the program refers to its address, because that can't be inlined.
>
>   @opindex Winline
>   Note that certain usages in a function definition can make it unsuitable
>
diff mbox

Patch

diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 79440d3..7ea4b62 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -7088,12 +7088,9 @@  function are integrated into the caller, and the function's address is
 never used, then the function's own assembler code is never referenced.
 In this case, GCC does not actually output assembler code for the
 function, unless you specify the option @option{-fkeep-inline-functions}.
-Some calls cannot be integrated for various reasons (in particular,
-calls that precede the function's definition cannot be integrated, and
-neither can recursive calls within the definition).  If there is a
-nonintegrated call, then the function is compiled to assembler code as
-usual.  The function must also be compiled as usual if the program
-refers to its address, because that can't be inlined.
+If there is a nonintegrated call, then the function is compiled to
+assembler code as usual.  The function must also be compiled as usual if
+the program refers to its address, because that can't be inlined.
 
 @opindex Winline
 Note that certain usages in a function definition can make it unsuitable