Rename C23 keyword

Started by Peter Eisentrautover 1 year ago3 messages
#1Peter Eisentraut
peter@eisentraut.org
1 attachment(s)

constexpr is a keyword in C23. Rename a conflicting identifier for
future-proofing.

Obviously, C23 is way in the future, but this is a hard error that
prevents any further exploration. (To be clear: This only happens if
you explicitly select C23 mode. I'm not aware of a compiler where this
is the default yet.)

Attachments:

0001-Rename-C23-keyword.patchtext/plain; charset=UTF-8; name=0001-Rename-C23-keyword.patchDownload
From fa0f5ce119bff1bafd9fd278334c5caad242b6d2 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Tue, 6 Aug 2024 09:51:20 +0200
Subject: [PATCH] Rename C23 keyword

constexpr is a keyword in C23.  Rename a conflicting identifier for
future-proofing.
---
 src/backend/optimizer/util/predtest.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/backend/optimizer/util/predtest.c b/src/backend/optimizer/util/predtest.c
index 6e3b376f3d3..50ea8077367 100644
--- a/src/backend/optimizer/util/predtest.c
+++ b/src/backend/optimizer/util/predtest.c
@@ -948,7 +948,7 @@ boolexpr_startup_fn(Node *clause, PredIterInfo info)
 typedef struct
 {
 	OpExpr		opexpr;
-	Const		constexpr;
+	Const		const_expr;
 	int			next_elem;
 	int			num_elems;
 	Datum	   *elem_values;
@@ -992,13 +992,13 @@ arrayconst_startup_fn(Node *clause, PredIterInfo info)
 	state->opexpr.args = list_copy(saop->args);
 
 	/* Set up a dummy Const node to hold the per-element values */
-	state->constexpr.xpr.type = T_Const;
-	state->constexpr.consttype = ARR_ELEMTYPE(arrayval);
-	state->constexpr.consttypmod = -1;
-	state->constexpr.constcollid = arrayconst->constcollid;
-	state->constexpr.constlen = elmlen;
-	state->constexpr.constbyval = elmbyval;
-	lsecond(state->opexpr.args) = &state->constexpr;
+	state->const_expr.xpr.type = T_Const;
+	state->const_expr.consttype = ARR_ELEMTYPE(arrayval);
+	state->const_expr.consttypmod = -1;
+	state->const_expr.constcollid = arrayconst->constcollid;
+	state->const_expr.constlen = elmlen;
+	state->const_expr.constbyval = elmbyval;
+	lsecond(state->opexpr.args) = &state->const_expr;
 
 	/* Initialize iteration state */
 	state->next_elem = 0;
@@ -1011,8 +1011,8 @@ arrayconst_next_fn(PredIterInfo info)
 
 	if (state->next_elem >= state->num_elems)
 		return NULL;
-	state->constexpr.constvalue = state->elem_values[state->next_elem];
-	state->constexpr.constisnull = state->elem_nulls[state->next_elem];
+	state->const_expr.constvalue = state->elem_values[state->next_elem];
+	state->const_expr.constisnull = state->elem_nulls[state->next_elem];
 	state->next_elem++;
 	return (Node *) &(state->opexpr);
 }
-- 
2.46.0

#2Robert Haas
robertmhaas@gmail.com
In reply to: Peter Eisentraut (#1)
Re: Rename C23 keyword

On Tue, Aug 6, 2024 at 4:04 AM Peter Eisentraut <peter@eisentraut.org> wrote:

constexpr is a keyword in C23. Rename a conflicting identifier for
future-proofing.

Obviously, C23 is way in the future, but this is a hard error that
prevents any further exploration. (To be clear: This only happens if
you explicitly select C23 mode. I'm not aware of a compiler where this
is the default yet.)

This seems fine.

--
Robert Haas
EDB: http://www.enterprisedb.com

#3Peter Eisentraut
peter@eisentraut.org
In reply to: Robert Haas (#2)
Re: Rename C23 keyword

On 06.08.24 16:00, Robert Haas wrote:

On Tue, Aug 6, 2024 at 4:04 AM Peter Eisentraut <peter@eisentraut.org> wrote:

constexpr is a keyword in C23. Rename a conflicting identifier for
future-proofing.

Obviously, C23 is way in the future, but this is a hard error that
prevents any further exploration. (To be clear: This only happens if
you explicitly select C23 mode. I'm not aware of a compiler where this
is the default yet.)

This seems fine.

committed