From 56267aef457920f69289bb701830d920f340f9a8 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sat, 16 Jul 2022 12:55:22 -0700
Subject: [PATCH v3 2/4] Remove now superfluous declarations of other dlsym()ed
 symbols.

After the prior commit they're declared centrally.

Discussion: https://postgr.es/m/20211101020311.av6hphdl6xbjbuif@alap3.anarazel.de
---
 src/backend/replication/libpqwalreceiver/libpqwalreceiver.c  | 2 --
 src/backend/replication/pgoutput/pgoutput.c                  | 2 --
 src/pl/plperl/plperl.c                                       | 1 -
 src/pl/plpgsql/src/plpgsql.h                                 | 5 -----
 src/pl/plpython/plpy_main.c                                  | 2 --
 src/pl/tcl/pltcl.c                                           | 1 -
 contrib/auth_delay/auth_delay.c                              | 2 --
 contrib/auto_explain/auto_explain.c                          | 2 --
 contrib/basebackup_to_shell/basebackup_to_shell.c            | 2 --
 contrib/basic_archive/basic_archive.c                        | 3 ---
 contrib/bloom/bloom.h                                        | 1 -
 contrib/hstore_plperl/hstore_plperl.c                        | 2 --
 contrib/hstore_plpython/hstore_plpython.c                    | 2 --
 contrib/isn/isn.c                                            | 2 --
 contrib/jsonb_plpython/jsonb_plpython.c                      | 2 --
 contrib/ltree_plpython/ltree_plpython.c                      | 2 --
 contrib/passwordcheck/passwordcheck.c                        | 2 --
 contrib/pg_prewarm/autoprewarm.c                             | 1 -
 contrib/pg_stat_statements/pg_stat_statements.c              | 2 --
 contrib/pg_trgm/trgm_op.c                                    | 2 --
 contrib/postgres_fdw/option.c                                | 2 --
 contrib/sepgsql/hooks.c                                      | 1 -
 contrib/test_decoding/test_decoding.c                        | 4 ----
 src/test/modules/delay_execution/delay_execution.c           | 3 ---
 src/test/modules/dummy_index_am/dummy_index_am.c             | 2 --
 src/test/modules/dummy_seclabel/dummy_seclabel.c             | 3 ---
 .../modules/ssl_passphrase_callback/ssl_passphrase_func.c    | 2 --
 src/test/modules/test_oat_hooks/test_oat_hooks.c             | 2 --
 src/test/modules/test_rls_hooks/test_rls_hooks.c             | 2 --
 src/test/modules/test_shm_mq/test.c                          | 2 --
 src/test/modules/worker_spi/worker_spi.c                     | 1 -
 31 files changed, 64 deletions(-)

diff --git a/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c b/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
index 0d89db4e6a6..0b775b1e985 100644
--- a/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
+++ b/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
@@ -36,8 +36,6 @@
 
 PG_MODULE_MAGIC;
 
