On 10/15/2015 06:25 AM, Arkadiusz Drabczyk wrote:
On Wed, Oct 14, 2015 at 06:18:03PM -0600, Martin Sebor wrote:
>On 10/14/2015 03:42 PM, Arkadiusz Drabczyk wrote:
> >On Wed, Oct 14, 2015 at 08:36:43AM -0600, Martin Sebor wrote:
> >>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.
> >
> >Done. I also removed the mention of nested functions as the following
> >code compiled with GCC 6.0 doesn't give any warning with -O2 -Winline
> >and main() is the only function defined in assembler code:
>
>I think this is the Ada-specific warning I mentioned (see
>check_inlining_for_nested_subprog in gcc/ada/gcc-interface/trans.c)
>so the part about nested functions needs to stay.
Ok, I brought it back.
> >> = G_("function %q+F can never be inlined because "
> >> "it uses non-local goto");
> >
> >I tested of all of these and listed them in the documentation but
> >wasn't able to reproduce this one. The following code does not give
> >any warning with -O2 -Winline:
>
>The warning above is issued for non-local and computed goto. You can
>find examples of both in the test suite (find gcc/testsuite/ -name
>"*goto*.[cC]")
Aha, ok, I just thought that longjmp() counts as a non-local goto
here. Indeed, this code invokes `function 'bar' can never be inlined
because it uses non-local goto' with -O2 -Winline (but only if
function that contains goto is nested, otherwise it fails to compile):
#include <stdio.h>
#include <stdlib.h>
int main (void)
{
__label__ l1;
void foo (void)
{
inline void bar (void)
{
puts ("goto l1");
goto l1;
}
bar ();
}
foo ();
abort ();
l1:
puts ("label l1");
return 0;
}
I brought back a mention of nonlocal goto and added a mention of
__builtin_longjmp() as the usual longjmp() does not prevent inlining.
Thanks Arkadiusz & Martin. I committed this version to the trunk.
jeff