This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [lto][patch] Use "extern inline" instead of "static inline"
- From: Rafael Espindola <espindola at google dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Diego Novillo <dnovillo at google dot com>, Simon Baldwin <simonb at google dot com>
- Date: Wed, 18 Feb 2009 11:42:50 +0000
- Subject: Re: [lto][patch] Use "extern inline" instead of "static inline"
- References: <38a0d8450902180254r402d445cu655b12b581e4e560@mail.gmail.com>
Some extra context:
Without this patch we transform cherry picked functions into static
inline. If we cherry pick the same function into two or more files, we
will have multiple static functions corresponding to the original
static one. This is usually fine, since those functions are normally
used for inlining and then dropped. This is not the case if one the
file uses the function as a value since then the static function will
not dropped.
What the attached testcase does is have two function in different
files return pointers to what should be the same function "bar".
Without the patch the inliner will produce two static functions and
the pointers will be different.
Using extern inline solves the problem, since the compiler will drop
the function and use external references after inlining.
Cheers,
--
Rafael Avila de Espindola
Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047