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 4B7271A6.4060501@acm.org
Whole thread Raw
In response to Re: Patch: Remove gcc dependency in definition of inline functions  (Kurt Harriman <harriman@acm.org>)
Responses Re: Patch: Remove gcc dependency in definition of inline functions
List pgsql-hackers
Revised patch is attached (3rd edition).
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

With this patch, the "configure" script tests whether a static
inline function can be defined without incurring a warning when
not referenced.  If successful, the preprocessor symbol
inline_quietly is defined in pg_config.h to the appropriate
keyword: inline, __inline, or __inline__.
Otherwise inline_quietly remains undefined.

palloc.h and pg_list.h condition their inline function
definitions on inline_quietly instead of the gcc-specific __GNUC__.
Thus the functions can be inlined on more platforms, not only gcc.

Ordinary out-of-line calls are still used if the compiler doesn't
recognize inline functions, or spews warnings when static inline
functions are defined but not referenced.

Changes since the previous edition of this patch:

- Renamed the new preprocessor symbol to "inline_quietly" instead
   of PG_INLINE.  inline_quietly is more descriptive, and shows up
   when grepping for "inline".

- Removed MSVC-related changes (__forceinline) from the autoconf
   stuff.  Instead, updated the manually-edited pg_config.h.win32
   file to define both "inline" and "inline_quietly" as __inline.

- Removed Windows-only misspelling of __inline__ in instr_time.h.
   This was the only occurrence of __inline__; therefore, deleted
   the no-longer-needed definition of __inline__ from port/win32.h.
   Also deleted the definition of inline from port/win32.h, since
   it is now defined in pg_config.h.win32, consistent with the
   other platforms.

Thanks to all who commented.

Regards,
... kurt

Attachment

pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Failed assertion during recovery of partial WAL file
Next
From: Kurt Harriman
Date:
Subject: Re: Patch: Remove gcc dependency in definition of inline functions