Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 774d47b

Browse files
committed
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
1 parent 991f8cf commit 774d47b

File tree

12 files changed

+51
-23
lines changed

12 files changed

+51
-23
lines changed

src/backend/commands/variable.c

-1
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,6 @@ assign_session_authorization(const char *newval, void *extra)
901901
* a translation of "none" to InvalidOid. Otherwise this is much like
902902
* SET SESSION AUTHORIZATION.
903903
*/
904-
extern char *role_string; /* in guc_tables.c */
905904

906905
bool
907906
check_role(char **newval, void **extra, GucSource source)

src/backend/utils/error/elog.c

-2
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,6 @@ static void write_syslog(int level, const char *line);
136136
#endif
137137

138138
#ifdef WIN32
139-
extern char *event_source;
140-
141139
static void write_eventlog(int level, const char *line, int len);
142140
#endif
143141

src/backend/utils/misc/guc.c

-3
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,6 @@ char *GUC_check_errmsg_string;
8282
char *GUC_check_errdetail_string;
8383
char *GUC_check_errhint_string;
8484

85-
/* Kluge: for speed, we examine this GUC variable's value directly */
86-
extern bool in_hot_standby_guc;
87-
8885

8986
/*
9087
* Unit conversion tables.

src/backend/utils/misc/guc_tables.c

+7-17
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "access/xlog_internal.h"
3535
#include "access/xlogprefetcher.h"
3636
#include "access/xlogrecovery.h"
37+
#include "access/xlogutils.h"
3738
#include "archive/archive_module.h"
3839
#include "catalog/namespace.h"
3940
#include "catalog/storage.h"
@@ -71,10 +72,12 @@
7172
#include "replication/slotsync.h"
7273
#include "replication/syncrep.h"
7374
#include "storage/bufmgr.h"
75+
#include "storage/bufpage.h"
7476
#include "storage/large_object.h"
7577
#include "storage/pg_shmem.h"
7678
#include "storage/predicate.h"
7779
#include "storage/standby.h"
80+
#include "tcop/backend_startup.h"
7881
#include "tcop/tcopprot.h"
7982
#include "tsearch/ts_cache.h"
8083
#include "utils/builtins.h"
@@ -90,28 +93,15 @@
9093
#include "utils/rls.h"
9194
#include "utils/xml.h"
9295

96+
#ifdef TRACE_SYNCSCAN
97+
#include "access/syncscan.h"
98+
#endif
99+
93100
/* This value is normally passed in from the Makefile */
94101
#ifndef PG_KRB_SRVTAB
95102
#define PG_KRB_SRVTAB ""
96103
#endif
97104

98-
/* XXX these should appear in other modules' header files */
99-
extern bool Log_disconnections;
100-
extern bool Trace_connection_negotiation;
101-
extern int CommitDelay;
102-
extern int CommitSiblings;
103-
extern char *default_tablespace;
104-
extern char *temp_tablespaces;
105-
extern bool ignore_checksum_failure;
106-
extern bool ignore_invalid_pages;
107-
108-
#ifdef TRACE_SYNCSCAN
109-
extern bool trace_syncscan;
110-
#endif
111-
#ifdef DEBUG_BOUNDED_SORT
112-
extern bool optimize_bounded_sort;
113-
#endif
114-
115105
/*
116106
* Options for enum values defined in this module.
117107
*

src/include/access/syncscan.h

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
#include "storage/block.h"
1818
#include "utils/relcache.h"
1919

20+
/* GUC variables */
21+
#ifdef TRACE_SYNCSCAN
22+
extern PGDLLIMPORT bool trace_syncscan;
23+
#endif
24+
2025
extern void ss_report_location(Relation rel, BlockNumber location);
2126
extern BlockNumber ss_get_location(Relation rel, BlockNumber relnblocks);
2227
extern void SyncScanShmemInit(void);

src/include/access/xlog.h

+2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ extern PGDLLIMPORT bool wal_recycle;
5252
extern PGDLLIMPORT bool *wal_consistency_checking;
5353
extern PGDLLIMPORT char *wal_consistency_checking_string;
5454
extern PGDLLIMPORT bool log_checkpoints;
55+
extern PGDLLIMPORT int CommitDelay;
56+
extern PGDLLIMPORT int CommitSiblings;
5557
extern PGDLLIMPORT bool track_wal_io_timing;
5658
extern PGDLLIMPORT int wal_decode_buffer_size;
5759

