Skip to content

Commit e7128e8

Browse files
committed
Create function prototype as part of PG_FUNCTION_INFO_V1 macro
Because of gcc -Wmissing-prototypes, all functions in dynamically loadable modules must have a separate prototype declaration. This is meant to detect global functions that are not declared in header files, but in cases where the function is called via dfmgr, this is redundant. Besides filling up space with boilerplate, this is a frequent source of compiler warnings in extension modules. We can fix that by creating the function prototype as part of the PG_FUNCTION_INFO_V1 macro, which such modules have to use anyway. That makes the code of modules cleaner, because there is one less place where the entry points have to be listed, and creates an additional check that functions have the right prototype. Remove now redundant prototypes from contrib and other modules.
1 parent 0156315 commit e7128e8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+5
-666
lines changed

contrib/adminpack/adminpack.c

-5
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@
4040

4141
PG_MODULE_MAGIC;
4242

43-
Datum pg_file_write(PG_FUNCTION_ARGS);
44-
Datum pg_file_rename(PG_FUNCTION_ARGS);
45-
Datum pg_file_unlink(PG_FUNCTION_ARGS);
46-
Datum pg_logdir_ls(PG_FUNCTION_ARGS);
47-
4843
PG_FUNCTION_INFO_V1(pg_file_write);
4944
PG_FUNCTION_INFO_V1(pg_file_rename);
5045
PG_FUNCTION_INFO_V1(pg_file_unlink);

contrib/btree_gin/btree_gin.c

-5
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ typedef struct QueryInfo
3232

