Thanks to visit codestin.com
Credit goes to github.com

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 <[email protected]> Discussion: https://www.postgresql.org/message-id/flat/[email protected]
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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 0 additions & 2 deletions
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

Lines changed: 0 additions & 3 deletions
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

Lines changed: 7 additions & 17 deletions
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

Lines changed: 5 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 3 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 3 additions & 0 deletions
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

Lines changed: 3 additions & 0 deletions
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

0 commit comments

Comments
 (0)