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

From Kurt Harriman
Subject Re: Patch: Remove gcc dependency in definition of inline functions
Date
Msg-id 4B54FE28.7080000@acm.org
Whole thread Raw
In response to Re: Patch: Remove gcc dependency in definition of inline functions  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: Patch: Remove gcc dependency in definition of inline functions  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Patch: Remove gcc dependency in definition of inline functions  (Peter Eisentraut <peter_e@gmx.net>)
List 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-specificlogic 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


pgsql-hackers by date:

Previous
From: Takahiro Itagaki
Date:
Subject: Re: Pretty printed trigger in psql
Next
From: Tom Lane
Date:
Subject: Re: Patch: Remove gcc dependency in definition of inline functions