1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

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.
This commit is contained in:
Peter Eisentraut
2014-04-18 00:03:19 -04:00
parent 0156315823
commit e7128e8dbb
88 changed files with 9 additions and 670 deletions

View File

@ -194,7 +194,6 @@ extern Pairs *hstoreArrayToPairs(ArrayType *a, int *npairs);
#if HSTORE_POLLUTE_NAMESPACE
#define HSTORE_POLLUTE(newname_,oldname_) \
PG_FUNCTION_INFO_V1(oldname_); \
Datum oldname_(PG_FUNCTION_ARGS); \
Datum newname_(PG_FUNCTION_ARGS); \
Datum oldname_(PG_FUNCTION_ARGS) { return newname_(fcinfo); } \
extern int no_such_variable

View File

@ -357,7 +357,6 @@ hstoreUpgrade(Datum orig)
PG_FUNCTION_INFO_V1(hstore_version_diag);
Datum hstore_version_diag(PG_FUNCTION_ARGS);
Datum
hstore_version_diag(PG_FUNCTION_ARGS)
{

View File

@ -22,7 +22,6 @@
#define NULLFLAG 'N'
PG_FUNCTION_INFO_V1(gin_extract_hstore);
Datum gin_extract_hstore(PG_FUNCTION_ARGS);
/* Build an indexable text value */
static text *
@ -76,7 +75,6 @@ gin_extract_hstore(PG_FUNCTION_ARGS)
}
PG_FUNCTION_INFO_V1(gin_extract_hstore_query);
Datum gin_extract_hstore_query(PG_FUNCTION_ARGS);
Datum
gin_extract_hstore_query(PG_FUNCTION_ARGS)
@ -148,7 +146,6 @@ gin_extract_hstore_query(PG_FUNCTION_ARGS)
}
PG_FUNCTION_INFO_V1(gin_consistent_hstore);
Datum gin_consistent_hstore(PG_FUNCTION_ARGS);
Datum
gin_consistent_hstore(PG_FUNCTION_ARGS)

View File

