From 3a6dea7ddfcf5cfdba6ae3ff01bf884491e1133c Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 15 Sep 2026 08:43:09 +0200 Subject: [PATCH v2 2/8] Use unconstify_constexpr Add uses of unconstify_constexpr were appropriate. --- src/backend/tcop/dest.c | 2 +- src/backend/utils/adt/numeric.c | 12 ++++++------ src/pl/plpython/plpy_cursorobject.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/backend/tcop/dest.c b/src/backend/tcop/dest.c index bdc3dad3357..4c2b5b87522 100644 --- a/src/backend/tcop/dest.c +++ b/src/backend/tcop/dest.c @@ -93,7 +93,7 @@ static const DestReceiver spi_printtupDR = { * It's ok to cast the constness away as any modification of the none receiver * would be a bug (which gets easier to catch this way). */ -DestReceiver *None_Receiver = (DestReceiver *) &donothingDR; +DestReceiver *None_Receiver = unconstify_constexpr(DestReceiver *, &donothingDR); /* ---------------- * BeginCommand - initialize the destination at start of command diff --git a/src/backend/utils/adt/numeric.c b/src/backend/utils/adt/numeric.c index 37f24e33857..ede77bde485 100644 --- a/src/backend/utils/adt/numeric.c +++ b/src/backend/utils/adt/numeric.c @@ -415,18 +415,18 @@ typedef struct NumericSumAccum */ static const NumericDigit const_zero_data[1] = {0}; static const NumericVar const_zero = -{0, 0, NUMERIC_POS, 0, NULL, (NumericDigit *) const_zero_data}; +{0, 0, NUMERIC_POS, 0, NULL, unconstify_constexpr(NumericDigit *, const_zero_data)}; static const NumericDigit const_one_data[1] = {1}; static const NumericVar const_one = -{1, 0, NUMERIC_POS, 0, NULL, (NumericDigit *) const_one_data}; +{1, 0, NUMERIC_POS, 0, NULL, unconstify_constexpr(NumericDigit *, const_one_data)}; static const NumericVar const_minus_one = -{1, 0, NUMERIC_NEG, 0, NULL, (NumericDigit *) const_one_data}; +{1, 0, NUMERIC_NEG, 0, NULL, unconstify_constexpr(NumericDigit *, const_one_data)}; static const NumericDigit const_two_data[1] = {2}; static const NumericVar const_two = -{1, 0, NUMERIC_POS, 0, NULL, (NumericDigit *) const_two_data}; +{1, 0, NUMERIC_POS, 0, NULL, unconstify_constexpr(NumericDigit *, const_two_data)}; #if DEC_DIGITS == 4 static const NumericDigit const_zero_point_nine_data[1] = {9000}; @@ -436,7 +436,7 @@ static const NumericDigit const_zero_point_nine_data[1] = {90}; static const NumericDigit const_zero_point_nine_data[1] = {9}; #endif static const NumericVar const_zero_point_nine = -{1, -1, NUMERIC_POS, 1, NULL, (NumericDigit *) const_zero_point_nine_data}; +{1, -1, NUMERIC_POS, 1, NULL, unconstify_constexpr(NumericDigit *, const_zero_point_nine_data)}; #if DEC_DIGITS == 4 static const NumericDigit const_one_point_one_data[2] = {1, 1000}; @@ -446,7 +446,7 @@ static const NumericDigit const_one_point_one_data[2] = {1, 10}; static const NumericDigit const_one_point_one_data[2] = {1, 1}; #endif static const NumericVar const_one_point_one = -{2, 0, NUMERIC_POS, 1, NULL, (NumericDigit *) const_one_point_one_data}; +{2, 0, NUMERIC_POS, 1, NULL, unconstify_constexpr(NumericDigit *, const_one_point_one_data)}; static const NumericVar const_nan = {0, 0, NUMERIC_NAN, 0, NULL, NULL}; diff --git a/src/pl/plpython/plpy_cursorobject.c b/src/pl/plpython/plpy_cursorobject.c index 054dc97db1b..8d29e4725b2 100644 --- a/src/pl/plpython/plpy_cursorobject.c +++ b/src/pl/plpython/plpy_cursorobject.c @@ -39,7 +39,7 @@ static PyType_Slot PLyCursor_slots[] = Py_tp_dealloc, PLy_cursor_dealloc }, { - Py_tp_doc, (char *) PLy_cursor_doc + Py_tp_doc, unconstify_constexpr(char *, PLy_cursor_doc) }, { Py_tp_iter, PyObject_SelfIter -- 2.55.0