Re: Patch: Remove gcc dependency in definition of inline functions - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Patch: Remove gcc dependency in definition of inline functions
Date
Msg-id 5046.1260980519@sss.pgh.pa.us
Whole thread Raw
In response to Re: Patch: Remove gcc dependency in definition of inline functions  (Marko Kreen <markokr@gmail.com>)
Responses Re: Patch: Remove gcc dependency in definition of inline functions  (Kurt Harriman <harriman@acm.org>)
List pgsql-hackers
Marko Kreen <markokr@gmail.com> writes:
> On 12/15/09, Kurt Harriman <harriman@acm.org> wrote:
>> Attached is a revised patch, offered for the 2010-01 commitfest.
>> It's also available in my git repository in the "submitted" branch:
>> 
>> http://git.postgresql.org/gitweb?p=users/harriman/share.git;a=shortlog;h=refs/heads/submitted

> -1.  The PG_INLINE is ugly.

FWIW, I think the patch is largely OK, except for the autoconf hackery
which I'm not the best-qualified person to opine on.  I would only
suggest that the cleanest coding would be
#ifdef USE_INLINE
static inline foo(...) ...
#else
... non-inline definition of foo
#endif

ie, go ahead and rely on autoconf's definition (if any) of "inline"
and add a policy symbol USE_INLINE to determine whether to use it.
The proposed PG_INLINE coding conflates the symbol needed in the code
with the policy choice.

Another possibility would be to call the policy symbol HAVE_INLINE,
but that (a) risks collision with a name defined by autoconf built-in
macros, and (b) looks like it merely indicates whether the compiler
*has* inline, not that we have made a choice about how to use it.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Scott Bailey
Date:
Subject: Re: idea - new aggregates median, listagg
Next
From: Marko Kreen
Date:
Subject: Re: Patch: Remove gcc dependency in definition of inline functions