public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* always_inline and LTO
@ 2020-11-27 23:44 Al K
  0 siblings, 0 replies; only message in thread
From: Al K @ 2020-11-27 23:44 UTC (permalink / raw)
  To: gcc-help

Hi,

I'm curious to know if the standard 'static inline' rules apply to
always_inline functions defined externally
but with LTO. For example,

    // foo.h
    extern __attribute__((__always_inline__)) void foo(void);

    // foo.c
    #include "foo.h"

    void foo(void)
    {
        ...
    }

    // bar.c
    #include "foo.h"

    __attribute__((__visibility__("default"))) void bar(void)
    {
        ...
        foo();
        ...
    }

Assuming both foo.c and bar.c are compiled with "-flto
-fvisibility=hidden -c" and then the resulting
objects are linked with "-flto":

1. Is it reasonable to expect that every invocation of foo() would be inlined?
2. Is it reasonable to expect that the definition for foo() would
never be emitted out-of-line (unless
    f.e. a pointer to foo was taken)?
3. Will warnings be emitted if foo() can't be inlined?

Thanks,
Aaloan

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-27 23:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-27 23:44 always_inline and LTO Al K

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).