Hi,
Christoph Berg, on IRC, raised the issue that at least one extension
failed compiling in v11. The extension currently does:
https://github.com/pgq/pgq/blob/master/triggers/common.c#L225
tbl_cache_ctx = AllocSetContextCreate(TopMemoryContext,
"pgq_triggers table info",
ALLOCSET_SMALL_MINSIZE,
ALLOCSET_SMALL_INITSIZE,
ALLOCSET_SMALL_MAXSIZE);
which makes sense, because it has to support versions below 9.6, which
introduced ALLOCSET_SMALL_SIZES etc.
But 9fa6f00b1308dd10da4eca2f31ccbfc7b35bb461 / Rethink MemoryContext creation to improve performance
causes this to fail to compile because since then AllocSetContextCreate
is declared to have three parameters:
#ifdef HAVE__BUILTIN_CONSTANT_P
#define AllocSetContextCreate(parent, name, allocparams) \
(StaticAssertExpr(__builtin_constant_p(name), \
"memory context names must be constant strings"), \
AllocSetContextCreateExtended(parent, name, allocparams))
#else
#define AllocSetContextCreate(parent, name, allocparams) \
AllocSetContextCreateExtended(parent, name, allocparams)
#endif
which means it only compiles if ALLOCSET_*_SIZES is passed, rather than
individual parameters.
I think we should fix that. If the goal was to only allow passing the
*SIZES parameters, we should have called it out as that.
Based on a quick look, ISTM the easiest fix is to have the
AllocSetContextCreate accept five parameters, and move it below the
ALLOCSET_*_SIZES macros. That way they should be expanded before
AllocSetContextCreate(), and thus 5 params should be fine.
Greetings,
Andres Freund