Re: Patch: Remove gcc dependency in definition of inline functions

From: Marko Kreen <markokr(at)gmail(dot)com>
To: Kurt Harriman <harriman(at)acm(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Patch: Remove gcc dependency in definition of inline functions
Date: 2009-12-15 22:09:30
Message-ID: e51f66da0912151409l79a5528er8f0cfb5cd9ebd7c7@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 12/15/09, Kurt Harriman <harriman(at)acm(dot)org> wrote:
> On 12/15/2009 1:31 PM, Marko Kreen wrote:
>
> > Do you have actual proof that MSVC launches warnings on unused
> > "static inline" functions? Not "static", but "static inline".
>
> Yes, I tried it, and that's why I did it this way.

Oh. Ok then. Force-inline seems better fix as we may want to use
it for other reasons too (converting big macros).

So it seems like a good moment to solve it for gcc too.

Your worry ii) can be ignored, managing to compile on such
compilers is already overachievement.

> > If yes, indeed we need to fix it. MSVC is broken then, but it does
> > not matter as we need to work well on it. We can fix it with either
> > force-inline, or equivalent with gcc's __attribute__((unused)).
> >
>
> Microsoft doesn't support the gcc __attribute__ syntax, AFAIK.
>
> They have a few other gewgaws, like __declspec__, but I didn't
> find one that helps with this problem.

The question is now what should we put into configure and what into
headers.

Simplest would be to have plain AC_C_INLINE in configure
and then in header (c.h?):

#ifdef _MSC_VER
#undef inline
#define inline __forceinline
#else
#ifdef __GNUC__
#undef inline
#define inline inline __attribute__((always_inline))
#endif
#endif

(Not compile tested :)

Or should we put that logic also into configure,
so that the config.h already contains proper 'inline'?

Although fitting it into win32 buildsystem seems to be bit more
complex in that case...

--
marko

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bernd Helmle 2009-12-15 22:10:36 Re: [patch] executor and slru dtrace probes
Previous Message Jeff Davis 2009-12-15 22:02:07 Re: Range types