3333
#define GIN_EXTRACT_VALUE(type) \
3434
PG_FUNCTION_INFO_V1(gin_extract_value_##type); \
35-
Datum gin_extract_value_##type(PG_FUNCTION_ARGS); \
3635
Datum \
3736
gin_extract_value_##type(PG_FUNCTION_ARGS) \
3837
{ \
@@ -59,7 +58,6 @@ gin_extract_value_##type(PG_FUNCTION_ARGS) \
5958

6059
#define GIN_EXTRACT_QUERY(type) \
6160
PG_FUNCTION_INFO_V1(gin_extract_query_##type); \
62-
Datum gin_extract_query_##type(PG_FUNCTION_ARGS); \
6361
Datum \
6462
gin_extract_query_##type(PG_FUNCTION_ARGS) \
6563
{ \
@@ -109,7 +107,6 @@ gin_extract_query_##type(PG_FUNCTION_ARGS) \
109107
*/
110108
#define GIN_COMPARE_PREFIX(type) \
111109
PG_FUNCTION_INFO_V1(gin_compare_prefix_##type); \
112-
Datum gin_compare_prefix_##type(PG_FUNCTION_ARGS); \
113110
Datum \
114111
gin_compare_prefix_##type(PG_FUNCTION_ARGS) \
115112
{ \
@@ -182,7 +179,6 @@ gin_compare_prefix_##type(PG_FUNCTION_ARGS) \
182179

183180

184181
PG_FUNCTION_INFO_V1(gin_btree_consistent);
185-
Datum gin_btree_consistent(PG_FUNCTION_ARGS);
186182
Datum
187183
gin_btree_consistent(PG_FUNCTION_ARGS)
188184
{
@@ -404,7 +400,6 @@ GIN_SUPPORT(varbit)
404400
#define NUMERIC_IS_LEFTMOST(x) ((x) == NULL)
405401

406402
PG_FUNCTION_INFO_V1(gin_numeric_cmp);
407-
Datum gin_numeric_cmp(PG_FUNCTION_ARGS);
408403

409404
Datum
410405
gin_numeric_cmp(PG_FUNCTION_ARGS)

contrib/btree_gist/btree_bit.c

-8
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@ PG_FUNCTION_INFO_V1(gbt_bit_consistent);
1919
PG_FUNCTION_INFO_V1(gbt_bit_penalty);
2020
PG_FUNCTION_INFO_V1(gbt_bit_same);
2121

22-
Datum gbt_bit_compress(PG_FUNCTION_ARGS);
23-
Datum gbt_bit_union(PG_FUNCTION_ARGS);
24-
Datum gbt_bit_picksplit(PG_FUNCTION_ARGS);
25-
Datum gbt_bit_consistent(PG_FUNCTION_ARGS);
26-
Datum gbt_bit_penalty(PG_FUNCTION_ARGS);
27-
Datum gbt_bit_same(PG_FUNCTION_ARGS);
28-
29-
3022

3123
/* define for comparison */
3224

contrib/btree_gist/btree_bytea.c

-7
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@ PG_FUNCTION_INFO_V1(gbt_bytea_consistent);
1818
PG_FUNCTION_INFO_V1(gbt_bytea_penalty);
1919
PG_FUNCTION_INFO_V1(gbt_bytea_same);
2020

21-
Datum gbt_bytea_compress(PG_FUNCTION_ARGS);
22-
Datum gbt_bytea_union(PG_FUNCTION_ARGS);
23-
Datum gbt_bytea_picksplit(PG_FUNCTION_ARGS);
24-
Datum gbt_bytea_consistent(PG_FUNCTION_ARGS);
25-
Datum gbt_bytea_penalty(PG_FUNCTION_ARGS);
26-
Datum gbt_bytea_same(PG_FUNCTION_ARGS);
27-
2821

2922
/* define for comparison */
3023

contrib/btree_gist/btree_cash.c

-9
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,6 @@ PG_FUNCTION_INFO_V1(gbt_cash_distance);
2424
PG_FUNCTION_INFO_V1(gbt_cash_penalty);
2525
PG_FUNCTION_INFO_V1(gbt_cash_same);
2626

27-
Datum gbt_cash_compress(PG_FUNCTION_ARGS);
28-
Datum gbt_cash_union(PG_FUNCTION_ARGS);
29-
Datum gbt_cash_picksplit(PG_FUNCTION_ARGS);
30-
Datum gbt_cash_consistent(PG_FUNCTION_ARGS);
31-
Datum gbt_cash_distance(PG_FUNCTION_ARGS);
32-
Datum gbt_cash_penalty(PG_FUNCTION_ARGS);
33-
Datum gbt_cash_same(PG_FUNCTION_ARGS);
34-
3527
static bool
3628
gbt_cashgt(const void *a, const void *b)
3729
{
@@ -97,7 +89,6 @@ static const gbtree_ninfo tinfo =
9789

9890

9991
PG_FUNCTION_INFO_V1(cash_dist);
100-
Datum cash_dist(PG_FUNCTION_ARGS);
10192
Datum
10293
cash_dist(PG_FUNCTION_ARGS)
10394
{

contrib/btree_gist/btree_date.c

-9
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,6 @@ PG_FUNCTION_INFO_V1(gbt_date_distance);
2424
PG_FUNCTION_INFO_V1(gbt_date_penalty);
2525
PG_FUNCTION_INFO_V1(gbt_date_same);
2626

27-
Datum gbt_date_compress(PG_FUNCTION_ARGS);
28-
Datum gbt_date_union(PG_FUNCTION_ARGS);
29-
Datum gbt_date_picksplit(PG_FUNCTION_ARGS);
30-
Datum gbt_date_consistent(PG_FUNCTION_ARGS);
31-
Datum gbt_date_distance(PG_FUNCTION_ARGS);
32-
Datum gbt_date_penalty(PG_FUNCTION_ARGS);
33-
Datum gbt_date_same(PG_FUNCTION_ARGS);
34-
3527
static bool
3628
gbt_dategt(const void *a, const void *b)
3729
{
@@ -115,7 +107,6 @@ static const gbtree_ninfo tinfo =
115107

116108

117109
PG_FUNCTION_INFO_V1(date_dist);
118-
Datum date_dist(PG_FUNCTION_ARGS);
119110
Datum
120111
date_dist(PG_FUNCTION_ARGS)
121112
{

contrib/btree_gist/btree_float4.c

-9
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@ PG_FUNCTION_INFO_V1(gbt_float4_distance);
2323
PG_FUNCTION_INFO_V1(gbt_float4_penalty);
2424
PG_FUNCTION_INFO_V1(gbt_float4_same);
2525

26-
Datum gbt_float4_compress(PG_FUNCTION_ARGS);
27-
Datum gbt_float4_union(PG_FUNCTION_ARGS);
28-
Datum gbt_float4_picksplit(PG_FUNCTION_ARGS);
29-
Datum gbt_float4_consistent(PG_FUNCTION_ARGS);
30-
Datum gbt_float4_distance(PG_FUNCTION_ARGS);
31-
Datum gbt_float4_penalty(PG_FUNCTION_ARGS);
32-
Datum gbt_float4_same(PG_FUNCTION_ARGS);
33-
3426
static bool
3527
gbt_float4gt(const void *a, const void *b)
3628
{
@@ -96,7 +88,6 @@ static const gbtree_ninfo tinfo =
9688

9789

9890
PG_FUNCTION_INFO_V1(float4_dist);
99-
Datum float4_dist(PG_FUNCTION_ARGS);
10091
Datum
10192
float4_dist(PG_FUNCTION_ARGS)
10293
{

contrib/btree_gist/btree_float8.c

-9
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@ PG_FUNCTION_INFO_V1(gbt_float8_distance);
2323
PG_FUNCTION_INFO_V1(gbt_float8_penalty);
2424
PG_FUNCTION_INFO_V1(gbt_float8_same);
2525

26-
Datum gbt_float8_compress(PG_FUNCTION_ARGS);
27-
Datum gbt_float8_union(PG_FUNCTION_ARGS);
28-
Datum gbt_float8_picksplit(PG_FUNCTION_ARGS);
29-
Datum gbt_float8_consistent(PG_FUNCTION_ARGS);
30-
Datum gbt_float8_distance(PG_FUNCTION_ARGS);
31-
Datum gbt_float8_penalty(PG_FUNCTION_ARGS);
32-
Datum gbt_float8_same(PG_FUNCTION_ARGS);
33-
3426

3527
static bool
3628
gbt_float8gt(const void *a, const void *b)
@@ -104,7 +96,6 @@ static const gbtree_ninfo tinfo =
10496

10597

10698
PG_FUNCTION_INFO_V1(float8_dist);
107-
Datum float8_dist(PG_FUNCTION_ARGS);
10899
Datum
109100
float8_dist(PG_FUNCTION_ARGS)
110101
{

contrib/btree_gist/btree_gist.c

-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ PG_FUNCTION_INFO_V1(gbt_decompress);
1111
PG_FUNCTION_INFO_V1(gbtreekey_in);
1212
PG_FUNCTION_INFO_V1(gbtreekey_out);
1313

14-
Datum gbt_decompress(PG_FUNCTION_ARGS);
15-
1614
/**************************************************
1715
* In/Out for keys
1816
**************************************************/

contrib/btree_gist/btree_inet.c

-7
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@ PG_FUNCTION_INFO_V1(gbt_inet_consistent);
2525
PG_FUNCTION_INFO_V1(gbt_inet_penalty);
2626
PG_FUNCTION_INFO_V1(gbt_inet_same);
2727

28-
Datum gbt_inet_compress(PG_FUNCTION_ARGS);
29-
Datum gbt_inet_union(PG_FUNCTION_ARGS);
30-
Datum gbt_inet_picksplit(PG_FUNCTION_ARGS);
31-
Datum gbt_inet_consistent(PG_FUNCTION_ARGS);
32-
Datum gbt_inet_penalty(PG_FUNCTION_ARGS);
33-
Datum gbt_inet_same(PG_FUNCTION_ARGS);
34-
3528

3629
static bool
3730
gbt_inetgt(const void *a, const void *b)

contrib/btree_gist/btree_int2.c

-9
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@ PG_FUNCTION_INFO_V1(gbt_int2_distance);
2323
PG_FUNCTION_INFO_V1(gbt_int2_penalty);
2424
PG_FUNCTION_INFO_V1(gbt_int2_same);
2525

26-
Datum gbt_int2_compress(PG_FUNCTION_ARGS);
27-
Datum gbt_int2_union(PG_FUNCTION_ARGS);
28-
Datum gbt_int2_picksplit(PG_FUNCTION_ARGS);
29-
Datum gbt_int2_consistent(PG_FUNCTION_ARGS);
30-
Datum gbt_int2_distance(PG_FUNCTION_ARGS);
31-
Datum gbt_int2_penalty(PG_FUNCTION_ARGS);
32-
Datum gbt_int2_same(PG_FUNCTION_ARGS);
33-
3426
static bool
3527
gbt_int2gt(const void *a, const void *b)
3628
{
@@ -96,7 +88,6 @@ static const gbtree_ninfo tinfo =
9688

9789

9890
PG_FUNCTION_INFO_V1(int2_dist);
99-
Datum int2_dist(PG_FUNCTION_ARGS);
10091
Datum
10192
int2_dist(PG_FUNCTION_ARGS)
10293
{

contrib/btree_gist/btree_int4.c

-9
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@ PG_FUNCTION_INFO_V1(gbt_int4_distance);
2323
PG_FUNCTION_INFO_V1(gbt_int4_penalty);
2424
PG_FUNCTION_INFO_V1(gbt_int4_same);
2525

26-
Datum gbt_int4_compress(PG_FUNCTION_ARGS);
27-
Datum gbt_int4_union(PG_FUNCTION_ARGS);
28-
Datum gbt_int4_picksplit(PG_FUNCTION_ARGS);
29-
Datum gbt_int4_consistent(PG_FUNCTION_ARGS);
30-
Datum gbt_int4_distance(PG_FUNCTION_ARGS);
31-
Datum gbt_int4_penalty(PG_FUNCTION_ARGS);
32-
Datum gbt_int4_same(PG_FUNCTION_ARGS);
33-
3426

3527
static bool
3628
gbt_int4gt(const void *a, const void *b)
@@ -97,7 +89,6 @@ static const gbtree_ninfo tinfo =
9789

9890

9991
PG_FUNCTION_INFO_V1(int4_dist);
100-
Datum int4_dist(PG_FUNCTION_ARGS);
10192
Datum
10293
int4_dist(PG_FUNCTION_ARGS)
10394
{

contrib/btree_gist/btree_int8.c

-9
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@ PG_FUNCTION_INFO_V1(gbt_int8_distance);
2323
PG_FUNCTION_INFO_V1(gbt_int8_penalty);
2424
PG_FUNCTION_INFO_V1(gbt_int8_same);
2525

26-
Datum gbt_int8_compress(PG_FUNCTION_ARGS);
27-
Datum gbt_int8_union(PG_FUNCTION_ARGS);
28-
Datum gbt_int8_picksplit(PG_FUNCTION_ARGS);
29-
Datum gbt_int8_consistent(PG_FUNCTION_ARGS);
30-
Datum gbt_int8_distance(PG_FUNCTION_ARGS);
31-
Datum gbt_int8_penalty(PG_FUNCTION_ARGS);
32-
Datum gbt_int8_same(PG_FUNCTION_ARGS);
33-
3426

3527
static bool
3628
gbt_int8gt(const void *a, const void *b)
@@ -97,7 +89,6 @@ static const gbtree_ninfo tinfo =
9789

9890

9991
PG_FUNCTION_INFO_V1(int8_dist);
100-
Datum int8_dist(PG_FUNCTION_ARGS);
10192
Datum
10293
int8_dist(PG_FUNCTION_ARGS)
10394
{

contrib/btree_gist/btree_interval.c

-10
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,6 @@ PG_FUNCTION_INFO_V1(gbt_intv_distance);
2626
PG_FUNCTION_INFO_V1(gbt_intv_penalty);
2727
PG_FUNCTION_INFO_V1(gbt_intv_same);
2828

29-
Datum gbt_intv_compress(PG_FUNCTION_ARGS);
30-
Datum gbt_intv_decompress(PG_FUNCTION_ARGS);
31-
Datum gbt_intv_union(PG_FUNCTION_ARGS);
32-
Datum gbt_intv_picksplit(PG_FUNCTION_ARGS);
33-
Datum gbt_intv_consistent(PG_FUNCTION_ARGS);
34-
Datum gbt_intv_distance(PG_FUNCTION_ARGS);
35-
Datum gbt_intv_penalty(PG_FUNCTION_ARGS);
36-
Datum gbt_intv_same(PG_FUNCTION_ARGS);
37-
3829

3930
static bool
4031
gbt_intvgt(const void *a, const void *b)
@@ -129,7 +120,6 @@ abs_interval(Interval *a)
129120
}
130121

131122
PG_FUNCTION_INFO_V1(interval_dist);
132-
Datum interval_dist(PG_FUNCTION_ARGS);
133123
Datum
134124
interval_dist(PG_FUNCTION_ARGS)
135125
{

contrib/btree_gist/btree_macaddr.c

-7
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ PG_FUNCTION_INFO_V1(gbt_macad_consistent);
2424
PG_FUNCTION_INFO_V1(gbt_macad_penalty);
2525
PG_FUNCTION_INFO_V1(gbt_macad_same);
2626

27-
Datum gbt_macad_compress(PG_FUNCTION_ARGS);
28-
Datum gbt_macad_union(PG_FUNCTION_ARGS);
29-
Datum gbt_macad_picksplit(PG_FUNCTION_ARGS);
30-
Datum gbt_macad_consistent(PG_FUNCTION_ARGS);
31-
Datum gbt_macad_penalty(PG_FUNCTION_ARGS);
32-
Datum gbt_macad_same(PG_FUNCTION_ARGS);
33-
3427

3528
static bool
3629
gbt_macadgt(const void *a, const void *b)

contrib/btree_gist/btree_numeric.c

-7
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,6 @@ PG_FUNCTION_INFO_V1(gbt_numeric_consistent);
2323
PG_FUNCTION_INFO_V1(gbt_numeric_penalty);
2424
PG_FUNCTION_INFO_V1(gbt_numeric_same);
2525

26-
Datum gbt_numeric_compress(PG_FUNCTION_ARGS);
27-
Datum gbt_numeric_union(PG_FUNCTION_ARGS);
28-
Datum gbt_numeric_picksplit(PG_FUNCTION_ARGS);
29-
Datum gbt_numeric_consistent(PG_FUNCTION_ARGS);
30-
Datum gbt_numeric_penalty(PG_FUNCTION_ARGS);
31-
Datum gbt_numeric_same(PG_FUNCTION_ARGS);
32-
3326

3427
/* define for comparison */
3528

contrib/btree_gist/btree_oid.c

-9
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@ PG_FUNCTION_INFO_V1(gbt_oid_distance);
2323
PG_FUNCTION_INFO_V1(gbt_oid_penalty);
2424
PG_FUNCTION_INFO_V1(gbt_oid_same);
2525

26-
Datum gbt_oid_compress(PG_FUNCTION_ARGS);
27-
Datum gbt_oid_union(PG_FUNCTION_ARGS);
28-
Datum gbt_oid_picksplit(PG_FUNCTION_ARGS);
29-
Datum gbt_oid_consistent(PG_FUNCTION_ARGS);
30-
Datum gbt_oid_distance(PG_FUNCTION_ARGS);
31-
Datum gbt_oid_penalty(PG_FUNCTION_ARGS);
32-
Datum gbt_oid_same(PG_FUNCTION_ARGS);
33-
3426

3527
static bool
3628
gbt_oidgt(const void *a, const void *b)
@@ -103,7 +95,6 @@ static const gbtree_ninfo tinfo =
10395

10496

10597
PG_FUNCTION_INFO_V1(oid_dist);
106-
Datum oid_dist(PG_FUNCTION_ARGS);
10798
Datum
10899
oid_dist(PG_FUNCTION_ARGS)
109100
{

contrib/btree_gist/btree_text.c

-9
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,6 @@ PG_FUNCTION_INFO_V1(gbt_bpchar_consistent);
1919
PG_FUNCTION_INFO_V1(gbt_text_penalty);
2020
PG_FUNCTION_INFO_V1(gbt_text_same);
2121

22-
Datum gbt_text_compress(PG_FUNCTION_ARGS);
23-
Datum gbt_bpchar_compress(PG_FUNCTION_ARGS);
24-
Datum gbt_text_union(PG_FUNCTION_ARGS);
25-
Datum gbt_text_picksplit(PG_FUNCTION_ARGS);
26-
Datum gbt_text_consistent(PG_FUNCTION_ARGS);
27-
Datum gbt_bpchar_consistent(PG_FUNCTION_ARGS);
28-
Datum gbt_text_penalty(PG_FUNCTION_ARGS);
29-
Datum gbt_text_same(PG_FUNCTION_ARGS);
30-
3122

3223
/* define for comparison */
3324

contrib/btree_gist/btree_time.c

-11
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,6 @@ PG_FUNCTION_INFO_V1(gbt_timetz_consistent);
2727
PG_FUNCTION_INFO_V1(gbt_time_penalty);
2828
PG_FUNCTION_INFO_V1(gbt_time_same);
2929

30-
Datum gbt_time_compress(PG_FUNCTION_ARGS);
31-
Datum gbt_timetz_compress(PG_FUNCTION_ARGS);
32-
Datum gbt_time_union(PG_FUNCTION_ARGS);
33-
Datum gbt_time_picksplit(PG_FUNCTION_ARGS);
34-
Datum gbt_time_consistent(PG_FUNCTION_ARGS);
35-
Datum gbt_time_distance(PG_FUNCTION_ARGS);
36-
Datum gbt_timetz_consistent(PG_FUNCTION_ARGS);
37-
Datum gbt_time_penalty(PG_FUNCTION_ARGS);
38-
Datum gbt_time_same(PG_FUNCTION_ARGS);
39-
4030

4131
#ifdef USE_FLOAT8_BYVAL
4232
#define TimeADTGetDatumFast(X) TimeADTGetDatum(X)
@@ -145,7 +135,6 @@ static const gbtree_ninfo tinfo =
145135

146136

147137
PG_FUNCTION_INFO_V1(time_dist);
148-
Datum time_dist(PG_FUNCTION_ARGS);
149138
Datum
150139
time_dist(PG_FUNCTION_ARGS)
151140
{

0 commit comments

Comments
 (0)