[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] inline functions

From: Thomas Preud'homme
Subject: Re: [Tinycc-devel] inline functions
Date: Wed, 11 Dec 2013 11:43:28 +0800
User-agent: KMail/4.11.3 (Linux/2.6.38-ac2-ac100; KDE/4.11.3; armv7l; ; )

Le mercredi 11 décembre 2013, 11:33:38 Thomas Preud'homme a écrit :
> Le mardi 10 décembre 2013, 14:59:03 Pierre a écrit :
> > Hello,
> > 
> > About TCC inline functions, the default storage class is extern, is it a
> > choice ?

So in fact it seems it is a choice yes but it should appear only once. See the 
code (and the comment) around line 3856 in tccgen.c:

        if ((s->type.t & (VT_STATIC | VT_INLINE | VT_BTYPE)) ==
            (VT_STATIC | VT_INLINE | VT_FUNC)) {
            /* if referencing an inline function, then we generate a
               symbol to it if not already done. It will have the
               effect to generate code for it at the end of the
               compilation unit. Inline function as always
               generated in the text section. */
            if (!s->c)
                put_extern_sym(s, text_section, 0, 0);
            r = VT_SYM | VT_CONST;
        } else {
            r = s->r;

I guess this code only works within a compilation unit. It seems the goal of 
this code was to avoid generating code for an inline function that is unused 
according to the log message for the commit adding these line.

Best regards,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]