Add extern declarations in appropriate header files for global
variables related to GUC. In many cases, this was handled quite
inconsistently before, with some GUC variables declared in a header
file and some only pulled in via ad-hoc extern declarations in various
.c files.
Also add PGDLLIMPORT qualifications to those variables. These were
previously missing because src/tools/mark_pgdllimport.pl has only been
used with header files.
This also fixes -Wmissing-variable-declarations warnings for GUC
variables (not yet part of the standard warning options).
Reviewed-by: Andres Freund <[email protected]>
Discussion: https://www.postgresql.org/message-id/flat/
e0a62134-83da-4ba4-8cdb-
ceb0111c95ce@eisentraut.org
* a translation of "none" to InvalidOid. Otherwise this is much like
* SET SESSION AUTHORIZATION.
*/
-extern char *role_string; /* in guc_tables.c */
bool
check_role(char **newval, void **extra, GucSource source)
#endif
#ifdef WIN32
-extern char *event_source;
-
static void write_eventlog(int level, const char *line, int len);
#endif
char *GUC_check_errdetail_string;
char *GUC_check_errhint_string;
-/* Kluge: for speed, we examine this GUC variable's value directly */
-extern bool in_hot_standby_guc;
-
/*
* Unit conversion tables.
#include "access/xlog_internal.h"
#include "access/xlogprefetcher.h"
#include "access/xlogrecovery.h"
+#include "access/xlogutils.h"
#include "archive/archive_module.h"
#include "catalog/namespace.h"
#include "catalog/storage.h"
#include "replication/slotsync.h"
#include "replication/syncrep.h"
#include "storage/bufmgr.h"
+#include "storage/bufpage.h"
#include "storage/large_object.h"
#include "storage/pg_shmem.h"
#include "storage/predicate.h"
#include "storage/standby.h"
+#include "tcop/backend_startup.h"
#include "tcop/tcopprot.h"
#include "tsearch/ts_cache.h"
#include "utils/builtins.h"
#include "utils/rls.h"
#include "utils/xml.h"
+#ifdef TRACE_SYNCSCAN
+#include "access/syncscan.h"
+#endif
+
/* This value is normally passed in from the Makefile */
#ifndef PG_KRB_SRVTAB
#define PG_KRB_SRVTAB ""
#endif
-/* XXX these should appear in other modules' header files */
-extern bool Log_disconnections;
-extern bool Trace_connection_negotiation;
-extern int CommitDelay;
-extern int CommitSiblings;
-extern char *default_tablespace;
-extern char *temp_tablespaces;
-extern bool ignore_checksum_failure;
-extern bool ignore_invalid_pages;
-
-#ifdef TRACE_SYNCSCAN
-extern bool trace_syncscan;
-#endif
-#ifdef DEBUG_BOUNDED_SORT
-extern bool optimize_bounded_sort;
-#endif
-
/*
* Options for enum values defined in this module.
*
#include "storage/block.h"
#include "utils/relcache.h"
+/* GUC variables */
+#ifdef TRACE_SYNCSCAN
+extern PGDLLIMPORT bool trace_syncscan;
+#endif
+
extern void ss_report_location(Relation rel, BlockNumber location);
extern BlockNumber ss_get_location(Relation rel, BlockNumber relnblocks);
extern void SyncScanShmemInit(void);
extern PGDLLIMPORT bool *wal_consistency_checking;
extern PGDLLIMPORT char *wal_consistency_checking_string;
extern PGDLLIMPORT bool log_checkpoints;
+extern PGDLLIMPORT int CommitDelay;
+extern PGDLLIMPORT int CommitSiblings;
extern PGDLLIMPORT bool track_wal_io_timing;
extern PGDLLIMPORT int wal_decode_buffer_size;
#include "access/xlogreader.h"
#include "storage/bufmgr.h"
+/* GUC variable */
+extern PGDLLIMPORT bool ignore_invalid_pages;
+
/*
* Prior to 8.4, all activity during recovery was carried out by the startup
* process. This local variable continues to be used in many parts of the
#include "lib/stringinfo.h"
#include "nodes/parsenodes.h"
+extern PGDLLIMPORT char *default_tablespace;
+extern PGDLLIMPORT char *temp_tablespaces;
extern PGDLLIMPORT bool allow_in_place_tablespaces;
/* XLOG stuff */
#include "storage/item.h"
#include "storage/off.h"
+/* GUC variable */
+extern PGDLLIMPORT bool ignore_checksum_failure;
+
/*
* A postgres disk page is an abstraction layered on top of a postgres
* disk block (which is simply a unit of i/o, see block.h).
#ifndef BACKEND_STARTUP_H
#define BACKEND_STARTUP_H
+/* GUCs */
+extern PGDLLIMPORT bool Trace_connection_negotiation;
+
/*
* CAC_state is passed from postmaster to the backend process, to indicate
* whether the connection should be accepted, or if the process should just
LOGSTMT_ALL, /* log all statements */
} LogStmtLevel;
+extern PGDLLIMPORT bool Log_disconnections;
extern PGDLLIMPORT int log_statement;
extern List *pg_parse_query(const char *query_string);
extern PGDLLIMPORT bool log_executor_stats;
extern PGDLLIMPORT bool log_statement_stats;
extern PGDLLIMPORT bool log_btree_build_stats;
+extern PGDLLIMPORT char *event_source;
extern PGDLLIMPORT bool check_function_bodies;
extern PGDLLIMPORT bool current_role_is_superuser;
extern PGDLLIMPORT int tcp_keepalives_count;
extern PGDLLIMPORT int tcp_user_timeout;
+extern PGDLLIMPORT char *role_string;
+extern PGDLLIMPORT bool in_hot_standby_guc;
+
#ifdef TRACE_SORT
extern PGDLLIMPORT bool trace_sort;
#endif
+#ifdef DEBUG_BOUNDED_SORT
+extern PGDLLIMPORT bool optimize_bounded_sort;
+#endif
+
+/*
+ * Declarations for options for enum values
+ *
+ * For most parameters, these are defined statically inside guc_tables.c. But
+ * for some parameters, the definitions require symbols that are not easily
+ * available inside guc_tables.c, so they are instead defined in their home
+ * modules. For those, we keep the extern declarations here. (An alternative
+ * would be to put the extern declarations in the modules' header files, but
+ * that would then require including the definition of struct
+ * config_enum_entry into those header files.)
+ */
+extern const struct config_enum_entry archive_mode_options[];
+extern const struct config_enum_entry dynamic_shared_memory_options[];
+extern const struct config_enum_entry recovery_target_action_options[];
+extern const struct config_enum_entry wal_level_options[];
+extern const struct config_enum_entry wal_sync_method_options[];
+
/*
* Functions exported by guc.c
*/