Skip to content

Commit a9baeb3

Browse files
committed
Can't completely get rid of #ifndef FRONTEND in palloc.h :-(
pg_controldata includes postgres.h not postgres_fe.h, so utils/palloc.h must be able to compile in a "#define FRONTEND" context. It appears that Solaris Studio is smart enough to persuade us to define PG_USE_INLINE, but not smart enough to not make a copy of unreferenced static functions; which leads to an unsatisfied reference to CurrentMemoryContext. So we need an #ifndef FRONTEND around that declaration. Per buildfarm.
1 parent 5035701 commit a9baeb3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/include/utils/palloc.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,14 @@ extern void *repalloc_huge(void *pointer, Size size);
7575
* MemoryContextSwitchTo can't be a macro in standard C compilers.
7676
* But we can make it an inline function if the compiler supports it.
7777
* See STATIC_IF_INLINE in c.h.
78+
*
79+
* Although this header file is nominally backend-only, certain frontend
80+
* programs like pg_controldata include it via postgres.h. For some compilers
81+
* it's necessary to hide the inline definition of MemoryContextSwitchTo in
82+
* this scenario; hence the #ifndef FRONTEND.
7883
*/
7984

85+
#ifndef FRONTEND
8086
#ifndef PG_USE_INLINE
8187
extern MemoryContext MemoryContextSwitchTo(MemoryContext context);
8288
#endif /* !PG_USE_INLINE */
@@ -90,6 +96,7 @@ MemoryContextSwitchTo(MemoryContext context)
9096
return old;
9197
}
9298
#endif /* PG_USE_INLINE || MCXT_INCLUDE_DEFINITIONS */
99+
#endif /* FRONTEND */
93100

94101
/*
95102
* These are like standard strdup() except the copied string is

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy