1
0
mirror of https://github.com/postgres/postgres.git synced 2025-04-27 22:56:53 +03:00

Move all extern declarations for GUC variables to header files

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 <andres@anarazel.de>
Discussion: https://www.postgresql.org/message-id/flat/e0a62134-83da-4ba4-8cdb-ceb0111c95ce@eisentraut.org
This commit is contained in:
Peter Eisentraut 2024-07-24 06:21:39 +02:00
parent 991f8cf8ab
commit 774d47b6c0
12 changed files with 51 additions and 23 deletions

View File

@ -901,7 +901,6 @@ assign_session_authorization(const char *newval, void *extra)
* 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)

View File

@ -136,8 +136,6 @@ static void write_syslog(int level, const char *line);
#endif
#ifdef WIN32
extern char *event_source;
static void write_eventlog(int level, const char *line, int len);
#endif

View File

@ -82,9 +82,6 @@ char *GUC_check_errmsg_string;
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.

View File

@ -34,6 +34,7 @@
#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"
@ -71,10 +72,12 @@
#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"
@ -90,28 +93,15 @@
#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.
*

View File

@ -17,6 +17,11 @@
#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);

View File

@ -52,6 +52,8 @@ extern PGDLLIMPORT bool wal_recycle;
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;

View File

@ -14,6 +14,9 @@
#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

View File

@ -19,6 +19,8 @@
#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 */

View File

@ -19,6 +19,9 @@
#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).

View File

@ -14,6 +14,9 @@
#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

View File

@ -40,6 +40,7 @@ typedef enum
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);

View File

@ -250,6 +250,7 @@ extern PGDLLIMPORT bool log_planner_stats;
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;
@ -285,10 +286,34 @@ extern PGDLLIMPORT int tcp_keepalives_interval;
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
*/