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

Lines changed: 0 additions & 5 deletions
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

Lines changed: 0 additions & 5 deletions
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

Lines changed: 0 additions & 8 deletions
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

Lines changed: 0 additions & 7 deletions
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

Lines changed: 0 additions & 9 deletions
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

Lines changed: 0 additions & 9 deletions
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

Lines changed: 0 additions & 9 deletions
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

Lines changed: 0 additions & 9 deletions
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

Lines changed: 0 additions & 2 deletions
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

Lines changed: 0 additions & 7 deletions
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)

0 commit comments

Comments
 (0)