mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +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:
@@ -348,6 +348,7 @@ typedef const Pg_finfo_record *(*PGFInfoFunction) (void);
|
||||
* doesn't hurt to add PGDLLIMPORT in case they don't.
|
||||
*/
|
||||
#define PG_FUNCTION_INFO_V1(funcname) \
|
||||
Datum funcname(PG_FUNCTION_ARGS); \
|
||||
extern PGDLLEXPORT const Pg_finfo_record * CppConcat(pg_finfo_,funcname)(void); \
|
||||
const Pg_finfo_record * \
|
||||
CppConcat(pg_finfo_,funcname) (void) \
|
||||
|
@@ -240,12 +240,6 @@ static plperl_call_data *current_call_data = NULL;
|
||||
/**********************************************************************
|
||||
* Forward declarations
|
||||
**********************************************************************/
|
||||
Datum plperl_call_handler(PG_FUNCTION_ARGS);
|
||||
Datum plperl_inline_handler(PG_FUNCTION_ARGS);
|
||||
Datum plperl_validator(PG_FUNCTION_ARGS);
|
||||
Datum plperlu_call_handler(PG_FUNCTION_ARGS);
|
||||
Datum plperlu_inline_handler(PG_FUNCTION_ARGS);
|
||||
Datum plperlu_validator(PG_FUNCTION_ARGS);
|
||||
void _PG_init(void);
|
||||
|
||||
static PerlInterpreter *plperl_init_interp(void);
|
||||
|
@@ -950,9 +950,6 @@ extern void plpgsql_HashTableInit(void);
|
||||
* ----------
|
||||
*/
|
||||
extern void _PG_init(void);
|
||||
extern Datum plpgsql_call_handler(PG_FUNCTION_ARGS);
|
||||
extern Datum plpgsql_inline_handler(PG_FUNCTION_ARGS);
|
||||
extern Datum plpgsql_validator(PG_FUNCTION_ARGS);
|
||||
|
||||
/* ----------
|
||||
* Functions in pl_exec.c
|
||||
|
@@ -40,16 +40,6 @@
|
||||
#endif
|
||||
|
||||
extern void _PG_init(void);
|
||||
extern Datum plpython_validator(PG_FUNCTION_ARGS);
|
||||
extern Datum plpython_call_handler(PG_FUNCTION_ARGS);
|
||||
extern Datum plpython_inline_handler(PG_FUNCTION_ARGS);
|
||||
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
/* Define aliases plpython2_call_handler etc */
|
||||
extern Datum plpython2_validator(PG_FUNCTION_ARGS);
|
||||
extern Datum plpython2_call_handler(PG_FUNCTION_ARGS);
|
||||
extern Datum plpython2_inline_handler(PG_FUNCTION_ARGS);
|
||||
#endif
|
||||
|
||||
PG_MODULE_MAGIC;
|
||||
|
||||
@@ -58,6 +48,7 @@ PG_FUNCTION_INFO_V1(plpython_call_handler);
|
||||
PG_FUNCTION_INFO_V1(plpython_inline_handler);
|
||||
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
/* Define aliases plpython2_call_handler etc */
|
||||
PG_FUNCTION_INFO_V1(plpython2_validator);
|
||||
PG_FUNCTION_INFO_V1(plpython2_call_handler);
|
||||
PG_FUNCTION_INFO_V1(plpython2_inline_handler);
|
||||
|
@@ -192,8 +192,6 @@ static pltcl_proc_desc *pltcl_current_prodesc = NULL;
|
||||
/**********************************************************************
|
||||
* Forward declarations
|
||||
**********************************************************************/
|
||||
Datum pltcl_call_handler(PG_FUNCTION_ARGS);
|
||||
Datum pltclu_call_handler(PG_FUNCTION_ARGS);
|
||||
void _PG_init(void);
|
||||
|
||||
static void pltcl_init_interp(pltcl_interp_desc *interp_desc, bool pltrusted);
|
||||
|
@@ -28,18 +28,10 @@
|
||||
#define RDELIM ')'
|
||||
#define DELIM ','
|
||||
|
||||
extern Datum regress_dist_ptpath(PG_FUNCTION_ARGS);
|
||||
extern Datum regress_path_dist(PG_FUNCTION_ARGS);
|
||||
extern PATH *poly2path(POLYGON *poly);
|
||||
extern Datum interpt_pp(PG_FUNCTION_ARGS);
|
||||
extern void regress_lseg_construct(LSEG *lseg, Point *pt1, Point *pt2);
|
||||
extern Datum overpaid(PG_FUNCTION_ARGS);
|
||||
extern Datum boxarea(PG_FUNCTION_ARGS);
|
||||
extern char *reverse_name(char *string);
|
||||
extern int oldstyle_length(int n, text *t);
|
||||
extern Datum int44in(PG_FUNCTION_ARGS);
|
||||
extern Datum int44out(PG_FUNCTION_ARGS);
|
||||
extern Datum make_tuple_indirect(PG_FUNCTION_ARGS);
|
||||
|
||||
#ifdef PG_MODULE_MAGIC
|
||||
PG_MODULE_MAGIC;
|
||||
@@ -236,7 +228,6 @@ typedef struct
|
||||
|
||||
WIDGET *widget_in(char *str);
|
||||
char *widget_out(WIDGET * widget);
|
||||
extern Datum pt_in_widget(PG_FUNCTION_ARGS);
|
||||
|
||||
#define NARGS 3
|
||||
|
||||
@@ -341,7 +332,6 @@ static int fd17b_level = 0;
|
||||
static int fd17a_level = 0;
|
||||
static bool fd17b_recursion = true;
|
||||
static bool fd17a_recursion = true;
|
||||
extern Datum funny_dup17(PG_FUNCTION_ARGS);
|
||||
|
||||
PG_FUNCTION_INFO_V1(funny_dup17);
|
||||
|
||||
@@ -453,9 +443,6 @@ funny_dup17(PG_FUNCTION_ARGS)
|
||||
return PointerGetDatum(tuple);
|
||||
}
|
||||
|
||||
extern Datum ttdummy(PG_FUNCTION_ARGS);
|
||||
extern Datum set_ttdummy(PG_FUNCTION_ARGS);
|
||||
|
||||
#define TTDUMMY_INFINITY 999999
|
||||
|
||||
static SPIPlanPtr splan = NULL;
|
||||
|
Reference in New Issue
Block a user