src/include/access/xlogutils.h

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
#include "access/xlogreader.h"
1515
#include "storage/bufmgr.h"
1616

17+
/* GUC variable */
18+
extern PGDLLIMPORT bool ignore_invalid_pages;
19+
1720
/*
1821
* Prior to 8.4, all activity during recovery was carried out by the startup
1922
* process. This local variable continues to be used in many parts of the

src/include/commands/tablespace.h

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#include "lib/stringinfo.h"
2020
#include "nodes/parsenodes.h"
2121

22+
extern PGDLLIMPORT char *default_tablespace;
23+
extern PGDLLIMPORT char *temp_tablespaces;
2224
extern PGDLLIMPORT bool allow_in_place_tablespaces;
2325

2426
/* XLOG stuff */

src/include/storage/bufpage.h

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
#include "storage/item.h"
2020
#include "storage/off.h"
2121

22+
/* GUC variable */
23+
extern PGDLLIMPORT bool ignore_checksum_failure;
24+
2225
/*
2326
* A postgres disk page is an abstraction layered on top of a postgres
2427
* disk block (which is simply a unit of i/o, see block.h).

src/include/tcop/backend_startup.h

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
#ifndef BACKEND_STARTUP_H
1515
#define BACKEND_STARTUP_H
1616

17+
/* GUCs */
18+
extern PGDLLIMPORT bool Trace_connection_negotiation;
19+
1720
/*
1821
* CAC_state is passed from postmaster to the backend process, to indicate
1922
* whether the connection should be accepted, or if the process should just

src/include/tcop/tcopprot.h

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ typedef enum
4040
LOGSTMT_ALL, /* log all statements */
4141
} LogStmtLevel;
4242

43+
extern PGDLLIMPORT bool Log_disconnections;
4344
extern PGDLLIMPORT int log_statement;
4445

4546
extern List *pg_parse_query(const char *query_string);

src/include/utils/guc.h

+25
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ extern PGDLLIMPORT bool log_planner_stats;
250250
extern PGDLLIMPORT bool log_executor_stats;
251251
extern PGDLLIMPORT bool log_statement_stats;
252252
extern PGDLLIMPORT bool log_btree_build_stats;
253+
extern PGDLLIMPORT char *event_source;
253254

254255
extern PGDLLIMPORT bool check_function_bodies;
255256
extern PGDLLIMPORT bool current_role_is_superuser;
@@ -285,10 +286,34 @@ extern PGDLLIMPORT int tcp_keepalives_interval;
285286
extern PGDLLIMPORT int tcp_keepalives_count;
286287
extern PGDLLIMPORT int tcp_user_timeout;
287288

289+
extern PGDLLIMPORT char *role_string;
290+
extern PGDLLIMPORT bool in_hot_standby_guc;
291+
288292
#ifdef TRACE_SORT
289293
extern PGDLLIMPORT bool trace_sort;
290294
#endif
291295

296+
#ifdef DEBUG_BOUNDED_SORT
297+
extern PGDLLIMPORT bool optimize_bounded_sort;
298+
#endif
299+
300+
/*
301+
* Declarations for options for enum values
302+
*
303+
* For most parameters, these are defined statically inside guc_tables.c. But
304+
* for some parameters, the definitions require symbols that are not easily
305+
* available inside guc_tables.c, so they are instead defined in their home
306+
* modules. For those, we keep the extern declarations here. (An alternative
307+
* would be to put the extern declarations in the modules' header files, but
308+
* that would then require including the definition of struct
309+
* config_enum_entry into those header files.)
310+
*/
311+
extern const struct config_enum_entry archive_mode_options[];
312+
extern const struct config_enum_entry dynamic_shared_memory_options[];
313+
extern const struct config_enum_entry recovery_target_action_options[];
314+
extern const struct config_enum_entry wal_level_options[];
315+
extern const struct config_enum_entry wal_sync_method_options[];
316+
292317
/*
293318
* Functions exported by guc.c
294319
*/

0 commit comments

Comments
 (0)