There are many PG_GETARG_* calls, mostly around gin, gist, spgist code,
that are commented out, presumably to indicate that the argument is
unused and to indicate that it wasn't forgotten or miscounted. Example:
...
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
/* Oid subtype = PG_GETARG_OID(3); */
bool *recheck = (bool *) PG_GETARG_POINTER(4);
...
But keeping commented-out code updated with refactorings and style
changes is annoying. (Also note that pgindent forces the blank line.)
One way to address this is to de-comment that code but instead mark the
variables unused. That way the compiler can check the code, and the
purpose is clear to a reader. Example:
pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
(This is the correct placement of the attribute under forward-looking
C23 alignment.)
I have attached a patch for that.
An alternative is to just delete that code. (No patch attached, but you
can imagine it.)
Some particular curious things to check in the patch:
- In contrib/hstore/hstore_gin.c, if I activate the commented out code,
it causes test failures in the hstore test. So the commented out code
is somehow wrong, which seems bad. Also, maybe there is more wrong code
like that, but which doesn't trigger test failures right now?
- In src/backend/utils/adt/jsonfuncs.c, those calls, if activated, are
happening before null checks, so they are not correct. Also, the "in"
variable is shadowed later. So here, deleting the incorrect code is
probably the best solution in any case.
- In doc/src/sgml/gist.sgml, this is the source of the pattern, it
actually documents that you should write your functions with the
commented out code. We should think about an alternative way to
document this. I don't see the "subtype" argument documented anywhere
in the vicinity of this, so I don't know what the best advice would be.
Just silently skipping an argument number might be confusing here.
Thoughts?
From e7c5061c2b65f39eb22434ce2acd6ce71b3e8321 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <[email protected]>
Date: Fri, 5 Dec 2025 16:16:18 +0100
Subject: [PATCH] Mark commented out code as unused
There were many PG_GETARG_* calls, mostly around gin, gist, spgist
code, that were commented out, presumably to indicate that the
argument was unused and to indicate that it wasn't forgotten or
miscounted. But keeping commented-out code updated with refactorings
and style changes is annoying. So this commit proposes to de-comment
that code but instead mark the variables unused.
XXX An alternative is to just delete that code.
XXX Check in particular:
- contrib/hstore/hstore_gin.c: Activating this code causes test
failures in the hstore test.
- src/backend/utils/adt/jsonfuncs.c: These calls, if activated, are
happening before null checks, so they are not correct. Also, the "in"
variable is shadowed later.
- doc/src/sgml/gist.sgml: Think about how to document this. I don't
see the "subtype" argument documented anywhere.
---
contrib/btree_gist/btree_bit.c | 3 +--
contrib/btree_gist/btree_bool.c | 3 +--
contrib/btree_gist/btree_bytea.c | 3 +--
contrib/btree_gist/btree_cash.c | 6 ++---
contrib/btree_gist/btree_date.c | 6 ++---
contrib/btree_gist/btree_enum.c | 3 +--
contrib/btree_gist/btree_float4.c | 6 ++---
contrib/btree_gist/btree_float8.c | 6 ++---
contrib/btree_gist/btree_inet.c | 3 +--
contrib/btree_gist/btree_int2.c | 6 ++---
contrib/btree_gist/btree_int4.c | 6 ++---
contrib/btree_gist/btree_int8.c | 6 ++---
contrib/btree_gist/btree_interval.c | 6 ++---
contrib/btree_gist/btree_macaddr.c | 3 +--
contrib/btree_gist/btree_macaddr8.c | 3 +--
contrib/btree_gist/btree_numeric.c | 3 +--
contrib/btree_gist/btree_oid.c | 6 ++---
contrib/btree_gist/btree_text.c | 6 ++---
contrib/btree_gist/btree_time.c | 9 +++-----
contrib/btree_gist/btree_ts.c | 12 ++++------
contrib/btree_gist/btree_uuid.c | 3 +--
contrib/cube/cube.c | 3 +--
contrib/hstore/hstore_gin.c | 6 ++---
contrib/hstore/hstore_gist.c | 3 +--
contrib/intarray/_int_gin.c | 3 +--
contrib/intarray/_int_gist.c | 3 +--
contrib/intarray/_intbig_gist.c | 3 +--
contrib/ltree/_ltree_gist.c | 3 +--
contrib/ltree/ltree_gist.c | 3 +--
contrib/pg_trgm/trgm_gin.c | 12 ++++------
contrib/pg_trgm/trgm_gist.c | 6 ++---
contrib/seg/seg.c | 3 +--
doc/src/sgml/gist.sgml | 6 ++---
src/backend/access/gin/ginarrayproc.c | 22 +++++++------------
src/backend/access/gist/gistproc.c | 20 ++++++-----------
src/backend/access/spgist/spgkdtreeproc.c | 2 +-
src/backend/access/spgist/spgquadtreeproc.c | 2 +-
src/backend/access/spgist/spgtextproc.c | 2 +-
src/backend/utils/adt/datum.c | 2 +-
src/backend/utils/adt/jsonb_gin.c | 12 ++++------
src/backend/utils/adt/jsonfuncs.c | 4 ----
src/backend/utils/adt/network_gist.c | 3 +--
src/backend/utils/adt/network_spgist.c | 2 +-
src/backend/utils/adt/rangetypes_spgist.c | 2 +-
src/backend/utils/adt/tsginidx.c | 19 ++++++----------
src/backend/utils/adt/tsgistidx.c | 5 ++---
src/backend/utils/adt/tsquery_gist.c | 3 +--
src/backend/utils/adt/varlena.c | 2 +-
.../modules/spgist_name_ops/spgist_name_ops.c | 2 +-
49 files changed, 93 insertions(+), 173 deletions(-)
diff --git a/contrib/btree_gist/btree_bit.c b/contrib/btree_gist/btree_bit.c
index 9199f886097..617b15b1431 100644
--- a/contrib/btree_gist/btree_bit.c
+++ b/contrib/btree_gist/btree_bit.c
@@ -139,8 +139,7 @@ gbt_bit_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
void *query = DatumGetByteaP(PG_GETARG_DATUM(1));
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
bool retval;
GBT_VARKEY *key = (GBT_VARKEY *) DatumGetPointer(entry->key);
diff --git a/contrib/btree_gist/btree_bool.c b/contrib/btree_gist/btree_bool.c
index 344f059c78f..a0b43f51b39 100644
--- a/contrib/btree_gist/btree_bool.c
+++ b/contrib/btree_gist/btree_bool.c
@@ -108,8 +108,7 @@ gbt_bool_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
bool query = PG_GETARG_INT16(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
boolKEY *kkk = (boolKEY *) DatumGetPointer(entry->key);
GBT_NUMKEY_R key;
diff --git a/contrib/btree_gist/btree_bytea.c b/contrib/btree_gist/btree_bytea.c
index 26f8710fad5..6f0e2ea4b6a 100644
--- a/contrib/btree_gist/btree_bytea.c
+++ b/contrib/btree_gist/btree_bytea.c
@@ -101,8 +101,7 @@ gbt_bytea_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
void *query = DatumGetByteaP(PG_GETARG_DATUM(1));
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
bool retval;
GBT_VARKEY *key = (GBT_VARKEY *) DatumGetPointer(entry->key);
diff --git a/contrib/btree_gist/btree_cash.c b/contrib/btree_gist/btree_cash.c
index 282d5c5731f..1a45bf910e4 100644
--- a/contrib/btree_gist/btree_cash.c
+++ b/contrib/btree_gist/btree_cash.c
@@ -139,8 +139,7 @@ gbt_cash_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
Cash query = PG_GETARG_CASH(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
cashKEY *kkk = (cashKEY *) DatumGetPointer(entry->key);
GBT_NUMKEY_R key;
@@ -161,8 +160,7 @@ gbt_cash_distance(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
Cash query = PG_GETARG_CASH(1);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
cashKEY *kkk = (cashKEY *) DatumGetPointer(entry->key);
GBT_NUMKEY_R key;
diff --git a/contrib/btree_gist/btree_date.c b/contrib/btree_gist/btree_date.c
index 1f1a3f32b56..817fa0a21a1 100644
--- a/contrib/btree_gist/btree_date.c
+++ b/contrib/btree_gist/btree_date.c
@@ -154,8 +154,7 @@ gbt_date_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
DateADT query = PG_GETARG_DATEADT(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
dateKEY *kkk = (dateKEY *) DatumGetPointer(entry->key);
GBT_NUMKEY_R key;
@@ -176,8 +175,7 @@ gbt_date_distance(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
DateADT query = PG_GETARG_DATEADT(1);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
dateKEY *kkk = (dateKEY *) DatumGetPointer(entry->key);
GBT_NUMKEY_R key;
diff --git a/contrib/btree_gist/btree_enum.c b/contrib/btree_gist/btree_enum.c
index 8f1ffff4696..ae4fb4ceab8 100644
--- a/contrib/btree_gist/btree_enum.c
+++ b/contrib/btree_gist/btree_enum.c
@@ -126,8 +126,7 @@ gbt_enum_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
Oid query = PG_GETARG_OID(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
oidKEY *kkk = (oidKEY *) DatumGetPointer(entry->key);
GBT_NUMKEY_R key;
diff --git a/contrib/btree_gist/btree_float4.c
b/contrib/btree_gist/btree_float4.c
index d9c859835da..560ac54e794 100644
--- a/contrib/btree_gist/btree_float4.c
+++ b/contrib/btree_gist/btree_float4.c
@@ -133,8 +133,7 @@ gbt_float4_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
float4 query = PG_GETARG_FLOAT4(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
float4KEY *kkk = (float4KEY *) DatumGetPointer(entry->key);
GBT_NUMKEY_R key;
@@ -155,8 +154,7 @@ gbt_float4_distance(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
float4 query = PG_GETARG_FLOAT4(1);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
float4KEY *kkk = (float4KEY *) DatumGetPointer(entry->key);
GBT_NUMKEY_R key;
diff --git a/contrib/btree_gist/btree_float8.c
b/contrib/btree_gist/btree_float8.c
index 567beede178..063ffa10f8c 100644
--- a/contrib/btree_gist/btree_float8.c
+++ b/contrib/btree_gist/btree_float8.c
@@ -141,8 +141,7 @@ gbt_float8_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
float8 query = PG_GETARG_FLOAT8(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
float8KEY *kkk = (float8KEY *) DatumGetPointer(entry->key);
GBT_NUMKEY_R key;
@@ -163,8 +162,7 @@ gbt_float8_distance(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
float8 query = PG_GETARG_FLOAT8(1);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
float8KEY *kkk = (float8KEY *) DatumGetPointer(entry->key);
GBT_NUMKEY_R key;
diff --git a/contrib/btree_gist/btree_inet.c b/contrib/btree_gist/btree_inet.c
index e726375f61d..c62cfa82b01 100644
--- a/contrib/btree_gist/btree_inet.c
+++ b/contrib/btree_gist/btree_inet.c
@@ -120,8 +120,7 @@ gbt_inet_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
Datum dquery = PG_GETARG_DATUM(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
inetKEY *kkk = (inetKEY *) DatumGetPointer(entry->key);
GBT_NUMKEY_R key;
diff --git a/contrib/btree_gist/btree_int2.c b/contrib/btree_gist/btree_int2.c
index faf456997bb..30ef877e70f 100644
--- a/contrib/btree_gist/btree_int2.c
+++ b/contrib/btree_gist/btree_int2.c
@@ -139,8 +139,7 @@ gbt_int2_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
int16 query = PG_GETARG_INT16(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
int16KEY *kkk = (int16KEY *) DatumGetPointer(entry->key);
GBT_NUMKEY_R key;
@@ -160,8 +159,7 @@ gbt_int2_distance(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
int16 query = PG_GETARG_INT16(1);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
int16KEY *kkk = (int16KEY *) DatumGetPointer(entry->key);
GBT_NUMKEY_R key;
diff --git a/contrib/btree_gist/btree_int4.c b/contrib/btree_gist/btree_int4.c
index 0bdb9e58c56..c934558d40d 100644
--- a/contrib/btree_gist/btree_int4.c
+++ b/contrib/btree_gist/btree_int4.c
@@ -137,8 +137,7 @@ gbt_int4_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
int32 query = PG_GETARG_INT32(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
int32KEY *kkk = (int32KEY *) DatumGetPointer(entry->key);
GBT_NUMKEY_R key;
@@ -158,8 +157,7 @@ gbt_int4_distance(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
int32 query = PG_GETARG_INT32(1);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
int32KEY *kkk = (int32KEY *) DatumGetPointer(entry->key);
GBT_NUMKEY_R key;
diff --git a/contrib/btree_gist/btree_int8.c b/contrib/btree_gist/btree_int8.c
index a9a7b569278..19e6a9662c0 100644
--- a/contrib/btree_gist/btree_int8.c
+++ b/contrib/btree_gist/btree_int8.c
@@ -139,8 +139,7 @@ gbt_int8_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
int64 query = PG_GETARG_INT64(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
int64KEY *kkk = (int64KEY *) DatumGetPointer(entry->key);
GBT_NUMKEY_R key;
@@ -160,8 +159,7 @@ gbt_int8_distance(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
int64 query = PG_GETARG_INT64(1);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
int64KEY *kkk = (int64KEY *) DatumGetPointer(entry->key);
GBT_NUMKEY_R key;
diff --git a/contrib/btree_gist/btree_interval.c
b/contrib/btree_gist/btree_interval.c
index 1fc27f60384..8a0b7c3dc0a 100644
--- a/contrib/btree_gist/btree_interval.c
+++ b/contrib/btree_gist/btree_interval.c
@@ -211,8 +211,7 @@ gbt_intv_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
Interval *query = PG_GETARG_INTERVAL_P(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
intvKEY *kkk = (intvKEY *) DatumGetPointer(entry->key);
GBT_NUMKEY_R key;
@@ -233,8 +232,7 @@ gbt_intv_distance(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
Interval *query = PG_GETARG_INTERVAL_P(1);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
intvKEY *kkk = (intvKEY *) DatumGetPointer(entry->key);
GBT_NUMKEY_R key;
diff --git a/contrib/btree_gist/btree_macaddr.c
b/contrib/btree_gist/btree_macaddr.c
index c444a709853..8274a081a69 100644
--- a/contrib/btree_gist/btree_macaddr.c
+++ b/contrib/btree_gist/btree_macaddr.c
@@ -126,8 +126,7 @@ gbt_macad_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
macaddr *query = (macaddr *) PG_GETARG_POINTER(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
macKEY *kkk = (macKEY *) DatumGetPointer(entry->key);
GBT_NUMKEY_R key;
diff --git a/contrib/btree_gist/btree_macaddr8.c
b/contrib/btree_gist/btree_macaddr8.c
index 6d9837d90a3..efef9a5487e 100644
--- a/contrib/btree_gist/btree_macaddr8.c
+++ b/contrib/btree_gist/btree_macaddr8.c
@@ -125,8 +125,7 @@ gbt_macad8_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
macaddr8 *query = (macaddr8 *) PG_GETARG_POINTER(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
mac8KEY *kkk = (mac8KEY *) DatumGetPointer(entry->key);
GBT_NUMKEY_R key;
diff --git a/contrib/btree_gist/btree_numeric.c
b/contrib/btree_gist/btree_numeric.c
index 052f27b0794..3f97dbdfd34 100644
--- a/contrib/btree_gist/btree_numeric.c
+++ b/contrib/btree_gist/btree_numeric.c
@@ -107,8 +107,7 @@ gbt_numeric_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
void *query = DatumGetNumeric(PG_GETARG_DATUM(1));
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
bool retval;
GBT_VARKEY *key = (GBT_VARKEY *) DatumGetPointer(entry->key);
diff --git a/contrib/btree_gist/btree_oid.c b/contrib/btree_gist/btree_oid.c
index b8f2f661076..a46c7d3aa6b 100644
--- a/contrib/btree_gist/btree_oid.c
+++ b/contrib/btree_gist/btree_oid.c
@@ -139,8 +139,7 @@ gbt_oid_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
Oid query = PG_GETARG_OID(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
oidKEY *kkk = (oidKEY *) DatumGetPointer(entry->key);
GBT_NUMKEY_R key;
@@ -160,8 +159,7 @@ gbt_oid_distance(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
Oid query = PG_GETARG_OID(1);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
oidKEY *kkk = (oidKEY *) DatumGetPointer(entry->key);
GBT_NUMKEY_R key;
diff --git a/contrib/btree_gist/btree_text.c b/contrib/btree_gist/btree_text.c
index ddee42504a1..3712d270b39 100644
--- a/contrib/btree_gist/btree_text.c
+++ b/contrib/btree_gist/btree_text.c
@@ -193,8 +193,7 @@ gbt_text_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
void *query = DatumGetTextP(PG_GETARG_DATUM(1));
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
bool retval;
GBT_VARKEY *key = (GBT_VARKEY *) DatumGetPointer(entry->key);
@@ -220,8 +219,7 @@ gbt_bpchar_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
void *query = DatumGetTextP(PG_GETARG_DATUM(1));
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
bool retval;
GBT_VARKEY *key = (GBT_VARKEY *) DatumGetPointer(entry->key);
diff --git a/contrib/btree_gist/btree_time.c b/contrib/btree_gist/btree_time.c
index e744f1be017..138e64ee72c 100644
--- a/contrib/btree_gist/btree_time.c
+++ b/contrib/btree_gist/btree_time.c
@@ -194,8 +194,7 @@ gbt_time_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
TimeADT query = PG_GETARG_TIMEADT(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
timeKEY *kkk = (timeKEY *) DatumGetPointer(entry->key);
GBT_NUMKEY_R key;
@@ -215,8 +214,7 @@ gbt_time_distance(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
TimeADT query = PG_GETARG_TIMEADT(1);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
timeKEY *kkk = (timeKEY *) DatumGetPointer(entry->key);
GBT_NUMKEY_R key;
@@ -233,8 +231,7 @@ gbt_timetz_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
TimeTzADT *query = PG_GETARG_TIMETZADT_P(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
timeKEY *kkk = (timeKEY *) DatumGetPointer(entry->key);
TimeADT qqq;
diff --git a/contrib/btree_gist/btree_ts.c b/contrib/btree_gist/btree_ts.c
index 3b163a729cb..c016ff1cf19 100644
--- a/contrib/btree_gist/btree_ts.c
+++ b/contrib/btree_gist/btree_ts.c
@@ -244,8 +244,7 @@ gbt_ts_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
Timestamp query = PG_GETARG_TIMESTAMP(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
tsKEY *kkk = (tsKEY *) DatumGetPointer(entry->key);
GBT_NUMKEY_R key;
@@ -265,8 +264,7 @@ gbt_ts_distance(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
Timestamp query = PG_GETARG_TIMESTAMP(1);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
tsKEY *kkk = (tsKEY *) DatumGetPointer(entry->key);
GBT_NUMKEY_R key;
@@ -283,8 +281,7 @@ gbt_tstz_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
TimestampTz query = PG_GETARG_TIMESTAMPTZ(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
char *kkk = (char *) DatumGetPointer(entry->key);
GBT_NUMKEY_R key;
@@ -306,8 +303,7 @@ gbt_tstz_distance(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
TimestampTz query = PG_GETARG_TIMESTAMPTZ(1);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
char *kkk = (char *) DatumGetPointer(entry->key);
GBT_NUMKEY_R key;
Timestamp qqq;
diff --git a/contrib/btree_gist/btree_uuid.c b/contrib/btree_gist/btree_uuid.c
index 1091af222d1..3c11ccae99e 100644
--- a/contrib/btree_gist/btree_uuid.c
+++ b/contrib/btree_gist/btree_uuid.c
@@ -136,8 +136,7 @@ gbt_uuid_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
pg_uuid_t *query = PG_GETARG_UUID_P(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
uuidKEY *kkk = (uuidKEY *) DatumGetPointer(entry->key);
GBT_NUMKEY_R key;
diff --git a/contrib/cube/cube.c b/contrib/cube/cube.c
index 3600457cbc0..65c6b5ab06f 100644
--- a/contrib/cube/cube.c
+++ b/contrib/cube/cube.c
@@ -397,8 +397,7 @@ g_cube_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
NDBOX *query = PG_GETARG_NDBOX_P(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
bool res;
diff --git a/contrib/hstore/hstore_gin.c b/contrib/hstore/hstore_gin.c
index 2e5fa115924..97a5cdf9efc 100644
--- a/contrib/hstore/hstore_gin.c
+++ b/contrib/hstore/hstore_gin.c
@@ -152,11 +152,9 @@ gin_consistent_hstore(PG_FUNCTION_ARGS)
{
bool *check = (bool *) PG_GETARG_POINTER(0);
StrategyNumber strategy = PG_GETARG_UINT16(1);
-
- /* HStore *query = PG_GETARG_HSTORE_P(2); */
+ //pg_attribute_unused() HStore *query = PG_GETARG_HSTORE_P(2); // FIXME
int32 nkeys = PG_GETARG_INT32(3);
-
- /* Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4); */
+ pg_attribute_unused() Pointer *extra_data = (Pointer *)
PG_GETARG_POINTER(4);
bool *recheck = (bool *) PG_GETARG_POINTER(5);
bool res = true;
int32 i;
diff --git a/contrib/hstore/hstore_gist.c b/contrib/hstore/hstore_gist.c
index 36825ef867b..e145c2079d6 100644
--- a/contrib/hstore/hstore_gist.c
+++ b/contrib/hstore/hstore_gist.c
@@ -510,8 +510,7 @@ ghstore_consistent(PG_FUNCTION_ARGS)
{
GISTTYPE *entry = (GISTTYPE *) DatumGetPointer(((GISTENTRY *)
PG_GETARG_POINTER(0))->key);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
int siglen = GET_SIGLEN();
bool res = true;
diff --git a/contrib/intarray/_int_gin.c b/contrib/intarray/_int_gin.c
index c60616c3f77..2a058189848 100644
--- a/contrib/intarray/_int_gin.c
+++ b/contrib/intarray/_int_gin.c
@@ -112,8 +112,7 @@ ginint4_consistent(PG_FUNCTION_ARGS)
bool *check = (bool *) PG_GETARG_POINTER(0);
StrategyNumber strategy = PG_GETARG_UINT16(1);
int32 nkeys = PG_GETARG_INT32(3);
-
- /* Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4); */
+ pg_attribute_unused() Pointer *extra_data = (Pointer *)
PG_GETARG_POINTER(4);
bool *recheck = (bool *) PG_GETARG_POINTER(5);
bool res = false;
int32 i;
diff --git a/contrib/intarray/_int_gist.c b/contrib/intarray/_int_gist.c
index 90cf11c01a5..cea977c0e7a 100644
--- a/contrib/intarray/_int_gist.c
+++ b/contrib/intarray/_int_gist.c
@@ -49,8 +49,7 @@ g_int_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
ArrayType *query = PG_GETARG_ARRAYTYPE_P_COPY(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
bool retval = false; /* silence compiler warning */
diff --git a/contrib/intarray/_intbig_gist.c b/contrib/intarray/_intbig_gist.c
index 0afa8a73b68..d59a86b771b 100644
--- a/contrib/intarray/_intbig_gist.c
+++ b/contrib/intarray/_intbig_gist.c
@@ -467,8 +467,7 @@ g_intbig_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
ArrayType *query = PG_GETARG_ARRAYTYPE_P(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
int siglen = GET_SIGLEN();
bool retval;
diff --git a/contrib/ltree/_ltree_gist.c b/contrib/ltree/_ltree_gist.c
index ceb92a6304d..cec9919399e 100644
--- a/contrib/ltree/_ltree_gist.c
+++ b/contrib/ltree/_ltree_gist.c
@@ -508,8 +508,7 @@ _ltree_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
void *query = PG_DETOAST_DATUM(PG_GETARG_DATUM(1));
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
int siglen = LTREE_GET_ASIGLEN();
ltree_gist *key = (ltree_gist *) DatumGetPointer(entry->key);
diff --git a/contrib/ltree/ltree_gist.c b/contrib/ltree/ltree_gist.c
index bb7f4634722..6f6ce6d6ddc 100644
--- a/contrib/ltree/ltree_gist.c
+++ b/contrib/ltree/ltree_gist.c
@@ -618,8 +618,7 @@ ltree_consistent(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
int siglen = LTREE_GET_SIGLEN();
ltree_gist *key = (ltree_gist *) DatumGetPointer(entry->key);
diff --git a/contrib/pg_trgm/trgm_gin.c b/contrib/pg_trgm/trgm_gin.c
index 66ff6adde99..e50f9498665 100644
--- a/contrib/pg_trgm/trgm_gin.c
+++ b/contrib/pg_trgm/trgm_gin.c
@@ -72,11 +72,9 @@ gin_extract_query_trgm(PG_FUNCTION_ARGS)
text *val = (text *) PG_GETARG_TEXT_PP(0);
int32 *nentries = (int32 *) PG_GETARG_POINTER(1);
StrategyNumber strategy = PG_GETARG_UINT16(2);
-
- /* bool **pmatch = (bool **) PG_GETARG_POINTER(3); */
+ pg_attribute_unused() bool **pmatch = (bool **) PG_GETARG_POINTER(3);
Pointer **extra_data = (Pointer **) PG_GETARG_POINTER(4);
-
- /* bool **nullFlags = (bool **) PG_GETARG_POINTER(5); */
+ pg_attribute_unused() bool **nullFlags = (bool **) PG_GETARG_POINTER(5);
int32 *searchMode = (int32 *) PG_GETARG_POINTER(6);
Datum *entries = NULL;
TRGM *trg;
@@ -171,8 +169,7 @@ gin_trgm_consistent(PG_FUNCTION_ARGS)
{
bool *check = (bool *) PG_GETARG_POINTER(0);
StrategyNumber strategy = PG_GETARG_UINT16(1);
-
- /* text *query = PG_GETARG_TEXT_PP(2); */
+ pg_attribute_unused() text *query = PG_GETARG_TEXT_PP(2);
int32 nkeys = PG_GETARG_INT32(3);
Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4);
bool *recheck = (bool *) PG_GETARG_POINTER(5);
@@ -269,8 +266,7 @@ gin_trgm_triconsistent(PG_FUNCTION_ARGS)
{
GinTernaryValue *check = (GinTernaryValue *) PG_GETARG_POINTER(0);
StrategyNumber strategy = PG_GETARG_UINT16(1);
-
- /* text *query = PG_GETARG_TEXT_PP(2); */
+ pg_attribute_unused() text *query = PG_GETARG_TEXT_PP(2);
int32 nkeys = PG_GETARG_INT32(3);
Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4);
GinTernaryValue res = GIN_MAYBE;
diff --git a/contrib/pg_trgm/trgm_gist.c b/contrib/pg_trgm/trgm_gist.c
index 5c7deb103a6..555873e6e57 100644
--- a/contrib/pg_trgm/trgm_gist.c
+++ b/contrib/pg_trgm/trgm_gist.c
@@ -199,8 +199,7 @@ gtrgm_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
text *query = PG_GETARG_TEXT_P(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
int siglen = GET_SIGLEN();
TRGM *key = (TRGM *) DatumGetPointer(entry->key);
@@ -454,8 +453,7 @@ gtrgm_distance(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
text *query = PG_GETARG_TEXT_P(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
int siglen = GET_SIGLEN();
TRGM *key = (TRGM *) DatumGetPointer(entry->key);
diff --git a/contrib/seg/seg.c b/contrib/seg/seg.c
index 2d3a048c73e..6747af9f7ab 100644
--- a/contrib/seg/seg.c
+++ b/contrib/seg/seg.c
@@ -202,8 +202,7 @@ gseg_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
Datum query = PG_GETARG_DATUM(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
/* All cases served by this function are exact */
diff --git a/doc/src/sgml/gist.sgml b/doc/src/sgml/gist.sgml
index ee86e170055..f1eae322801 100644
--- a/doc/src/sgml/gist.sgml
+++ b/doc/src/sgml/gist.sgml
@@ -343,7 +343,7 @@ <title>Extensibility</title>
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
data_type *query = PG_GETARG_DATA_TYPE_P(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
- /* Oid subtype = PG_GETARG_OID(3); */
+ Oid subtype = PG_GETARG_OID(3); /* unused */
bool *recheck = (bool *) PG_GETARG_POINTER(4);
data_type *key = DatumGetDataType(entry->key);
bool retval;
@@ -830,8 +830,8 @@ <title>Extensibility</title>
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
data_type *query = PG_GETARG_DATA_TYPE_P(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
- /* Oid subtype = PG_GETARG_OID(3); */
- /* bool *recheck = (bool *) PG_GETARG_POINTER(4); */
+ Oid subtype = PG_GETARG_OID(3); /* unused */
+ bool *recheck = (bool *) PG_GETARG_POINTER(4); /* unused */
data_type *key = DatumGetDataType(entry->key);
double retval;
diff --git a/src/backend/access/gin/ginarrayproc.c
b/src/backend/access/gin/ginarrayproc.c
index 1f821323eb0..23dc61c989c 100644
--- a/src/backend/access/gin/ginarrayproc.c
+++ b/src/backend/access/gin/ginarrayproc.c
@@ -82,9 +82,8 @@ ginqueryarrayextract(PG_FUNCTION_ARGS)
ArrayType *array = PG_GETARG_ARRAYTYPE_P_COPY(0);
int32 *nkeys = (int32 *) PG_GETARG_POINTER(1);
StrategyNumber strategy = PG_GETARG_UINT16(2);
-
- /* bool **pmatch = (bool **) PG_GETARG_POINTER(3); */
- /* Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4); */
+ pg_attribute_unused() bool **pmatch = (bool **) PG_GETARG_POINTER(3);
+ pg_attribute_unused() Pointer *extra_data = (Pointer *)
PG_GETARG_POINTER(4);
bool **nullFlags = (bool **) PG_GETARG_POINTER(5);
int32 *searchMode = (int32 *) PG_GETARG_POINTER(6);
int16 elmlen;
@@ -143,14 +142,11 @@ ginarrayconsistent(PG_FUNCTION_ARGS)
{
bool *check = (bool *) PG_GETARG_POINTER(0);
StrategyNumber strategy = PG_GETARG_UINT16(1);
-
- /* ArrayType *query = PG_GETARG_ARRAYTYPE_P(2); */
+ pg_attribute_unused() ArrayType *query = PG_GETARG_ARRAYTYPE_P(2);
int32 nkeys = PG_GETARG_INT32(3);
-
- /* Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4); */
+ pg_attribute_unused() Pointer *extra_data = (Pointer *)
PG_GETARG_POINTER(4);
bool *recheck = (bool *) PG_GETARG_POINTER(5);
-
- /* Datum *queryKeys = (Datum *) PG_GETARG_POINTER(6); */
+ pg_attribute_unused() Datum *queryKeys = (Datum *) PG_GETARG_POINTER(6);
bool *nullFlags = (bool *) PG_GETARG_POINTER(7);
bool res;
int32 i;
@@ -227,12 +223,10 @@ ginarraytriconsistent(PG_FUNCTION_ARGS)
{
GinTernaryValue *check = (GinTernaryValue *) PG_GETARG_POINTER(0);
StrategyNumber strategy = PG_GETARG_UINT16(1);
-
- /* ArrayType *query = PG_GETARG_ARRAYTYPE_P(2); */
+ pg_attribute_unused() ArrayType *query = PG_GETARG_ARRAYTYPE_P(2);
int32 nkeys = PG_GETARG_INT32(3);
-
- /* Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4); */
- /* Datum *queryKeys = (Datum *) PG_GETARG_POINTER(5); */
+ pg_attribute_unused() Pointer *extra_data = (Pointer *)
PG_GETARG_POINTER(4);
+ pg_attribute_unused() Datum *queryKeys = (Datum *) PG_GETARG_POINTER(5);
bool *nullFlags = (bool *) PG_GETARG_POINTER(6);
GinTernaryValue res;
int32 i;
diff --git a/src/backend/access/gist/gistproc.c
b/src/backend/access/gist/gistproc.c
index f2ec6cbe2e5..408fd2f2f1b 100644
--- a/src/backend/access/gist/gistproc.c
+++ b/src/backend/access/gist/gistproc.c
@@ -115,8 +115,7 @@ gist_box_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
BOX *query = PG_GETARG_BOX_P(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
/* All cases served by this function are exact */
@@ -1064,8 +1063,7 @@ gist_poly_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
POLYGON *query = PG_GETARG_POLYGON_P(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
bool result;
@@ -1132,8 +1130,7 @@ gist_circle_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
CIRCLE *query = PG_GETARG_CIRCLE_P(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
BOX bbox;
bool result;
@@ -1502,9 +1499,8 @@ gist_box_distance(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
Datum query = PG_GETARG_DATUM(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
- /* bool *recheck = (bool *) PG_GETARG_POINTER(4); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
+ pg_attribute_unused() bool *recheck = (bool *) PG_GETARG_POINTER(4);
float8 distance;
distance = gist_bbox_distance(entry, query, strategy);
@@ -1528,8 +1524,7 @@ gist_circle_distance(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
Datum query = PG_GETARG_DATUM(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
float8 distance;
@@ -1545,8 +1540,7 @@ gist_poly_distance(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
Datum query = PG_GETARG_DATUM(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
float8 distance;
diff --git a/src/backend/access/spgist/spgkdtreeproc.c
b/src/backend/access/spgist/spgkdtreeproc.c
index d6989759e5f..f7b527965c7 100644
--- a/src/backend/access/spgist/spgkdtreeproc.c
+++ b/src/backend/access/spgist/spgkdtreeproc.c
@@ -27,7 +27,7 @@
Datum
spg_kd_config(PG_FUNCTION_ARGS)
{
- /* spgConfigIn *cfgin = (spgConfigIn *) PG_GETARG_POINTER(0); */
+ pg_attribute_unused() spgConfigIn *cfgin = (spgConfigIn *)
PG_GETARG_POINTER(0);
spgConfigOut *cfg = (spgConfigOut *) PG_GETARG_POINTER(1);
cfg->prefixType = FLOAT8OID;
diff --git a/src/backend/access/spgist/spgquadtreeproc.c
b/src/backend/access/spgist/spgquadtreeproc.c
index 3e8cfa1709a..91a8e175ff1 100644
--- a/src/backend/access/spgist/spgquadtreeproc.c
+++ b/src/backend/access/spgist/spgquadtreeproc.c
@@ -26,7 +26,7 @@
Datum
spg_quad_config(PG_FUNCTION_ARGS)
{
- /* spgConfigIn *cfgin = (spgConfigIn *) PG_GETARG_POINTER(0); */
+ pg_attribute_unused() spgConfigIn *cfgin = (spgConfigIn *)
PG_GETARG_POINTER(0);
spgConfigOut *cfg = (spgConfigOut *) PG_GETARG_POINTER(1);
cfg->prefixType = POINTOID;
diff --git a/src/backend/access/spgist/spgtextproc.c
b/src/backend/access/spgist/spgtextproc.c
index 91f4ab260c2..951894a3ea6 100644
--- a/src/backend/access/spgist/spgtextproc.c
+++ b/src/backend/access/spgist/spgtextproc.c
@@ -95,7 +95,7 @@ typedef struct spgNodePtr
Datum
spg_text_config(PG_FUNCTION_ARGS)
{
- /* spgConfigIn *cfgin = (spgConfigIn *) PG_GETARG_POINTER(0); */
+ pg_attribute_unused() spgConfigIn *cfgin = (spgConfigIn *)
PG_GETARG_POINTER(0);
spgConfigOut *cfg = (spgConfigOut *) PG_GETARG_POINTER(1);
cfg->prefixType = TEXTOID;
diff --git a/src/backend/utils/adt/datum.c b/src/backend/utils/adt/datum.c
index dabcca6f4c5..ec41d8c87f4 100644
--- a/src/backend/utils/adt/datum.c
+++ b/src/backend/utils/adt/datum.c
@@ -396,7 +396,7 @@ datum_image_hash(Datum value, bool typByVal, int typLen)
Datum
btequalimage(PG_FUNCTION_ARGS)
{
- /* Oid opcintype = PG_GETARG_OID(0); */
+ pg_attribute_unused() Oid opcintype = PG_GETARG_OID(0);
PG_RETURN_BOOL(true);
}
diff --git a/src/backend/utils/adt/jsonb_gin.c
b/src/backend/utils/adt/jsonb_gin.c
index a6d3332bb42..66d95b1f384 100644
--- a/src/backend/utils/adt/jsonb_gin.c
+++ b/src/backend/utils/adt/jsonb_gin.c
@@ -930,8 +930,7 @@ gin_consistent_jsonb(PG_FUNCTION_ARGS)
{
bool *check = (bool *) PG_GETARG_POINTER(0);
StrategyNumber strategy = PG_GETARG_UINT16(1);
-
- /* Jsonb *query = PG_GETARG_JSONB_P(2); */
+ pg_attribute_unused() Jsonb *query = PG_GETARG_JSONB_P(2);
int32 nkeys = PG_GETARG_INT32(3);
Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4);
@@ -1013,8 +1012,7 @@ gin_triconsistent_jsonb(PG_FUNCTION_ARGS)
{
GinTernaryValue *check = (GinTernaryValue *) PG_GETARG_POINTER(0);
StrategyNumber strategy = PG_GETARG_UINT16(1);
-
- /* Jsonb *query = PG_GETARG_JSONB_P(2); */
+ pg_attribute_unused() Jsonb *query = PG_GETARG_JSONB_P(2);
int32 nkeys = PG_GETARG_INT32(3);
Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4);
GinTernaryValue res = GIN_MAYBE;
@@ -1219,8 +1217,7 @@ gin_consistent_jsonb_path(PG_FUNCTION_ARGS)
{
bool *check = (bool *) PG_GETARG_POINTER(0);
StrategyNumber strategy = PG_GETARG_UINT16(1);
-
- /* Jsonb *query = PG_GETARG_JSONB_P(2); */
+ pg_attribute_unused() Jsonb *query = PG_GETARG_JSONB_P(2);
int32 nkeys = PG_GETARG_INT32(3);
Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4);
bool *recheck = (bool *) PG_GETARG_POINTER(5);
@@ -1270,8 +1267,7 @@ gin_triconsistent_jsonb_path(PG_FUNCTION_ARGS)
{
GinTernaryValue *check = (GinTernaryValue *) PG_GETARG_POINTER(0);
StrategyNumber strategy = PG_GETARG_UINT16(1);
-
- /* Jsonb *query = PG_GETARG_JSONB_P(2); */
+ pg_attribute_unused() Jsonb *query = PG_GETARG_JSONB_P(2);
int32 nkeys = PG_GETARG_INT32(3);
Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4);
GinTernaryValue res = GIN_MAYBE;
diff --git a/src/backend/utils/adt/jsonfuncs.c
b/src/backend/utils/adt/jsonfuncs.c
index de32e329975..8a8b42517c8 100644
--- a/src/backend/utils/adt/jsonfuncs.c
+++ b/src/backend/utils/adt/jsonfuncs.c
@@ -4919,10 +4919,6 @@ jsonb_set(PG_FUNCTION_ARGS)
Datum
jsonb_set_lax(PG_FUNCTION_ARGS)
{
- /* Jsonb *in = PG_GETARG_JSONB_P(0); */
- /* ArrayType *path = PG_GETARG_ARRAYTYPE_P(1); */
- /* Jsonb *newval = PG_GETARG_JSONB_P(2); */
- /* bool create = PG_GETARG_BOOL(3); */
text *handle_null;
char *handle_val;
diff --git a/src/backend/utils/adt/network_gist.c
b/src/backend/utils/adt/network_gist.c
index a08c4953789..6c2a3a58e4f 100644
--- a/src/backend/utils/adt/network_gist.c
+++ b/src/backend/utils/adt/network_gist.c
@@ -117,8 +117,7 @@ inet_gist_consistent(PG_FUNCTION_ARGS)
GISTENTRY *ent = (GISTENTRY *) PG_GETARG_POINTER(0);
inet *query = PG_GETARG_INET_PP(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
GistInetKey *key = DatumGetInetKeyP(ent->key);
int minbits,
diff --git a/src/backend/utils/adt/network_spgist.c
b/src/backend/utils/adt/network_spgist.c
index a84747d9275..5d0f029b239 100644
--- a/src/backend/utils/adt/network_spgist.c
+++ b/src/backend/utils/adt/network_spgist.c
@@ -50,7 +50,7 @@ static int inet_spg_consistent_bitmap(const inet *prefix,
int nkeys,
Datum
inet_spg_config(PG_FUNCTION_ARGS)
{
- /* spgConfigIn *cfgin = (spgConfigIn *) PG_GETARG_POINTER(0); */
+ pg_attribute_unused() spgConfigIn *cfgin = (spgConfigIn *)
PG_GETARG_POINTER(0);
spgConfigOut *cfg = (spgConfigOut *) PG_GETARG_POINTER(1);
cfg->prefixType = CIDROID;
diff --git a/src/backend/utils/adt/rangetypes_spgist.c
b/src/backend/utils/adt/rangetypes_spgist.c
index be519654880..c66c316a42c 100644
--- a/src/backend/utils/adt/rangetypes_spgist.c
+++ b/src/backend/utils/adt/rangetypes_spgist.c
@@ -59,7 +59,7 @@ static int adjacent_cmp_bounds(TypeCacheEntry *typcache,
const RangeBound *arg,
Datum
spg_range_quad_config(PG_FUNCTION_ARGS)
{
- /* spgConfigIn *cfgin = (spgConfigIn *) PG_GETARG_POINTER(0); */
+ pg_attribute_unused() spgConfigIn *cfgin = (spgConfigIn *)
PG_GETARG_POINTER(0);
spgConfigOut *cfg = (spgConfigOut *) PG_GETARG_POINTER(1);
cfg->prefixType = ANYRANGEOID;
diff --git a/src/backend/utils/adt/tsginidx.c b/src/backend/utils/adt/tsginidx.c
index 2712fd89df0..2d2582b26c3 100644
--- a/src/backend/utils/adt/tsginidx.c
+++ b/src/backend/utils/adt/tsginidx.c
@@ -14,6 +14,7 @@
#include "postgres.h"
#include "access/gin.h"
+#include "access/stratnum.h"
#include "tsearch/ts_type.h"
#include "tsearch/ts_utils.h"
#include "utils/builtins.h"
@@ -95,12 +96,10 @@ gin_extract_tsquery(PG_FUNCTION_ARGS)
{
TSQuery query = PG_GETARG_TSQUERY(0);
int32 *nentries = (int32 *) PG_GETARG_POINTER(1);
-
- /* StrategyNumber strategy = PG_GETARG_UINT16(2); */
+ pg_attribute_unused() StrategyNumber strategy = PG_GETARG_UINT16(2);
bool **ptr_partialmatch = (bool **) PG_GETARG_POINTER(3);
Pointer **extra_data = (Pointer **) PG_GETARG_POINTER(4);
-
- /* bool **nullFlags = (bool **) PG_GETARG_POINTER(5); */
+ pg_attribute_unused() bool **nullFlags = (bool **) PG_GETARG_POINTER(5);
int32 *searchMode = (int32 *) PG_GETARG_POINTER(6);
Datum *entries = NULL;
@@ -214,11 +213,9 @@ Datum
gin_tsquery_consistent(PG_FUNCTION_ARGS)
{
bool *check = (bool *) PG_GETARG_POINTER(0);
-
- /* StrategyNumber strategy = PG_GETARG_UINT16(1); */
+ pg_attribute_unused() StrategyNumber strategy = PG_GETARG_UINT16(1);
TSQuery query = PG_GETARG_TSQUERY(2);
-
- /* int32 nkeys = PG_GETARG_INT32(3); */
+ pg_attribute_unused() int32 nkeys = PG_GETARG_INT32(3);
Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4);
bool *recheck = (bool *) PG_GETARG_POINTER(5);
bool res = false;
@@ -263,11 +260,9 @@ Datum
gin_tsquery_triconsistent(PG_FUNCTION_ARGS)
{
GinTernaryValue *check = (GinTernaryValue *) PG_GETARG_POINTER(0);
-
- /* StrategyNumber strategy = PG_GETARG_UINT16(1); */
+ pg_attribute_unused() StrategyNumber strategy = PG_GETARG_UINT16(1);
TSQuery query = PG_GETARG_TSQUERY(2);
-
- /* int32 nkeys = PG_GETARG_INT32(3); */
+ pg_attribute_unused() int32 nkeys = PG_GETARG_INT32(3);
Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4);
GinTernaryValue res = GIN_FALSE;
diff --git a/src/backend/utils/adt/tsgistidx.c
b/src/backend/utils/adt/tsgistidx.c
index 935187b37c7..f5ab5c5d15f 100644
--- a/src/backend/utils/adt/tsgistidx.c
+++ b/src/backend/utils/adt/tsgistidx.c
@@ -326,9 +326,8 @@ gtsvector_consistent(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
TSQuery query = PG_GETARG_TSQUERY(1);
-
- /* StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); */
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() StrategyNumber strategy = (StrategyNumber)
PG_GETARG_UINT16(2);
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
SignTSVector *key = (SignTSVector *) DatumGetPointer(entry->key);
diff --git a/src/backend/utils/adt/tsquery_gist.c
b/src/backend/utils/adt/tsquery_gist.c
index f7f94c1c760..b3396952f85 100644
--- a/src/backend/utils/adt/tsquery_gist.c
+++ b/src/backend/utils/adt/tsquery_gist.c
@@ -55,8 +55,7 @@ gtsquery_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
TSQuery query = PG_GETARG_TSQUERY(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-
- /* Oid subtype = PG_GETARG_OID(3); */
+ pg_attribute_unused() Oid subtype = PG_GETARG_OID(3);
bool *recheck = (bool *) PG_GETARG_POINTER(4);
TSQuerySign key = DatumGetTSQuerySign(entry->key);
TSQuerySign sq = makeTSQuerySign(query);
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 3894457ab40..7fc380eb769 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -2283,7 +2283,7 @@ varstr_abbrev_abort(int memtupcount, SortSupport ssup)
Datum
btvarstrequalimage(PG_FUNCTION_ARGS)
{
- /* Oid opcintype = PG_GETARG_OID(0); */
+ pg_attribute_unused() Oid opcintype = PG_GETARG_OID(0);
Oid collid = PG_GET_COLLATION();
pg_locale_t locale;
diff --git a/src/test/modules/spgist_name_ops/spgist_name_ops.c
b/src/test/modules/spgist_name_ops/spgist_name_ops.c
index 38e54e0e0a4..ac8921004bd 100644
--- a/src/test/modules/spgist_name_ops/spgist_name_ops.c
+++ b/src/test/modules/spgist_name_ops/spgist_name_ops.c
@@ -33,7 +33,7 @@ PG_FUNCTION_INFO_V1(spgist_name_config);
Datum
spgist_name_config(PG_FUNCTION_ARGS)
{
- /* spgConfigIn *cfgin = (spgConfigIn *) PG_GETARG_POINTER(0); */
+ pg_attribute_unused() spgConfigIn *cfgin = (spgConfigIn *)
PG_GETARG_POINTER(0);
spgConfigOut *cfg = (spgConfigOut *) PG_GETARG_POINTER(1);
cfg->prefixType = TEXTOID;
--
2.52.0