-void		_PG_init(void);
-
 struct WalReceiverConn
 {
 	/* Current connection to the primary, if any */
diff --git a/src/backend/replication/pgoutput/pgoutput.c b/src/backend/replication/pgoutput/pgoutput.c
index 2cbca4a0870..ba8a24d0999 100644
--- a/src/backend/replication/pgoutput/pgoutput.c
+++ b/src/backend/replication/pgoutput/pgoutput.c
@@ -35,8 +35,6 @@
 
 PG_MODULE_MAGIC;
 
-extern void _PG_output_plugin_init(OutputPluginCallbacks *cb);
-
 static void pgoutput_startup(LogicalDecodingContext *ctx,
 							 OutputPluginOptions *opt, bool is_init);
 static void pgoutput_shutdown(LogicalDecodingContext *ctx);
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c
index edb93ec1c4c..af354a68ccd 100644
--- a/src/pl/plperl/plperl.c
+++ b/src/pl/plperl/plperl.c
@@ -245,7 +245,6 @@ static plperl_call_data *current_call_data = NULL;
 /**********************************************************************
  * Forward declarations
  **********************************************************************/
-void		_PG_init(void);
 
 static PerlInterpreter *plperl_init_interp(void);
 static void plperl_destroy_interp(PerlInterpreter **);
diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h
index 4e6ee1c6198..19141602729 100644
--- a/src/pl/plpgsql/src/plpgsql.h
+++ b/src/pl/plpgsql/src/plpgsql.h
@@ -1264,11 +1264,6 @@ extern void plpgsql_adddatum(PLpgSQL_datum *newdatum);
 extern int	plpgsql_add_initdatums(int **varnos);
 extern void plpgsql_HashTableInit(void);
 
-/*
- * Functions in pl_handler.c
- */
-extern void _PG_init(void);
-
 /*
  * Functions in pl_exec.c
  */
diff --git a/src/pl/plpython/plpy_main.c b/src/pl/plpython/plpy_main.c
index 0bce1064951..a4d66f3057f 100644
--- a/src/pl/plpython/plpy_main.c
+++ b/src/pl/plpython/plpy_main.c
@@ -28,8 +28,6 @@
  * exported functions
  */
 
-extern void _PG_init(void);
-
 PG_MODULE_MAGIC;
 
 PG_FUNCTION_INFO_V1(plpython3_validator);
diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c
index 0dd6d8ab2c2..eaa98d42c2e 100644
--- a/src/pl/tcl/pltcl.c
+++ b/src/pl/tcl/pltcl.c
@@ -261,7 +261,6 @@ static const TclExceptionNameMap exception_name_map[] = {
 /**********************************************************************
  * Forward declarations
  **********************************************************************/
-void		_PG_init(void);
 
 static void pltcl_init_interp(pltcl_interp_desc *interp_desc,
 							  Oid prolang, bool pltrusted);
diff --git a/contrib/auth_delay/auth_delay.c b/contrib/auth_delay/auth_delay.c
index 6b94d653ea4..c3d78e5020f 100644
--- a/contrib/auth_delay/auth_delay.c
+++ b/contrib/auth_delay/auth_delay.c
@@ -20,8 +20,6 @@
 
 PG_MODULE_MAGIC;
 
-void		_PG_init(void);
-
 /* GUC Variables */
 static int	auth_delay_milliseconds;
 
diff --git a/contrib/auto_explain/auto_explain.c b/contrib/auto_explain/auto_explain.c
index 1ba7536879d..269a0fa86c5 100644
--- a/contrib/auto_explain/auto_explain.c
+++ b/contrib/auto_explain/auto_explain.c
@@ -78,8 +78,6 @@ static ExecutorRun_hook_type prev_ExecutorRun = NULL;
 static ExecutorFinish_hook_type prev_ExecutorFinish = NULL;
 static ExecutorEnd_hook_type prev_ExecutorEnd = NULL;
 
-void		_PG_init(void);
-
 static void explain_ExecutorStart(QueryDesc *queryDesc, int eflags);
 static void explain_ExecutorRun(QueryDesc *queryDesc,
 								ScanDirection direction,
diff --git a/contrib/basebackup_to_shell/basebackup_to_shell.c b/contrib/basebackup_to_shell/basebackup_to_shell.c
index bc754b177af..34188f2d9d3 100644
--- a/contrib/basebackup_to_shell/basebackup_to_shell.c
+++ b/contrib/basebackup_to_shell/basebackup_to_shell.c
@@ -37,8 +37,6 @@ typedef struct bbsink_shell
 	FILE	   *pipe;
 } bbsink_shell;
 
-void		_PG_init(void);
-
 static void *shell_check_detail(char *target, char *target_detail);
 static bbsink *shell_get_sink(bbsink *next_sink, void *detail_arg);
 
diff --git a/contrib/basic_archive/basic_archive.c b/contrib/basic_archive/basic_archive.c
index 6b550fc55f7..bba767c8f36 100644
--- a/contrib/basic_archive/basic_archive.c
+++ b/contrib/basic_archive/basic_archive.c
@@ -40,9 +40,6 @@
 
 PG_MODULE_MAGIC;
 
-void		_PG_init(void);
-void		_PG_archive_module_init(ArchiveModuleCallbacks *cb);
-
 static char *archive_directory = NULL;
 static MemoryContext basic_archive_context;
 
diff --git a/contrib/bloom/bloom.h b/contrib/bloom/bloom.h
index 9966f3f46e1..6d58e22813d 100644
--- a/contrib/bloom/bloom.h
+++ b/contrib/bloom/bloom.h
@@ -175,7 +175,6 @@ typedef struct BloomScanOpaqueData
 typedef BloomScanOpaqueData *BloomScanOpaque;
 
 /* blutils.c */
-extern void _PG_init(void);
 extern void initBloomState(BloomState *state, Relation index);
 extern void BloomFillMetapage(Relation index, Page metaPage);
 extern void BloomInitMetapage(Relation index);
diff --git a/contrib/hstore_plperl/hstore_plperl.c b/contrib/hstore_plperl/hstore_plperl.c
index 417b721cff9..c72785d99ec 100644
--- a/contrib/hstore_plperl/hstore_plperl.c
+++ b/contrib/hstore_plperl/hstore_plperl.c
@@ -7,8 +7,6 @@
 
 PG_MODULE_MAGIC;
 
-extern void _PG_init(void);
-
 /* Linkage to functions in hstore module */
 typedef HStore *(*hstoreUpgrade_t) (Datum orig);
 static hstoreUpgrade_t hstoreUpgrade_p;
diff --git a/contrib/hstore_plpython/hstore_plpython.c b/contrib/hstore_plpython/hstore_plpython.c
index 0be65075916..961579a5ea0 100644
--- a/contrib/hstore_plpython/hstore_plpython.c
+++ b/contrib/hstore_plpython/hstore_plpython.c
@@ -7,8 +7,6 @@
 
 PG_MODULE_MAGIC;
 
-extern void _PG_init(void);
-
 /* Linkage to functions in plpython module */
 typedef char *(*PLyObject_AsString_t) (PyObject *plrv);
 static PLyObject_AsString_t PLyObject_AsString_p;
diff --git a/contrib/isn/isn.c b/contrib/isn/isn.c
index 7493a2c60fa..a53d99722ad 100644
--- a/contrib/isn/isn.c
+++ b/contrib/isn/isn.c
@@ -924,8 +924,6 @@ eantoobig:
  * Exported routines.
  *---------------------------------------------------------*/
 
-void		_PG_init(void);
-
 void
 _PG_init(void)
 {
diff --git a/contrib/jsonb_plpython/jsonb_plpython.c b/contrib/jsonb_plpython/jsonb_plpython.c
index 03bbfa87d9a..a625727c5e8 100644
--- a/contrib/jsonb_plpython/jsonb_plpython.c
+++ b/contrib/jsonb_plpython/jsonb_plpython.c
@@ -9,8 +9,6 @@
 
 PG_MODULE_MAGIC;
 
-void		_PG_init(void);
-
 /* for PLyObject_AsString in plpy_typeio.c */
 typedef char *(*PLyObject_AsString_t) (PyObject *plrv);
 static PLyObject_AsString_t PLyObject_AsString_p;
diff --git a/contrib/ltree_plpython/ltree_plpython.c b/contrib/ltree_plpython/ltree_plpython.c
index 7431a1150a9..ac159ea3141 100644
--- a/contrib/ltree_plpython/ltree_plpython.c
+++ b/contrib/ltree_plpython/ltree_plpython.c
@@ -6,8 +6,6 @@
 
 PG_MODULE_MAGIC;
 
-extern void _PG_init(void);
-
 /* Linkage to functions in plpython module */
 typedef PyObject *(*PLyUnicode_FromStringAndSize_t) (const char *s, Py_ssize_t size);
 static PLyUnicode_FromStringAndSize_t PLyUnicode_FromStringAndSize_p;
diff --git a/contrib/passwordcheck/passwordcheck.c b/contrib/passwordcheck/passwordcheck.c
index 9d8c58ded09..c24b1cbe43e 100644
--- a/contrib/passwordcheck/passwordcheck.c
+++ b/contrib/passwordcheck/passwordcheck.c
@@ -32,8 +32,6 @@ static check_password_hook_type prev_check_password_hook = NULL;
 /* passwords shorter than this will be rejected */
 #define MIN_PWD_LENGTH 8
 
-extern void _PG_init(void);
-
 /*
  * check_password
  *
diff --git a/contrib/pg_prewarm/autoprewarm.c b/contrib/pg_prewarm/autoprewarm.c
index 13eee4a1379..b2d60260934 100644
--- a/contrib/pg_prewarm/autoprewarm.c
+++ b/contrib/pg_prewarm/autoprewarm.c
@@ -82,7 +82,6 @@ typedef struct AutoPrewarmSharedState
 	int			prewarmed_blocks;
 } AutoPrewarmSharedState;
 
-void		_PG_init(void);
 void		autoprewarm_main(Datum main_arg);
 void		autoprewarm_database_main(Datum main_arg);
 
diff --git a/contrib/pg_stat_statements/pg_stat_statements.c b/contrib/pg_stat_statements/pg_stat_statements.c
index b4d4231dc61..049da9fe6df 100644
--- a/contrib/pg_stat_statements/pg_stat_statements.c
+++ b/contrib/pg_stat_statements/pg_stat_statements.c
@@ -305,8 +305,6 @@ static bool pgss_save;			/* whether to save stats across shutdown */
 
 /*---- Function declarations ----*/
 
-void		_PG_init(void);
-
 PG_FUNCTION_INFO_V1(pg_stat_statements_reset);
 PG_FUNCTION_INFO_V1(pg_stat_statements_reset_1_7);
 PG_FUNCTION_INFO_V1(pg_stat_statements_1_2);
diff --git a/contrib/pg_trgm/trgm_op.c b/contrib/pg_trgm/trgm_op.c
index cbcc481a172..49b3609de93 100644
--- a/contrib/pg_trgm/trgm_op.c
+++ b/contrib/pg_trgm/trgm_op.c
@@ -20,8 +20,6 @@ double		similarity_threshold = 0.3f;
 double		word_similarity_threshold = 0.6f;
 double		strict_word_similarity_threshold = 0.5f;
 
-void		_PG_init(void);
-
 PG_FUNCTION_INFO_V1(set_limit);
 PG_FUNCTION_INFO_V1(show_limit);
 PG_FUNCTION_INFO_V1(show_trgm);
diff --git a/contrib/postgres_fdw/option.c b/contrib/postgres_fdw/option.c
index 572591a558d..cd2ef234d66 100644
--- a/contrib/postgres_fdw/option.c
+++ b/contrib/postgres_fdw/option.c
@@ -51,8 +51,6 @@ static PQconninfoOption *libpq_options;
  */
 char	   *pgfdw_application_name = NULL;
 
-void		_PG_init(void);
-
 /*
  * Helper functions
  */
diff --git a/contrib/sepgsql/hooks.c b/contrib/sepgsql/hooks.c
index 97e61b8043f..87fdd972c27 100644
--- a/contrib/sepgsql/hooks.c
+++ b/contrib/sepgsql/hooks.c
@@ -30,7 +30,6 @@ PG_MODULE_MAGIC;
 /*
  * Declarations
  */
-void		_PG_init(void);
 
 /*
  * Saved hook entries (if stacked)
diff --git a/contrib/test_decoding/test_decoding.c b/contrib/test_decoding/test_decoding.c
index 3736da6784b..3f90ffa32de 100644
--- a/contrib/test_decoding/test_decoding.c
+++ b/contrib/test_decoding/test_decoding.c
@@ -24,10 +24,6 @@
 
 PG_MODULE_MAGIC;
 
-/* These must be available to dlsym() */
-extern void _PG_init(void);
-extern void _PG_output_plugin_init(OutputPluginCallbacks *cb);
-
 typedef struct
 {
 	MemoryContext context;
diff --git a/src/test/modules/delay_execution/delay_execution.c b/src/test/modules/delay_execution/delay_execution.c
index 407ebc0edaf..756c161872c 100644
--- a/src/test/modules/delay_execution/delay_execution.c
+++ b/src/test/modules/delay_execution/delay_execution.c
@@ -36,9 +36,6 @@ static int	post_planning_lock_id = 0;
 /* Save previous planner hook user to be a good citizen */
 static planner_hook_type prev_planner_hook = NULL;
 
-/* Module load function */
-void		_PG_init(void);
-
 
 /* planner_hook function to provide the desired delay */
 static PlannedStmt *
diff --git a/src/test/modules/dummy_index_am/dummy_index_am.c b/src/test/modules/dummy_index_am/dummy_index_am.c
index a0894ff9860..67c30394c80 100644
--- a/src/test/modules/dummy_index_am/dummy_index_am.c
+++ b/src/test/modules/dummy_index_am/dummy_index_am.c
@@ -23,8 +23,6 @@
 
 PG_MODULE_MAGIC;
 
-void		_PG_init(void);
-
 /* parse table for fillRelOptions */
 relopt_parse_elt di_relopt_tab[6];
 
diff --git a/src/test/modules/dummy_seclabel/dummy_seclabel.c b/src/test/modules/dummy_seclabel/dummy_seclabel.c
index 67658c1e122..8b03dcd7545 100644
--- a/src/test/modules/dummy_seclabel/dummy_seclabel.c
+++ b/src/test/modules/dummy_seclabel/dummy_seclabel.c
@@ -19,9 +19,6 @@
 
 PG_MODULE_MAGIC;
 
-/* Entrypoint of the module */
-void		_PG_init(void);
-
 PG_FUNCTION_INFO_V1(dummy_seclabel_dummy);
 
 static void
diff --git a/src/test/modules/ssl_passphrase_callback/ssl_passphrase_func.c b/src/test/modules/ssl_passphrase_callback/ssl_passphrase_func.c
index e9f2329a5aa..948706af852 100644
--- a/src/test/modules/ssl_passphrase_callback/ssl_passphrase_func.c
+++ b/src/test/modules/ssl_passphrase_callback/ssl_passphrase_func.c
@@ -20,8 +20,6 @@
 
 PG_MODULE_MAGIC;
 
-void		_PG_init(void);
-
 static char *ssl_passphrase = NULL;
 
 /* callback function */
diff --git a/src/test/modules/test_oat_hooks/test_oat_hooks.c b/src/test/modules/test_oat_hooks/test_oat_hooks.c
index 900d597f5dd..8aa59bf18ad 100644
--- a/src/test/modules/test_oat_hooks/test_oat_hooks.c
+++ b/src/test/modules/test_oat_hooks/test_oat_hooks.c
@@ -69,8 +69,6 @@ static char *accesstype_to_string(ObjectAccessType access, int subId);
 static char *accesstype_arg_to_string(ObjectAccessType access, void *arg);
 
 
-void		_PG_init(void);
-
 /*
  * Module load callback
  */
diff --git a/src/test/modules/test_rls_hooks/test_rls_hooks.c b/src/test/modules/test_rls_hooks/test_rls_hooks.c
index fd2864130eb..496846d9f49 100644
--- a/src/test/modules/test_rls_hooks/test_rls_hooks.c
+++ b/src/test/modules/test_rls_hooks/test_rls_hooks.c
@@ -29,8 +29,6 @@
 
 PG_MODULE_MAGIC;
 
-void		_PG_init(void);
-
 /* Install hooks */
 void
 _PG_init(void)
diff --git a/src/test/modules/test_shm_mq/test.c b/src/test/modules/test_shm_mq/test.c
index 5a788692d95..1d1c184d8ce 100644
--- a/src/test/modules/test_shm_mq/test.c
+++ b/src/test/modules/test_shm_mq/test.c
@@ -24,8 +24,6 @@ PG_MODULE_MAGIC;
 PG_FUNCTION_INFO_V1(test_shm_mq);
 PG_FUNCTION_INFO_V1(test_shm_mq_pipelined);
 
-void		_PG_init(void);
-
 static void verify_message(Size origlen, char *origdata, Size newlen,
 						   char *newdata);
 
diff --git a/src/test/modules/worker_spi/worker_spi.c b/src/test/modules/worker_spi/worker_spi.c
index 5b541ec47f1..b37ef8beb60 100644
--- a/src/test/modules/worker_spi/worker_spi.c
+++ b/src/test/modules/worker_spi/worker_spi.c
@@ -46,7 +46,6 @@ PG_MODULE_MAGIC;
 
 PG_FUNCTION_INFO_V1(worker_spi_launch);
 
-void		_PG_init(void);
 void		worker_spi_main(Datum) pg_attribute_noreturn();
 
 /* GUC variables */
-- 
2.37.0.3.g30cc8d0f14

