diff --git a/src/include/utils/palloc.h b/src/include/utils/palloc.h index 61d03351d1..d99be84e2d 100644 --- a/src/include/utils/palloc.h +++ b/src/include/utils/palloc.h @@ -75,8 +75,14 @@ extern void *repalloc_huge(void *pointer, Size size); * MemoryContextSwitchTo can't be a macro in standard C compilers. * But we can make it an inline function if the compiler supports it. * See STATIC_IF_INLINE in c.h. + * + * Although this header file is nominally backend-only, certain frontend + * programs like pg_controldata include it via postgres.h. For some compilers + * it's necessary to hide the inline definition of MemoryContextSwitchTo in + * this scenario; hence the #ifndef FRONTEND. */ +#ifndef FRONTEND #ifndef PG_USE_INLINE extern MemoryContext MemoryContextSwitchTo(MemoryContext context); #endif /* !PG_USE_INLINE */ @@ -90,6 +96,7 @@ MemoryContextSwitchTo(MemoryContext context) return old; } #endif /* PG_USE_INLINE || MCXT_INCLUDE_DEFINITIONS */ +#endif /* FRONTEND */ /* * These are like standard strdup() except the copied string is