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

From: Kurt Harriman <harriman(at)acm(dot)org>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Patch: Remove gcc dependency in definition of inline functions
Date: 2010-01-19 00:34:48
Message-ID: 4B54FE28.7080000@acm.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 1/18/2010 1:20 PM, Peter Eisentraut wrote:
> I seem to recall that somewhere else it was said that MSVC produces
> warnings on unused static inline functions. Am I mistaken?

MSVC does warn about unused static inline functions. The warning
is prevented by using __forceinline instead of __inline.

> Also, if this is mainly for the benefit of MSVC, we don't really need a
> configure check, do we?

A configure check seems worthwhile regardless of MSVC.

No doubt other compilers, yet unknown, will be discovered to spew
alarm upon unreferenced static inline functions. To address the
difficulty of testing innumerable present and future platforms,
it seems there are three alternatives:

a) Wait for complaints, then craft compiler-specific patches and
backpatches.

b) Keep the existing compiler-specific logic to enable inlining
for gcc alone. Craft additional compiler-specific logic for
each additional trusted and sufficiently important compiler.

c) Use configure to automate the testing of each build environment
in situ.

The third alternative adapts to new or little-known platforms
with little or no manual intervention. It factors platform
dependencies out of the code, centralizing them into the
build system.

It is true that configure doesn't need to test for MSVC's
__forceinline keyword. I included that mainly as a placeholder
for the benefit of future hackers: likely someone will
discover a need for a special keyword to suppress another
compiler's warnings. With __forceinine as an example,
and the looping logic already in place, it's easy to add an
alternative keyword to the list without having to become an
autoconf expert. It doesn't make configure slower, since
gcc succeeds on the first iteration without trying the
__forceinline alternative.

Regards,
... kurt

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Takahiro Itagaki 2010-01-19 00:40:07 Re: Pretty printed trigger in psql
Previous Message Peter Eisentraut 2010-01-18 23:49:49 create composite type error message