1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-29 23:43:17 +03:00

Support inlining various small performance-critical functions on non-GCC

compilers, by applying a configure check to see if the compiler will accept
an unreferenced "static inline foo ..." function without warnings.  It is
believed that such warnings are the only reason not to declare inlined
functions in headers, if the compiler understands "inline" at all.

Kurt Harriman
This commit is contained in:
Tom Lane
2010-02-13 02:34:16 +00:00
parent b95a720a48
commit e08ab7c312
11 changed files with 137 additions and 46 deletions

View File

@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mmgr/mcxt.c,v 1.68 2010/01/02 16:57:58 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/mmgr/mcxt.c,v 1.69 2010/02/13 02:34:12 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -628,11 +628,10 @@ repalloc(void *pointer, Size size)
* MemoryContextSwitchTo
* Returns the current context; installs the given context.
*
* This is inlined when using GCC.
*
* TODO: investigate supporting inlining for some non-GCC compilers.
* palloc.h defines an inline version of this function if allowed by the
* compiler; in which case the definition below is skipped.
*/
#ifndef __GNUC__
#ifndef USE_INLINE
MemoryContext
MemoryContextSwitchTo(MemoryContext context)
@@ -645,7 +644,7 @@ MemoryContextSwitchTo(MemoryContext context)
CurrentMemoryContext = context;
return old;
}
#endif /* ! __GNUC__ */
#endif /* ! USE_INLINE */
/*
* MemoryContextStrdup