limit gnu_inline hack to macos

some linux programs (kernel) really want to have 'extern inline'
functions be visible from other units, i.e. not be static, but also
mark them as always_inline.  That's -fgnu89-inline semantics, so it's
fine, but we don't (yet) implement this, so we can't make them static
just so.  But we do need this hack on MacOS due to some uses in
system headers (see commit f18f8651).

So, for now conditionalize the hack on Mach-O.
This commit is contained in:
Michael Matz 2020-06-21 02:03:46 +02:00
parent c883d43ae5
commit ba8980f492

View File

@ -8229,6 +8229,7 @@ static int decl0(int l, int is_for_loop_init, Sym *func_sym)
sym = type.ref;
if (sym->f.func_type == FUNC_OLD && l == VT_CONST)
decl0(VT_CMP, 0, sym);
#ifdef TCC_TARGET_MACHO
if (sym->f.func_alwinl
&& ((type.t & (VT_EXTERN | VT_INLINE))
== (VT_EXTERN | VT_INLINE))) {
@ -8239,6 +8240,7 @@ static int decl0(int l, int is_for_loop_init, Sym *func_sym)
type.t &= ~VT_EXTERN;
type.t |= VT_STATIC;
}
#endif
/* always compile 'extern inline' */
if (type.t & VT_EXTERN)
type.t &= ~VT_INLINE;