public inbox for [email protected]help / color / mirror / Atom feed
[PATCH v1] gin: change remaining StaticAssertStmt() to StaticAssertDecl() 2+ messages / 1 participants [nested] [flat]
* [PATCH v1] gin: change remaining StaticAssertStmt() to StaticAssertDecl() @ 2026-04-09 11:10 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 2+ messages in thread From: Bertrand Drouvot @ 2026-04-09 11:10 UTC (permalink / raw) d50c86e74375 added a comment mentioning that StaticAssertStmt is deprecated but 6f5ad00ab763 made use of it. Fixing by replacing the StaticAssertStmt() by StaticAssertDecl() at file scope. Author: Bertrand Drouvot <[email protected]> --- src/backend/access/gin/ginutil.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 100.0% src/backend/access/gin/ diff --git a/src/backend/access/gin/ginutil.c b/src/backend/access/gin/ginutil.c index d3351fbe8a3..45d1a8fac9f 100644 --- a/src/backend/access/gin/ginutil.c +++ b/src/backend/access/gin/ginutil.c @@ -30,6 +30,8 @@ #include "utils/typcache.h" #include "lib/qunique.h" +/* GIN_CAT_NORM_KEY must be equal to 0 */ +StaticAssertDecl(GIN_CAT_NORM_KEY == 0, "Assuming GIN_CAT_NORM_KEY=0"); /* * GIN handler function: return IndexAmRoutine with access method parameters @@ -534,7 +536,6 @@ ginExtractEntries(GinState *ginstate, OffsetNumber attnum, /* * Create GinNullCategory representation. */ - StaticAssertStmt(GIN_CAT_NORM_KEY == 0, "Assuming GIN_CAT_NORM_KEY=0"); categories = palloc0_array(GinNullCategory, nentries + (hasNull ? 1 : 0)); /* Put back a NULL entry, if there were any */ -- 2.34.1 --U4l+Id+MMy3m7jIo-- ^ permalink raw reply [nested|flat] 2+ messages in thread
* [PATCH v2] gin: change remaining StaticAssertStmt() to StaticAssertDecl() @ 2026-04-13 10:29 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 2+ messages in thread From: Bertrand Drouvot @ 2026-04-13 10:29 UTC (permalink / raw) d50c86e74375 added a comment mentioning that StaticAssertStmt is deprecated but 6f5ad00ab763 made use of it. Fixing by replacing the StaticAssertStmt() by StaticAssertDecl(). Adding a comment to make it clear that this is connected to palloc0_array(). Add new braces to avoid warning from -Wdeclaration-after-statement. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Peter Eisentraut <[email protected]> Discussion: https://postgr.es/m/2a2f9cb0-f00d-413c-8517-4a3ad220d104%40eisentraut.org --- src/backend/access/gin/ginutil.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 100.0% src/backend/access/gin/ diff --git a/src/backend/access/gin/ginutil.c b/src/backend/access/gin/ginutil.c index d3351fbe8a3..76d162075a9 100644 --- a/src/backend/access/gin/ginutil.c +++ b/src/backend/access/gin/ginutil.c @@ -534,8 +534,11 @@ ginExtractEntries(GinState *ginstate, OffsetNumber attnum, /* * Create GinNullCategory representation. */ - StaticAssertStmt(GIN_CAT_NORM_KEY == 0, "Assuming GIN_CAT_NORM_KEY=0"); - categories = palloc0_array(GinNullCategory, nentries + (hasNull ? 1 : 0)); + { + /* Using palloc0_array requires GIN_CAT_NORM_KEY==0 */ + StaticAssertDecl(GIN_CAT_NORM_KEY == 0, "Assuming GIN_CAT_NORM_KEY=0"); + categories = palloc0_array(GinNullCategory, nentries + (hasNull ? 1 : 0)); + } /* Put back a NULL entry, if there were any */ if (hasNull) -- 2.34.1 --own3bwUg9UcwGn6A-- ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2026-04-13 10:29 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-04-09 11:10 [PATCH v1] gin: change remaining StaticAssertStmt() to StaticAssertDecl() Bertrand Drouvot <[email protected]> 2026-04-13 10:29 [PATCH v2] gin: change remaining StaticAssertStmt() to StaticAssertDecl() Bertrand Drouvot <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox