aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2014-04-18 00:03:19 -0400
committerPeter Eisentraut <peter_e@gmx.net>2014-04-18 00:03:19 -0400
commite7128e8dbb305059c30ec085461297e619bcbff4 (patch)
treeed4bf968847b30a098d113bb787adc2b97c687e0 /src
parent01563158235f5650743fd9b1dfa80c3d8faf89bb (diff)
downloadpostgresql-e7128e8dbb305059c30ec085461297e619bcbff4.tar.gz
postgresql-e7128e8dbb305059c30ec085461297e619bcbff4.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/include/fmgr.h1
-rw-r--r--src/pl/plperl/plperl.c6
-rw-r--r--src/pl/plpgsql/src/plpgsql.h3
-rw-r--r--src/pl/plpython/plpy_main.c11
-rw-r--r--src/pl/tcl/pltcl.c2
-rw-r--r--src/test/regress/regress.c13
6 files changed, 2 insertions, 34 deletions
diff --git a/src/include/fmgr.h b/src/include/fmgr.h
index aed81cdc26b..494c768826b 100644
--- a/src/include/fmgr.h
+++ b/src/include/fmgr.h
@@ -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) \
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c
index 5fff63558f1..ffdf634f55b 100644
--- a/src/pl/plperl/plperl.c
+++ b/src/pl/plperl/plperl.c
@@ -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);
diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h
index 41fc9407a22..b4d1498e436 100644
--- a/src/pl/plpgsql/src/plpgsql.h
+++ b/src/pl/plpgsql/src/plpgsql.h
@@ -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
diff --git a/src/pl/plpython/plpy_main.c b/src/pl/plpython/plpy_main.c
index 4438721589e..5f03efa4fb6 100644
--- a/src/pl/plpython/plpy_main.c
+++ b/src/pl/plpython/plpy_main.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);
diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c
index 2d862a6b059..8c18d5ea205 100644
--- a/src/pl/tcl/pltcl.c
+++ b/src/pl/tcl/pltcl.c
@@ -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);
diff --git a/src/test/regress/regress.c b/src/test/regress/regress.c
index 4dbe314557e..c25bf6e09d1 100644
--- a/src/test/regress/regress.c
+++ b/src/test/regress/regress.c
@@ -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;