@ -69,10 +69,7 @@ typedef struct
#define WISH_F(a,b,c) (double)( -(double)(((a)-(b))*((a)-(b))*((a)-(b)))*(c) )
PG_FUNCTION_INFO_V1(ghstore_in);
Datum ghstore_in(PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1(ghstore_out);
Datum ghstore_out(PG_FUNCTION_ARGS);
Datum
@ -97,14 +94,6 @@ PG_FUNCTION_INFO_V1(ghstore_picksplit);
PG_FUNCTION_INFO_V1(ghstore_union);
PG_FUNCTION_INFO_V1(ghstore_same);
Datum ghstore_consistent(PG_FUNCTION_ARGS);
Datum ghstore_compress(PG_FUNCTION_ARGS);
Datum ghstore_decompress(PG_FUNCTION_ARGS);
Datum ghstore_penalty(PG_FUNCTION_ARGS);
Datum ghstore_picksplit(PG_FUNCTION_ARGS);
Datum ghstore_union(PG_FUNCTION_ARGS);
Datum ghstore_same(PG_FUNCTION_ARGS);
Datum
ghstore_compress(PG_FUNCTION_ARGS)
{

View File

@ -401,7 +401,6 @@ hstorePairs(Pairs *pairs, int32 pcount, int32 buflen)
PG_FUNCTION_INFO_V1(hstore_in);
Datum hstore_in(PG_FUNCTION_ARGS);
Datum
hstore_in(PG_FUNCTION_ARGS)
{
@ -422,7 +421,6 @@ hstore_in(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(hstore_recv);
Datum hstore_recv(PG_FUNCTION_ARGS);
Datum
hstore_recv(PG_FUNCTION_ARGS)
{
@ -486,7 +484,6 @@ hstore_recv(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(hstore_from_text);
Datum hstore_from_text(PG_FUNCTION_ARGS);
Datum
hstore_from_text(PG_FUNCTION_ARGS)
{
@ -523,7 +520,6 @@ hstore_from_text(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(hstore_from_arrays);
Datum hstore_from_arrays(PG_FUNCTION_ARGS);
Datum
hstore_from_arrays(PG_FUNCTION_ARGS)
{
@ -641,7 +637,6 @@ hstore_from_arrays(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(hstore_from_array);
Datum hstore_from_array(PG_FUNCTION_ARGS);
Datum
hstore_from_array(PG_FUNCTION_ARGS)
{
@ -755,7 +750,6 @@ typedef struct RecordIOData
} RecordIOData;
PG_FUNCTION_INFO_V1(hstore_from_record);
Datum hstore_from_record(PG_FUNCTION_ARGS);
Datum
hstore_from_record(PG_FUNCTION_ARGS)
{
@ -909,7 +903,6 @@ hstore_from_record(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(hstore_populate_record);
Datum hstore_populate_record(PG_FUNCTION_ARGS);
Datum
hstore_populate_record(PG_FUNCTION_ARGS)
{
@ -1122,7 +1115,6 @@ cpw(char *dst, char *src, int len)
}
PG_FUNCTION_INFO_V1(hstore_out);
Datum hstore_out(PG_FUNCTION_ARGS);
Datum
hstore_out(PG_FUNCTION_ARGS)
{
@ -1194,7 +1186,6 @@ hstore_out(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(hstore_send);
Datum hstore_send(PG_FUNCTION_ARGS);
Datum
hstore_send(PG_FUNCTION_ARGS)
{
@ -1241,7 +1232,6 @@ hstore_send(PG_FUNCTION_ARGS)
* (think zip codes or phone numbers starting with 0).
*/
PG_FUNCTION_INFO_V1(hstore_to_json_loose);
Datum hstore_to_json_loose(PG_FUNCTION_ARGS);
Datum
hstore_to_json_loose(PG_FUNCTION_ARGS)
{
@ -1333,7 +1323,6 @@ hstore_to_json_loose(PG_FUNCTION_ARGS)
}
PG_FUNCTION_INFO_V1(hstore_to_json);
Datum hstore_to_json(PG_FUNCTION_ARGS);
Datum
hstore_to_json(PG_FUNCTION_ARGS)
{
@ -1377,7 +1366,6 @@ hstore_to_json(PG_FUNCTION_ARGS)
}
PG_FUNCTION_INFO_V1(hstore_to_jsonb);
Datum hstore_to_jsonb(PG_FUNCTION_ARGS);
Datum
hstore_to_jsonb(PG_FUNCTION_ARGS)
{
@ -1425,7 +1413,6 @@ hstore_to_jsonb(PG_FUNCTION_ARGS)
}
PG_FUNCTION_INFO_V1(hstore_to_jsonb_loose);
Datum hstore_to_jsonb_loose(PG_FUNCTION_ARGS);
Datum
hstore_to_jsonb_loose(PG_FUNCTION_ARGS)
{

View File

@ -127,7 +127,6 @@ hstoreArrayToPairs(ArrayType *a, int *npairs)
PG_FUNCTION_INFO_V1(hstore_fetchval);
Datum hstore_fetchval(PG_FUNCTION_ARGS);
Datum
hstore_fetchval(PG_FUNCTION_ARGS)
{
@ -149,7 +148,6 @@ hstore_fetchval(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(hstore_exists);
Datum hstore_exists(PG_FUNCTION_ARGS);
Datum
hstore_exists(PG_FUNCTION_ARGS)
{
@ -163,7 +161,6 @@ hstore_exists(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(hstore_exists_any);
Datum hstore_exists_any(PG_FUNCTION_ARGS);
Datum
hstore_exists_any(PG_FUNCTION_ARGS)
{
@ -198,7 +195,6 @@ hstore_exists_any(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(hstore_exists_all);
Datum hstore_exists_all(PG_FUNCTION_ARGS);
Datum
hstore_exists_all(PG_FUNCTION_ARGS)
{
@ -233,7 +229,6 @@ hstore_exists_all(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(hstore_defined);
Datum hstore_defined(PG_FUNCTION_ARGS);
Datum
hstore_defined(PG_FUNCTION_ARGS)
{
@ -249,7 +244,6 @@ hstore_defined(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(hstore_delete);
Datum hstore_delete(PG_FUNCTION_ARGS);
Datum
hstore_delete(PG_FUNCTION_ARGS)
{
@ -296,7 +290,6 @@ hstore_delete(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(hstore_delete_array);
Datum hstore_delete_array(PG_FUNCTION_ARGS);
Datum
hstore_delete_array(PG_FUNCTION_ARGS)
{
@ -376,7 +369,6 @@ hstore_delete_array(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(hstore_delete_hstore);
Datum hstore_delete_hstore(PG_FUNCTION_ARGS);
Datum
hstore_delete_hstore(PG_FUNCTION_ARGS)
{
@ -476,7 +468,6 @@ hstore_delete_hstore(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(hstore_concat);
Datum hstore_concat(PG_FUNCTION_ARGS);
Datum
hstore_concat(PG_FUNCTION_ARGS)
{
@ -575,7 +566,6 @@ hstore_concat(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(hstore_slice_to_array);
Datum hstore_slice_to_array(PG_FUNCTION_ARGS);
Datum
hstore_slice_to_array(PG_FUNCTION_ARGS)
{
@ -639,7 +629,6 @@ hstore_slice_to_array(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(hstore_slice_to_hstore);
Datum hstore_slice_to_hstore(PG_FUNCTION_ARGS);
Datum
hstore_slice_to_hstore(PG_FUNCTION_ARGS)
{
@ -702,7 +691,6 @@ hstore_slice_to_hstore(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(hstore_akeys);
Datum hstore_akeys(PG_FUNCTION_ARGS);
Datum
hstore_akeys(PG_FUNCTION_ARGS)
{
@ -738,7 +726,6 @@ hstore_akeys(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(hstore_avals);
Datum hstore_avals(PG_FUNCTION_ARGS);
Datum
hstore_avals(PG_FUNCTION_ARGS)
{
@ -835,7 +822,6 @@ hstore_to_array_internal(HStore *hs, int ndims)
}
PG_FUNCTION_INFO_V1(hstore_to_array);
Datum hstore_to_array(PG_FUNCTION_ARGS);
Datum
hstore_to_array(PG_FUNCTION_ARGS)
{
@ -846,7 +832,6 @@ hstore_to_array(PG_FUNCTION_ARGS)
}
PG_FUNCTION_INFO_V1(hstore_to_matrix);
Datum hstore_to_matrix(PG_FUNCTION_ARGS);
Datum
hstore_to_matrix(PG_FUNCTION_ARGS)
{
@ -895,7 +880,6 @@ setup_firstcall(FuncCallContext *funcctx, HStore *hs,
PG_FUNCTION_INFO_V1(hstore_skeys);
Datum hstore_skeys(PG_FUNCTION_ARGS);
Datum
hstore_skeys(PG_FUNCTION_ARGS)
{
@ -930,7 +914,6 @@ hstore_skeys(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(hstore_svals);
Datum hstore_svals(PG_FUNCTION_ARGS);
Datum
hstore_svals(PG_FUNCTION_ARGS)
{
@ -979,7 +962,6 @@ hstore_svals(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(hstore_contains);
Datum hstore_contains(PG_FUNCTION_ARGS);
Datum
hstore_contains(PG_FUNCTION_ARGS)
{
@ -1026,7 +1008,6 @@ hstore_contains(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(hstore_contained);
Datum hstore_contained(PG_FUNCTION_ARGS);
Datum
hstore_contained(PG_FUNCTION_ARGS)
{
@ -1038,7 +1019,6 @@ hstore_contained(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(hstore_each);
Datum hstore_each(PG_FUNCTION_ARGS);
Datum
hstore_each(PG_FUNCTION_ARGS)
{
@ -1100,7 +1080,6 @@ hstore_each(PG_FUNCTION_ARGS)
*/
PG_FUNCTION_INFO_V1(hstore_cmp);
Datum hstore_cmp(PG_FUNCTION_ARGS);
Datum
hstore_cmp(PG_FUNCTION_ARGS)
{
@ -1182,7 +1161,6 @@ hstore_cmp(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(hstore_eq);
Datum hstore_eq(PG_FUNCTION_ARGS);
Datum
hstore_eq(PG_FUNCTION_ARGS)
{
@ -1194,7 +1172,6 @@ hstore_eq(PG_FUNCTION_ARGS)
}
PG_FUNCTION_INFO_V1(hstore_ne);
Datum hstore_ne(PG_FUNCTION_ARGS);
Datum
hstore_ne(PG_FUNCTION_ARGS)
{
@ -1206,7 +1183,6 @@ hstore_ne(PG_FUNCTION_ARGS)
}
PG_FUNCTION_INFO_V1(hstore_gt);
Datum hstore_gt(PG_FUNCTION_ARGS);
Datum
hstore_gt(PG_FUNCTION_ARGS)
{
@ -1218,7 +1194,6 @@ hstore_gt(PG_FUNCTION_ARGS)
}
PG_FUNCTION_INFO_V1(hstore_ge);
Datum hstore_ge(PG_FUNCTION_ARGS);
Datum
hstore_ge(PG_FUNCTION_ARGS)
{
@ -1230,7 +1205,6 @@ hstore_ge(PG_FUNCTION_ARGS)
}
PG_FUNCTION_INFO_V1(hstore_lt);
Datum hstore_lt(PG_FUNCTION_ARGS);
Datum
hstore_lt(PG_FUNCTION_ARGS)
{
@ -1242,7 +1216,6 @@ hstore_lt(PG_FUNCTION_ARGS)
}
PG_FUNCTION_INFO_V1(hstore_le);
Datum hstore_le(PG_FUNCTION_ARGS);
Datum
hstore_le(PG_FUNCTION_ARGS)
{
@ -1255,7 +1228,6 @@ hstore_le(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(hstore_hash);
Datum hstore_hash(PG_FUNCTION_ARGS);
Datum
hstore_hash(PG_FUNCTION_ARGS)
{