From f83fe65f3fc1cae177f6c75f7b38eb951dd217b5 Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Wed, 24 Sep 2025 08:20:23 +0900 Subject: Fix compiler warnings in test_bitmapset The macros doing conversions of/from "text" from/to Bitmapset were using arbitrary casts with Datum, something that is not fine since 2a600a93c7be. These macros do not actually need casts with Datum, as they are given already "text" and Bitmapset data in input. They are updated to use cstring_to_text() and text_to_cstring(), fixing the compiler warnings reported by the buildfarm. Note that appending a -m32 to gcc to trigger 32-bit builds was enough to reproduce the warnings here. While on it, outer parenthesis are added to TEXT_TO_BITMAPSET(), and inner parenthesis are removed from BITMAPSET_TO_TEXT(), to make these macros more consistent with the style used in the tree, based on suggestions by Tom Lane. Oversights in commit 00c3d87a5cab. Reported-by: Tom Lane Author: Greg Burd Reviewed-by: Tom Lane Reviewed-by: Michael Paquier Discussion: https://postgr.es/m/3027069.1758606227@sss.pgh.pa.us --- src/test/modules/test_bitmapset/test_bitmapset.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/modules/test_bitmapset/test_bitmapset.c b/src/test/modules/test_bitmapset/test_bitmapset.c index 61f256f65a4..5bc4daa23f1 100644 --- a/src/test/modules/test_bitmapset/test_bitmapset.c +++ b/src/test/modules/test_bitmapset/test_bitmapset.c @@ -84,8 +84,8 @@ PG_FUNCTION_INFO_V1(test_random_operations); } while (0) /* Encode/Decode to/from TEXT and Bitmapset */ -#define BITMAPSET_TO_TEXT(bms) (text *) CStringGetTextDatum(nodeToString((bms))) -#define TEXT_TO_BITMAPSET(str) (Bitmapset *) stringToNode(TextDatumGetCString((Datum) (str))) +#define BITMAPSET_TO_TEXT(bms) cstring_to_text(nodeToString(bms)) +#define TEXT_TO_BITMAPSET(str) ((Bitmapset *) stringToNode(text_to_cstring(str))) /* * Individual test functions for each bitmapset API function -- cgit v1.2.3