On Sun, Aug 22, 2021 at 09:29:01PM +0800, Julien Rouhaud wrote:
> On Sun, Aug 22, 2021 at 09:19:42AM -0400, Tom Lane wrote:
> > 
> > Uh, no, it's exactly *not* clear.  There are a lot of GUCs that are only
> > of interest to particular subsystems.  I do not see why being a GUC makes
> > something automatically more interesting than any other global variable.
> > Usually, the fact that one is global is only so the GUC machinery itself
> > can get at it, otherwise it'd be static in the owning module.
> > 
> > As for "extensions should be able to get at the values", the GUC machinery
> > already provides uniform mechanisms for doing that safely.  Direct access
> > to the variable's internal value would be unsafe in many cases.
> 
> Then shouldn't we try to prevent direct access on all platforms rather than
> only one?

So since the non currently explicitly exported GUC global variables shouldn't
be accessible by third-party code, I'm attaching a POC patch that does the
opposite of v1: enforce that restriction using a new pg_attribute_hidden()
macro, defined with GCC only, to start discussing that topic.

It would probably be better to have some other macro (e.g. PG_GLOBAL_PUBLIC and
PG_GLOBAL_PRIVATE or similar) to make declarations more consistent, but given
the amount of changes it would represent I prefer to have some feedback before
spending time on that.
>From b43c48a80f985e879a88d9d270fc1e2b283b5732 Mon Sep 17 00:00:00 2001
From: Julien Rouhaud <julien.rouh...@free.fr>
Date: Sun, 22 Aug 2021 15:40:47 +0800
Subject: [PATCH v2] Make all GUC ariables non previously marked as PGDLLIMPORT
 private.

---
 src/backend/utils/misc/guc.c              | 18 +++---
 src/include/access/gin.h                  |  2 +-
 src/include/access/tableam.h              |  4 +-
 src/include/access/toast_compression.h    |  2 +-
 src/include/access/xact.h                 | 12 ++--
 src/include/access/xlog.h                 | 78 +++++++++++------------
 src/include/c.h                           |  7 ++
 src/include/catalog/namespace.h           |  2 +-
 src/include/catalog/storage.h             |  2 +-
 src/include/commands/async.h              |  2 +-
 src/include/commands/user.h               |  2 +-
 src/include/commands/vacuum.h             | 12 ++--
 src/include/fmgr.h                        |  2 +-
 src/include/jit/jit.h                     | 20 +++---
 src/include/libpq/auth.h                  |  4 +-
 src/include/libpq/libpq.h                 | 24 +++----
 src/include/libpq/pqcomm.h                |  2 +-
 src/include/miscadmin.h                   | 22 +++----
 src/include/optimizer/geqo.h              | 10 +--
 src/include/optimizer/optimizer.h         |  4 +-
 src/include/optimizer/planmain.h          |  6 +-
 src/include/parser/parse_expr.h           |  2 +-
 src/include/parser/parser.h               |  4 +-
 src/include/pgstat.h                      |  6 +-
 src/include/pgtime.h                      |  2 +-
 src/include/postmaster/autovacuum.h       | 30 ++++-----
 src/include/postmaster/bgwriter.h         |  8 +--
 src/include/postmaster/postmaster.h       | 28 ++++----
 src/include/postmaster/syslogger.h        | 10 +--
 src/include/postmaster/walwriter.h        |  4 +-
 src/include/replication/logicallauncher.h |  4 +-
 src/include/replication/syncrep.h         |  2 +-
 src/include/replication/walreceiver.h     |  6 +-
 src/include/replication/walsender.h       |  6 +-
 src/include/storage/bufmgr.h              | 20 +++---
 src/include/storage/dsm_impl.h            |  4 +-
 src/include/storage/fd.h                  |  2 +-
 src/include/storage/large_object.h        |  2 +-
 src/include/storage/lock.h                | 12 ++--
 src/include/storage/lwlock.h              |  2 +-
 src/include/storage/pg_shmem.h            |  6 +-
 src/include/storage/predicate.h           |  6 +-
 src/include/storage/proc.h                |  2 +-
 src/include/storage/standby.h             |  8 +--
 src/include/tcop/tcopprot.h               |  6 +-
 src/include/tsearch/ts_cache.h            |  2 +-
 src/include/utils/array.h                 |  2 +-
 src/include/utils/builtins.h              |  2 +-
 src/include/utils/bytea.h                 |  2 +-
 src/include/utils/elog.h                  | 10 +--
 src/include/utils/guc.h                   | 62 +++++++++---------
 src/include/utils/pg_locale.h             |  8 +--
 src/include/utils/plancache.h             |  2 +-
 src/include/utils/ps_status.h             |  2 +-
 src/include/utils/queryjumble.h           |  2 +-
 src/include/utils/rls.h                   |  2 +-
 src/include/utils/xml.h                   |  4 +-
 57 files changed, 263 insertions(+), 256 deletions(-)

diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index a2e0f8de7e..ca2d6042cd 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -129,20 +129,20 @@
 #define REALTYPE_PRECISION 17
 
 /* XXX these should appear in other modules' header files */
-extern bool Log_disconnections;
-extern int	CommitDelay;
-extern int	CommitSiblings;
-extern char *default_tablespace;
-extern char *temp_tablespaces;
-extern bool ignore_checksum_failure;
-extern bool ignore_invalid_pages;
+extern bool Log_disconnections pg_attribute_hidden();
+extern int	CommitDelay pg_attribute_hidden();
+extern int	CommitSiblings pg_attribute_hidden();
+extern char *default_tablespace pg_attribute_hidden();
+extern char *temp_tablespaces pg_attribute_hidden();
+extern bool ignore_checksum_failure pg_attribute_hidden();
+extern bool ignore_invalid_pages pg_attribute_hidden();
 extern bool synchronize_seqscans;
 
 #ifdef TRACE_SYNCSCAN
-extern bool trace_syncscan;
+extern bool trace_syncscan pg_attribute_hidden();
 #endif
 #ifdef DEBUG_BOUNDED_SORT
-extern bool optimize_bounded_sort;
+extern bool optimize_bounded_sort pg_attribute_hidden();
 #endif
 
 static int	GUC_check_errcode_value;
diff --git a/src/include/access/gin.h b/src/include/access/gin.h
index 266cb07236..b614380327 100644
--- a/src/include/access/gin.h
+++ b/src/include/access/gin.h
@@ -68,7 +68,7 @@ typedef char GinTernaryValue;
 
 /* GUC parameters */
 extern PGDLLIMPORT int GinFuzzySearchLimit;
-extern int	gin_pending_list_limit;
+extern int	gin_pending_list_limit pg_attribute_hidden();
 
 /* ginutil.c */
 extern void ginGetStats(Relation index, GinStatsData *stats);
diff --git a/src/include/access/tableam.h b/src/include/access/tableam.h
index 9f1e4a1ac9..445ce8a859 100644
--- a/src/include/access/tableam.h
+++ b/src/include/access/tableam.h
@@ -28,8 +28,8 @@
 #define DEFAULT_TABLE_ACCESS_METHOD	"heap"
 
 /* GUCs */
-extern char *default_table_access_method;
-extern bool synchronize_seqscans;
+extern char *default_table_access_method pg_attribute_hidden();
+extern bool synchronize_seqscans pg_attribute_hidden();
 
 
 struct BulkInsertStateData;
diff --git a/src/include/access/toast_compression.h b/src/include/access/toast_compression.h
index c992ece4c4..4889cfd386 100644
--- a/src/include/access/toast_compression.h
+++ b/src/include/access/toast_compression.h
@@ -20,7 +20,7 @@
  * but the value is one of the char values defined below, as they appear in
  * pg_attribute.attcompression, e.g. TOAST_PGLZ_COMPRESSION.
  */
-extern int	default_toast_compression;
+extern int	default_toast_compression pg_attribute_hidden();
 
 /*
  * Built-in compression method ID.  The toast compression header will store
diff --git a/src/include/access/xact.h b/src/include/access/xact.h
index 134f6862da..cb8021d05c 100644
--- a/src/include/access/xact.h
+++ b/src/include/access/xact.h
@@ -38,7 +38,7 @@
 #define XACT_REPEATABLE_READ	2
 #define XACT_SERIALIZABLE		3
 
-extern int	DefaultXactIsoLevel;
+extern int	DefaultXactIsoLevel pg_attribute_hidden();
 extern PGDLLIMPORT int XactIsoLevel;
 
 /*
@@ -52,8 +52,8 @@ extern PGDLLIMPORT int XactIsoLevel;
 #define IsolationIsSerializable() (XactIsoLevel == XACT_SERIALIZABLE)
 
 /* Xact read-only state */
-extern bool DefaultXactReadOnly;
-extern bool XactReadOnly;
+extern bool DefaultXactReadOnly pg_attribute_hidden();
+extern bool XactReadOnly pg_attribute_hidden();
 
 /* flag for logging statements in this transaction */
 extern bool xact_is_sampled;
@@ -62,8 +62,8 @@ extern bool xact_is_sampled;
  * Xact is deferrable -- only meaningful (currently) for read only
  * SERIALIZABLE transactions
  */
-extern bool DefaultXactDeferrable;
-extern bool XactDeferrable;
+extern bool DefaultXactDeferrable pg_attribute_hidden();
+extern bool XactDeferrable pg_attribute_hidden();
 
 typedef enum
 {
@@ -80,7 +80,7 @@ typedef enum
 #define SYNCHRONOUS_COMMIT_ON	SYNCHRONOUS_COMMIT_REMOTE_FLUSH
 
 /* Synchronous commit level */
-extern int	synchronous_commit;
+extern int	synchronous_commit pg_attribute_hidden();
 
 /* used during logical streaming of a transaction */
 extern PGDLLIMPORT TransactionId CheckXidAlive;
diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h
index 0a8ede700d..6ad105026e 100644
--- a/src/include/access/xlog.h
+++ b/src/include/access/xlog.h
@@ -27,7 +27,7 @@
 #define SYNC_METHOD_OPEN		2	/* for O_SYNC */
 #define SYNC_METHOD_FSYNC_WRITETHROUGH	3
 #define SYNC_METHOD_OPEN_DSYNC	4	/* for O_DSYNC */
-extern int	sync_method;
+extern int	sync_method pg_attribute_hidden();
 
 extern PGDLLIMPORT TimeLineID ThisTimeLineID;	/* current TLI */
 
@@ -62,45 +62,45 @@ extern PGDLLIMPORT XLogRecPtr XactLastCommitEnd;
 extern bool reachedConsistency;
 
 /* these variables are GUC parameters related to XLOG */
-extern int	wal_segment_size;
-extern int	min_wal_size_mb;
-extern int	max_wal_size_mb;
-extern int	wal_keep_size_mb;
-extern int	max_slot_wal_keep_size_mb;
-extern int	XLOGbuffers;
-extern int	XLogArchiveTimeout;
-extern int	wal_retrieve_retry_interval;
-extern char *XLogArchiveCommand;
-extern bool EnableHotStandby;
-extern bool fullPageWrites;
-extern bool wal_log_hints;
-extern int	wal_compression;
-extern bool wal_init_zero;
-extern bool wal_recycle;
+extern int	wal_segment_size pg_attribute_hidden();
+extern int	min_wal_size_mb pg_attribute_hidden();
+extern int	max_wal_size_mb pg_attribute_hidden();
+extern int	wal_keep_size_mb pg_attribute_hidden();
+extern int	max_slot_wal_keep_size_mb pg_attribute_hidden();
+extern int	XLOGbuffers pg_attribute_hidden();
+extern int	XLogArchiveTimeout pg_attribute_hidden();
+extern int	wal_retrieve_retry_interval pg_attribute_hidden();
+extern char *XLogArchiveCommand pg_attribute_hidden();
+extern bool EnableHotStandby pg_attribute_hidden();
+extern bool fullPageWrites pg_attribute_hidden();
+extern bool wal_log_hints pg_attribute_hidden();
+extern int	wal_compression pg_attribute_hidden();
+extern bool wal_init_zero pg_attribute_hidden();
+extern bool wal_recycle pg_attribute_hidden();
 extern bool *wal_consistency_checking;
-extern char *wal_consistency_checking_string;
-extern bool log_checkpoints;
-extern char *recoveryRestoreCommand;
-extern char *recoveryEndCommand;
-extern char *archiveCleanupCommand;
-extern bool recoveryTargetInclusive;
-extern int	recoveryTargetAction;
-extern int	recovery_min_apply_delay;
-extern char *PrimaryConnInfo;
-extern char *PrimarySlotName;
-extern bool wal_receiver_create_temp_slot;
-extern bool track_wal_io_timing;
+extern char *wal_consistency_checking_string pg_attribute_hidden();
+extern bool log_checkpoints pg_attribute_hidden();
+extern char *recoveryRestoreCommand pg_attribute_hidden();
+extern char *recoveryEndCommand pg_attribute_hidden();
+extern char *archiveCleanupCommand pg_attribute_hidden();
+extern bool recoveryTargetInclusive pg_attribute_hidden();
+extern int	recoveryTargetAction pg_attribute_hidden();
+extern int	recovery_min_apply_delay pg_attribute_hidden();
+extern char *PrimaryConnInfo pg_attribute_hidden();
+extern char *PrimarySlotName pg_attribute_hidden();
+extern bool wal_receiver_create_temp_slot pg_attribute_hidden();
+extern bool track_wal_io_timing pg_attribute_hidden();
 
 /* indirectly set via GUC system */
-extern TransactionId recoveryTargetXid;
-extern char *recovery_target_time_string;
-extern const char *recoveryTargetName;
-extern XLogRecPtr recoveryTargetLSN;
-extern RecoveryTargetType recoveryTarget;
-extern char *PromoteTriggerFile;
-extern RecoveryTargetTimeLineGoal recoveryTargetTimeLineGoal;
-extern TimeLineID recoveryTargetTLIRequested;
-extern TimeLineID recoveryTargetTLI;
+extern TransactionId recoveryTargetXid pg_attribute_hidden();
+extern char *recovery_target_time_string pg_attribute_hidden();
+extern const char *recoveryTargetName pg_attribute_hidden();
+extern XLogRecPtr recoveryTargetLSN pg_attribute_hidden();
+extern RecoveryTargetType recoveryTarget pg_attribute_hidden();
+extern char *PromoteTriggerFile pg_attribute_hidden();
+extern RecoveryTargetTimeLineGoal recoveryTargetTimeLineGoal pg_attribute_hidden();
+extern TimeLineID recoveryTargetTLIRequested pg_attribute_hidden();
+extern TimeLineID recoveryTargetTLI pg_attribute_hidden();
 
 extern int	CheckPointSegments;
 
@@ -115,7 +115,7 @@ typedef enum ArchiveMode
 	ARCHIVE_MODE_ON,			/* enabled while server is running normally */
 	ARCHIVE_MODE_ALWAYS			/* enabled always (even during recovery) */
 } ArchiveMode;
-extern int	XLogArchiveMode;
+extern int	XLogArchiveMode pg_attribute_hidden();
 
 /* WAL levels */
 typedef enum WalLevel
@@ -183,7 +183,7 @@ extern PGDLLIMPORT int wal_level;
 #define XLogLogicalInfoActive() (wal_level >= WAL_LEVEL_LOGICAL)
 
 #ifdef WAL_DEBUG
-extern bool XLOG_DEBUG;
+extern bool XLOG_DEBUG pg_attribute_hidden();
 #endif
 
 /*
diff --git a/src/include/c.h b/src/include/c.h
index c8ede08273..8ff7db87c7 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -113,6 +113,13 @@
 #define __has_attribute(attribute) 0
 #endif
 
+/* only GCC supports the visibility attribute */
+#ifdef __GNUC__
+#define pg_attribute_hidden() __attribute__ ((visibility ("hidden")))
+#else
+#define pg_attribute_hidden()
+#endif
+
 /* only GCC supports the unused attribute */
 #ifdef __GNUC__
 #define pg_attribute_unused() __attribute__((unused))
diff --git a/src/include/catalog/namespace.h b/src/include/catalog/namespace.h
index b98f284356..bade81bd51 100644
--- a/src/include/catalog/namespace.h
+++ b/src/include/catalog/namespace.h
@@ -182,7 +182,7 @@ extern void AtEOSubXact_Namespace(bool isCommit, SubTransactionId mySubid,
 								  SubTransactionId parentSubid);
 
 /* stuff for search_path GUC variable */
-extern char *namespace_search_path;
+extern char *namespace_search_path pg_attribute_hidden();
 
 extern List *fetch_search_path(bool includeImplicit);
 extern int	fetch_search_path_array(Oid *sarray, int sarray_len);
diff --git a/src/include/catalog/storage.h b/src/include/catalog/storage.h
index 0ab32b44e9..ac119fd794 100644
--- a/src/include/catalog/storage.h
+++ b/src/include/catalog/storage.h
@@ -20,7 +20,7 @@
 #include "utils/relcache.h"
 
 /* GUC variables */
-extern int	wal_skip_threshold;
+extern int	wal_skip_threshold pg_attribute_hidden();
 
 extern SMgrRelation RelationCreateStorage(RelFileNode rnode, char relpersistence);
 extern void RelationDropStorage(Relation rel);
diff --git a/src/include/commands/async.h b/src/include/commands/async.h
index 9217f66b91..042aee6566 100644
--- a/src/include/commands/async.h
+++ b/src/include/commands/async.h
@@ -20,7 +20,7 @@
  */
 #define NUM_NOTIFY_BUFFERS	8
 
-extern bool Trace_notify;
+extern bool Trace_notify pg_attribute_hidden();
 extern volatile sig_atomic_t notifyInterruptPending;
 
 extern Size AsyncShmemSize(void);
diff --git a/src/include/commands/user.h b/src/include/commands/user.h
index 0b7a3cd65f..ace02febf4 100644
--- a/src/include/commands/user.h
+++ b/src/include/commands/user.h
@@ -17,7 +17,7 @@
 #include "parser/parse_node.h"
 
 /* GUC. Is actually of type PasswordType. */
-extern int	Password_encryption;
+extern int	Password_encryption pg_attribute_hidden();
 
 /* Hook to check passwords in CreateRole() and AlterRole() */
 typedef void (*check_password_hook_type) (const char *username, const char *shadow_pass, PasswordType password_type, Datum validuntil_time, bool validuntil_null);
diff --git a/src/include/commands/vacuum.h b/src/include/commands/vacuum.h
index bf3126aa9b..847f448ac9 100644
--- a/src/include/commands/vacuum.h
+++ b/src/include/commands/vacuum.h
@@ -232,12 +232,12 @@ typedef struct VacuumParams
 
 /* GUC parameters */
 extern PGDLLIMPORT int default_statistics_target;	/* PGDLLIMPORT for PostGIS */
-extern int	vacuum_freeze_min_age;
-extern int	vacuum_freeze_table_age;
-extern int	vacuum_multixact_freeze_min_age;
-extern int	vacuum_multixact_freeze_table_age;
-extern int	vacuum_failsafe_age;
-extern int	vacuum_multixact_failsafe_age;
+extern int	vacuum_freeze_min_age pg_attribute_hidden();
+extern int	vacuum_freeze_table_age pg_attribute_hidden();
+extern int	vacuum_multixact_freeze_min_age pg_attribute_hidden();
+extern int	vacuum_multixact_freeze_table_age pg_attribute_hidden();
+extern int	vacuum_failsafe_age pg_attribute_hidden();
+extern int	vacuum_multixact_failsafe_age pg_attribute_hidden();
 
 /* Variables for cost-based parallel vacuum */
 extern pg_atomic_uint32 *VacuumSharedCostBalance;
diff --git a/src/include/fmgr.h b/src/include/fmgr.h
index ab7b85c86e..52c0dc2768 100644
--- a/src/include/fmgr.h
+++ b/src/include/fmgr.h
@@ -716,7 +716,7 @@ extern bool CheckFunctionValidatorAccess(Oid validatorOid, Oid functionOid);
 /*
  * Routines in dfmgr.c
  */
-extern char *Dynamic_library_path;
+extern char *Dynamic_library_path pg_attribute_hidden();
 
 extern void *load_external_function(const char *filename, const char *funcname,
 									bool signalNotFound, void **filehandle);
diff --git a/src/include/jit/jit.h b/src/include/jit/jit.h
index b634df30b9..bf40baa487 100644
--- a/src/include/jit/jit.h
+++ b/src/include/jit/jit.h
@@ -79,16 +79,16 @@ struct JitProviderCallbacks
 
 
 /* GUCs */
-extern bool jit_enabled;
-extern char *jit_provider;
-extern bool jit_debugging_support;
-extern bool jit_dump_bitcode;
-extern bool jit_expressions;
-extern bool jit_profiling_support;
-extern bool jit_tuple_deforming;
-extern double jit_above_cost;
-extern double jit_inline_above_cost;
-extern double jit_optimize_above_cost;
+extern bool jit_enabled pg_attribute_hidden();
+extern char *jit_provider pg_attribute_hidden();
+extern bool jit_debugging_support pg_attribute_hidden();
+extern bool jit_dump_bitcode pg_attribute_hidden();
+extern bool jit_expressions pg_attribute_hidden();
+extern bool jit_profiling_support pg_attribute_hidden();
+extern bool jit_tuple_deforming pg_attribute_hidden();
+extern double jit_above_cost pg_attribute_hidden();
+extern double jit_inline_above_cost pg_attribute_hidden();
+extern double jit_optimize_above_cost pg_attribute_hidden();
 
 
 extern void jit_reset_after_error(void);
diff --git a/src/include/libpq/auth.h b/src/include/libpq/auth.h
index 3d6734f253..2231e9804a 100644
--- a/src/include/libpq/auth.h
+++ b/src/include/libpq/auth.h
@@ -16,8 +16,8 @@
 
 #include "libpq/libpq-be.h"
 
-extern char *pg_krb_server_keyfile;
-extern bool pg_krb_caseins_users;
+extern char *pg_krb_server_keyfile pg_attribute_hidden();
+extern bool pg_krb_caseins_users pg_attribute_hidden();
 extern char *pg_krb_realm;
 
 extern void ClientAuthentication(Port *port);
diff --git a/src/include/libpq/libpq.h b/src/include/libpq/libpq.h
index 6c51b2f20f..90c506ae87 100644
--- a/src/include/libpq/libpq.h
+++ b/src/include/libpq/libpq.h
@@ -85,13 +85,13 @@ extern bool pq_check_connection(void);
 /*
  * prototypes for functions in be-secure.c
  */
-extern char *ssl_library;
-extern char *ssl_cert_file;
-extern char *ssl_key_file;
-extern char *ssl_ca_file;
-extern char *ssl_crl_file;
-extern char *ssl_crl_dir;
-extern char *ssl_dh_params_file;
+extern char *ssl_library pg_attribute_hidden();
+extern char *ssl_cert_file pg_attribute_hidden();
+extern char *ssl_key_file pg_attribute_hidden();
+extern char *ssl_ca_file pg_attribute_hidden();
+extern char *ssl_crl_file pg_attribute_hidden();
+extern char *ssl_crl_dir pg_attribute_hidden();
+extern char *ssl_dh_params_file pg_attribute_hidden();
 extern PGDLLIMPORT char *ssl_passphrase_command;
 extern PGDLLIMPORT bool ssl_passphrase_command_supports_reload;
 #ifdef USE_SSL
@@ -116,11 +116,11 @@ extern ssize_t secure_open_gssapi(Port *port);
 #endif
 
 /* GUCs */
-extern char *SSLCipherSuites;
-extern char *SSLECDHCurve;
-extern bool SSLPreferServerCiphers;
-extern int	ssl_min_protocol_version;
-extern int	ssl_max_protocol_version;
+extern char *SSLCipherSuites pg_attribute_hidden();
+extern char *SSLECDHCurve pg_attribute_hidden();
+extern bool SSLPreferServerCiphers pg_attribute_hidden();
+extern int	ssl_min_protocol_version pg_attribute_hidden();
+extern int	ssl_max_protocol_version pg_attribute_hidden();
 
 enum ssl_protocol_versions
 {
diff --git a/src/include/libpq/pqcomm.h b/src/include/libpq/pqcomm.h
index be9d970574..940acd10c7 100644
--- a/src/include/libpq/pqcomm.h
+++ b/src/include/libpq/pqcomm.h
@@ -135,7 +135,7 @@ typedef ProtocolVersion MsgType;
 
 typedef uint32 PacketLen;
 
-extern bool Db_user_namespace;
+extern bool Db_user_namespace pg_attribute_hidden();
 
 /*
  * In protocol 3.0 and later, the startup packet length is not fixed, but
diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h
index 2e2e9a364a..63ffe89275 100644
--- a/src/include/miscadmin.h
+++ b/src/include/miscadmin.h
@@ -255,18 +255,18 @@ extern PGDLLIMPORT int IntervalStyle;
 
 #define MAXTZLEN		10		/* max TZ name len, not counting tr. null */
 
-extern bool enableFsync;
+extern bool enableFsync pg_attribute_hidden();
 extern PGDLLIMPORT bool allowSystemTableMods;
 extern PGDLLIMPORT int work_mem;
 extern PGDLLIMPORT double hash_mem_multiplier;
 extern PGDLLIMPORT int maintenance_work_mem;
 extern PGDLLIMPORT int max_parallel_maintenance_workers;
 
-extern int	VacuumCostPageHit;
-extern int	VacuumCostPageMiss;
-extern int	VacuumCostPageDirty;
-extern int	VacuumCostLimit;
-extern double VacuumCostDelay;
+extern int	VacuumCostPageHit pg_attribute_hidden();
+extern int	VacuumCostPageMiss pg_attribute_hidden();
+extern int	VacuumCostPageDirty pg_attribute_hidden();
+extern int	VacuumCostLimit pg_attribute_hidden();
+extern double VacuumCostDelay pg_attribute_hidden();
 
 extern int64 VacuumPageHit;
 extern int64 VacuumPageMiss;
@@ -299,7 +299,7 @@ extern void PreventCommandIfParallelMode(const char *cmdname);
 extern void PreventCommandDuringRecovery(const char *cmdname);
 
 /* in utils/misc/guc.c */
-extern int	trace_recovery_messages;
+extern int	trace_recovery_messages pg_attribute_hidden();
 extern int	trace_recovery(int trace_level);
 
 /*****************************************************************************
@@ -460,11 +460,11 @@ extern void InitPostgres(const char *in_dbname, Oid dboid, const char *username,
 extern void BaseInit(void);
 
 /* in utils/init/miscinit.c */
-extern bool IgnoreSystemIndexes;
+extern bool IgnoreSystemIndexes pg_attribute_hidden();
 extern PGDLLIMPORT bool process_shared_preload_libraries_in_progress;
-extern char *session_preload_libraries_string;
-extern char *shared_preload_libraries_string;
-extern char *local_preload_libraries_string;
+extern char *session_preload_libraries_string pg_attribute_hidden();
+extern char *shared_preload_libraries_string pg_attribute_hidden();
+extern char *local_preload_libraries_string pg_attribute_hidden();
 
 extern void CreateDataDirLockFile(bool amPostmaster);
 extern void CreateSocketLockFile(const char *socketfile, bool amPostmaster,
diff --git a/src/include/optimizer/geqo.h b/src/include/optimizer/geqo.h
index 24dcdfb6cc..839c620182 100644
--- a/src/include/optimizer/geqo.h
+++ b/src/include/optimizer/geqo.h
@@ -48,23 +48,23 @@
  *
  * If you change these, update backend/utils/misc/postgresql.conf.sample
  */
-extern int	Geqo_effort;		/* 1 .. 10, knob for adjustment of defaults */
+extern int	Geqo_effort pg_attribute_hidden();		/* 1 .. 10, knob for adjustment of defaults */
 
 #define DEFAULT_GEQO_EFFORT 5
 #define MIN_GEQO_EFFORT 1
 #define MAX_GEQO_EFFORT 10
 
-extern int	Geqo_pool_size;		/* 2 .. inf, or 0 to use default */
+extern int	Geqo_pool_size pg_attribute_hidden();		/* 2 .. inf, or 0 to use default */
 
-extern int	Geqo_generations;	/* 1 .. inf, or 0 to use default */
+extern int	Geqo_generations pg_attribute_hidden();	/* 1 .. inf, or 0 to use default */
 
-extern double Geqo_selection_bias;
+extern double Geqo_selection_bias pg_attribute_hidden();
 
 #define DEFAULT_GEQO_SELECTION_BIAS 2.0
 #define MIN_GEQO_SELECTION_BIAS 1.5
 #define MAX_GEQO_SELECTION_BIAS 2.0
 
-extern double Geqo_seed;		/* 0 .. 1 */
+extern double Geqo_seed pg_attribute_hidden();		/* 0 .. 1 */
 
 
 /*
diff --git a/src/include/optimizer/optimizer.h b/src/include/optimizer/optimizer.h
index 41b49b2662..8d7ebb6216 100644
--- a/src/include/optimizer/optimizer.h
+++ b/src/include/optimizer/optimizer.h
@@ -111,8 +111,8 @@ typedef enum
 }			ForceParallelMode;
 
 /* GUC parameters */
-extern int	force_parallel_mode;
-extern bool parallel_leader_participation;
+extern int	force_parallel_mode pg_attribute_hidden();
+extern bool parallel_leader_participation pg_attribute_hidden();
 
 extern struct PlannedStmt *planner(Query *parse, const char *query_string,
 								   int cursorOptions,
diff --git a/src/include/optimizer/planmain.h b/src/include/optimizer/planmain.h
index bf1adfc52a..112bd31b79 100644
--- a/src/include/optimizer/planmain.h
+++ b/src/include/optimizer/planmain.h
@@ -19,7 +19,7 @@
 
 /* GUC parameters */
 #define DEFAULT_CURSOR_TUPLE_FRACTION 0.1
-extern double cursor_tuple_fraction;
+extern double cursor_tuple_fraction pg_attribute_hidden();
 
 /* query_planner callback to compute query_pathkeys */
 typedef void (*query_pathkeys_callback) (PlannerInfo *root, void *extra);
@@ -64,8 +64,8 @@ extern Limit *make_limit(Plan *lefttree, Node *limitOffset, Node *limitCount,
 /*
  * prototypes for plan/initsplan.c
  */
-extern int	from_collapse_limit;
-extern int	join_collapse_limit;
+extern int	from_collapse_limit pg_attribute_hidden();
+extern int	join_collapse_limit pg_attribute_hidden();
 
 extern void add_base_rels_to_query(PlannerInfo *root, Node *jtnode);
 extern void add_other_rels_to_query(PlannerInfo *root);
diff --git a/src/include/parser/parse_expr.h b/src/include/parser/parse_expr.h
index 8ac4a0a369..6b72a0f550 100644
--- a/src/include/parser/parse_expr.h
+++ b/src/include/parser/parse_expr.h
@@ -16,7 +16,7 @@
 #include "parser/parse_node.h"
 
 /* GUC parameters */
-extern bool Transform_null_equals;
+extern bool Transform_null_equals pg_attribute_hidden();
 
 extern Node *transformExpr(ParseState *pstate, Node *expr, ParseExprKind exprKind);
 
diff --git a/src/include/parser/parser.h b/src/include/parser/parser.h
index 853b0f1606..e6f0c6d05e 100644
--- a/src/include/parser/parser.h
+++ b/src/include/parser/parser.h
@@ -53,8 +53,8 @@ typedef enum
 }			BackslashQuoteType;
 
 /* GUC variables in scan.l (every one of these is a bad idea :-() */
-extern int	backslash_quote;
-extern bool escape_string_warning;
+extern int	backslash_quote pg_attribute_hidden();
+extern bool escape_string_warning pg_attribute_hidden();
 extern PGDLLIMPORT bool standard_conforming_strings;
 
 
diff --git a/src/include/pgstat.h b/src/include/pgstat.h
index 509849c7ff..7de7c5eeca 100644
--- a/src/include/pgstat.h
+++ b/src/include/pgstat.h
@@ -940,9 +940,9 @@ typedef struct PgStat_FunctionCallUsage
  */
 extern PGDLLIMPORT bool pgstat_track_counts;
 extern PGDLLIMPORT int pgstat_track_functions;
-extern char *pgstat_stat_directory;
-extern char *pgstat_stat_tmpname;
-extern char *pgstat_stat_filename;
+extern char *pgstat_stat_directory pg_attribute_hidden();
+extern char *pgstat_stat_tmpname pg_attribute_hidden();
+extern char *pgstat_stat_filename pg_attribute_hidden();
 
 /*
  * BgWriter statistics counters are updated directly by bgwriter and bufmgr
diff --git a/src/include/pgtime.h b/src/include/pgtime.h
index 28bd27e7f7..c5d4436503 100644
--- a/src/include/pgtime.h
+++ b/src/include/pgtime.h
@@ -71,7 +71,7 @@ extern size_t pg_strftime(char *s, size_t max, const char *format,
 /* these functions and variables are in pgtz.c */
 
 extern PGDLLIMPORT pg_tz *session_timezone;
-extern pg_tz *log_timezone;
+extern pg_tz *log_timezone pg_attribute_hidden();
 
 extern void pg_timezone_initialize(void);
 extern pg_tz *pg_tzset(const char *tzname);
diff --git a/src/include/postmaster/autovacuum.h b/src/include/postmaster/autovacuum.h
index aacdd0f575..0928c7a0ef 100644
--- a/src/include/postmaster/autovacuum.h
+++ b/src/include/postmaster/autovacuum.h
@@ -27,25 +27,25 @@ typedef enum
 
 
 /* GUC variables */
-extern bool autovacuum_start_daemon;
-extern int	autovacuum_max_workers;
-extern int	autovacuum_work_mem;
-extern int	autovacuum_naptime;
-extern int	autovacuum_vac_thresh;
-extern double autovacuum_vac_scale;
-extern int	autovacuum_vac_ins_thresh;
-extern double autovacuum_vac_ins_scale;
-extern int	autovacuum_anl_thresh;
-extern double autovacuum_anl_scale;
-extern int	autovacuum_freeze_max_age;
-extern int	autovacuum_multixact_freeze_max_age;
-extern double autovacuum_vac_cost_delay;
-extern int	autovacuum_vac_cost_limit;
+extern bool autovacuum_start_daemon pg_attribute_hidden();
+extern int	autovacuum_max_workers pg_attribute_hidden();
+extern int	autovacuum_work_mem pg_attribute_hidden();
+extern int	autovacuum_naptime pg_attribute_hidden();
+extern int	autovacuum_vac_thresh pg_attribute_hidden();
+extern double autovacuum_vac_scale pg_attribute_hidden();
+extern int	autovacuum_vac_ins_thresh pg_attribute_hidden();
+extern double autovacuum_vac_ins_scale pg_attribute_hidden();
+extern int	autovacuum_anl_thresh pg_attribute_hidden();
+extern double autovacuum_anl_scale pg_attribute_hidden();
+extern int	autovacuum_freeze_max_age pg_attribute_hidden();
+extern int	autovacuum_multixact_freeze_max_age pg_attribute_hidden();
+extern double autovacuum_vac_cost_delay pg_attribute_hidden();
+extern int	autovacuum_vac_cost_limit pg_attribute_hidden();
 
 /* autovacuum launcher PID, only valid when worker is shutting down */
 extern int	AutovacuumLauncherPid;
 
-extern int	Log_autovacuum_min_duration;
+extern int	Log_autovacuum_min_duration pg_attribute_hidden();
 
 /* Status inquiry functions */
 extern bool AutoVacuumingActive(void);
diff --git a/src/include/postmaster/bgwriter.h b/src/include/postmaster/bgwriter.h
index c430b1b236..72c4a244f7 100644
--- a/src/include/postmaster/bgwriter.h
+++ b/src/include/postmaster/bgwriter.h
@@ -22,10 +22,10 @@
 
 
 /* GUC options */
-extern int	BgWriterDelay;
-extern int	CheckPointTimeout;
-extern int	CheckPointWarning;
-extern double CheckPointCompletionTarget;
+extern int	BgWriterDelay pg_attribute_hidden();
+extern int	CheckPointTimeout pg_attribute_hidden();
+extern int	CheckPointWarning pg_attribute_hidden();
+extern double CheckPointCompletionTarget pg_attribute_hidden();
 
 extern void BackgroundWriterMain(void) pg_attribute_noreturn();
 extern void CheckpointerMain(void) pg_attribute_noreturn();
diff --git a/src/include/postmaster/postmaster.h b/src/include/postmaster/postmaster.h
index 0efdd7c232..247a328aa7 100644
--- a/src/include/postmaster/postmaster.h
+++ b/src/include/postmaster/postmaster.h
@@ -14,22 +14,22 @@
 #define _POSTMASTER_H
 
 /* GUC options */
-extern bool EnableSSL;
-extern int	ReservedBackends;
+extern bool EnableSSL pg_attribute_hidden();
+extern int	ReservedBackends pg_attribute_hidden();
 extern PGDLLIMPORT int PostPortNumber;
-extern int	Unix_socket_permissions;
-extern char *Unix_socket_group;
-extern char *Unix_socket_directories;
-extern char *ListenAddresses;
+extern int	Unix_socket_permissions pg_attribute_hidden();
+extern char *Unix_socket_group pg_attribute_hidden();
+extern char *Unix_socket_directories pg_attribute_hidden();
+extern char *ListenAddresses pg_attribute_hidden();
 extern bool ClientAuthInProgress;
-extern int	PreAuthDelay;
-extern int	AuthenticationTimeout;
-extern bool Log_connections;
-extern bool log_hostname;
-extern bool enable_bonjour;
-extern char *bonjour_name;
-extern bool restart_after_crash;
-extern bool remove_temp_files_after_crash;
+extern int	PreAuthDelay pg_attribute_hidden();
+extern int	AuthenticationTimeout pg_attribute_hidden();
+extern bool Log_connections pg_attribute_hidden();
+extern bool log_hostname pg_attribute_hidden();
+extern bool enable_bonjour pg_attribute_hidden();
+extern char *bonjour_name pg_attribute_hidden();
+extern bool restart_after_crash pg_attribute_hidden();
+extern bool remove_temp_files_after_crash pg_attribute_hidden();
 
 #ifdef WIN32
 extern HANDLE PostmasterHandle;
diff --git a/src/include/postmaster/syslogger.h b/src/include/postmaster/syslogger.h
index 1491eecb0f..bfd5d59314 100644
--- a/src/include/postmaster/syslogger.h
+++ b/src/include/postmaster/syslogger.h
@@ -62,13 +62,13 @@ typedef union
 
 
 /* GUC options */
-extern bool Logging_collector;
-extern int	Log_RotationAge;
-extern int	Log_RotationSize;
+extern bool Logging_collector pg_attribute_hidden();
+extern int	Log_RotationAge pg_attribute_hidden();
+extern int	Log_RotationSize pg_attribute_hidden();
 extern PGDLLIMPORT char *Log_directory;
 extern PGDLLIMPORT char *Log_filename;
-extern bool Log_truncate_on_rotation;
-extern int	Log_file_mode;
+extern bool Log_truncate_on_rotation pg_attribute_hidden();
+extern int	Log_file_mode pg_attribute_hidden();
 
 #ifndef WIN32
 extern int	syslogPipe[2];
diff --git a/src/include/postmaster/walwriter.h b/src/include/postmaster/walwriter.h
index 3ccc332333..ea72ff74bd 100644
--- a/src/include/postmaster/walwriter.h
+++ b/src/include/postmaster/walwriter.h
@@ -13,8 +13,8 @@
 #define _WALWRITER_H
 
 /* GUC options */
-extern int	WalWriterDelay;
-extern int	WalWriterFlushAfter;
+extern int	WalWriterDelay pg_attribute_hidden();
+extern int	WalWriterFlushAfter pg_attribute_hidden();
 
 extern void WalWriterMain(void) pg_attribute_noreturn();
 
diff --git a/src/include/replication/logicallauncher.h b/src/include/replication/logicallauncher.h
index 301e494f7b..eb11346e05 100644
--- a/src/include/replication/logicallauncher.h
+++ b/src/include/replication/logicallauncher.h
@@ -12,8 +12,8 @@
 #ifndef LOGICALLAUNCHER_H
 #define LOGICALLAUNCHER_H
 
-extern int	max_logical_replication_workers;
-extern int	max_sync_workers_per_subscription;
+extern int	max_logical_replication_workers pg_attribute_hidden();
+extern int	max_sync_workers_per_subscription pg_attribute_hidden();
 
 extern void ApplyLauncherRegister(void);
 extern void ApplyLauncherMain(Datum main_arg);
diff --git a/src/include/replication/syncrep.h b/src/include/replication/syncrep.h
index 4266afde8b..5f299076bd 100644
--- a/src/include/replication/syncrep.h
+++ b/src/include/replication/syncrep.h
@@ -79,7 +79,7 @@ extern SyncRepConfigData *syncrep_parse_result;
 extern char *syncrep_parse_error_msg;
 
 /* user-settable parameters for synchronous replication */
-extern char *SyncRepStandbyNames;
+extern char *SyncRepStandbyNames pg_attribute_hidden();
 
 /* called by user backend */
 extern void SyncRepWaitForLSN(XLogRecPtr lsn, bool commit);
diff --git a/src/include/replication/walreceiver.h b/src/include/replication/walreceiver.h
index 0b607ed777..929a8f05d6 100644
--- a/src/include/replication/walreceiver.h
+++ b/src/include/replication/walreceiver.h
@@ -25,9 +25,9 @@
 #include "utils/tuplestore.h"
 
 /* user-settable parameters */
-extern int	wal_receiver_status_interval;
-extern int	wal_receiver_timeout;
-extern bool hot_standby_feedback;
+extern int	wal_receiver_status_interval pg_attribute_hidden();
+extern int	wal_receiver_timeout pg_attribute_hidden();
+extern bool hot_standby_feedback pg_attribute_hidden();
 
 /*
  * MAXCONNINFO: maximum size of a connection string.
diff --git a/src/include/replication/walsender.h b/src/include/replication/walsender.h
index 828106933c..660906beb4 100644
--- a/src/include/replication/walsender.h
+++ b/src/include/replication/walsender.h
@@ -31,9 +31,9 @@ extern bool am_db_walsender;
 extern bool wake_wal_senders;
 
 /* user-settable parameters */
-extern int	max_wal_senders;
-extern int	wal_sender_timeout;
-extern bool log_replication_commands;
+extern int	max_wal_senders pg_attribute_hidden();
+extern int	wal_sender_timeout pg_attribute_hidden();
+extern bool log_replication_commands pg_attribute_hidden();
 
 extern void InitWalSender(void);
 extern bool exec_replication_command(const char *query_string);
diff --git a/src/include/storage/bufmgr.h b/src/include/storage/bufmgr.h
index cfce23ecbc..7203d0dd1f 100644
--- a/src/include/storage/bufmgr.h
+++ b/src/include/storage/bufmgr.h
@@ -65,16 +65,16 @@ struct SMgrRelationData;
 extern PGDLLIMPORT int NBuffers;
 
 /* in bufmgr.c */
-extern bool zero_damaged_pages;
-extern int	bgwriter_lru_maxpages;
-extern double bgwriter_lru_multiplier;
-extern bool track_io_timing;
-extern int	effective_io_concurrency;
-extern int	maintenance_io_concurrency;
-
-extern int	checkpoint_flush_after;
-extern int	backend_flush_after;
-extern int	bgwriter_flush_after;
+extern bool zero_damaged_pages pg_attribute_hidden();
+extern int	bgwriter_lru_maxpages pg_attribute_hidden();
+extern double bgwriter_lru_multiplier pg_attribute_hidden();
+extern bool track_io_timing pg_attribute_hidden();
+extern int	effective_io_concurrency pg_attribute_hidden();
+extern int	maintenance_io_concurrency pg_attribute_hidden();
+
+extern int	checkpoint_flush_after pg_attribute_hidden();
+extern int	backend_flush_after pg_attribute_hidden();
+extern int	bgwriter_flush_after pg_attribute_hidden();
 
 /* in buf_init.c */
 extern PGDLLIMPORT char *BufferBlocks;
diff --git a/src/include/storage/dsm_impl.h b/src/include/storage/dsm_impl.h
index ff72f7b0e5..ed2d36aa25 100644
--- a/src/include/storage/dsm_impl.h
+++ b/src/include/storage/dsm_impl.h
@@ -39,8 +39,8 @@
 #endif
 
 /* GUC. */
-extern int	dynamic_shared_memory_type;
-extern int	min_dynamic_shared_memory;
+extern int	dynamic_shared_memory_type pg_attribute_hidden();
+extern int	min_dynamic_shared_memory pg_attribute_hidden();
 
 /*
  * Directory for on-disk state.
diff --git a/src/include/storage/fd.h b/src/include/storage/fd.h
index 34602ae006..e2dc043191 100644
--- a/src/include/storage/fd.h
+++ b/src/include/storage/fd.h
@@ -59,7 +59,7 @@ typedef int File;
 /* GUC parameter */
 extern PGDLLIMPORT int max_files_per_process;
 extern PGDLLIMPORT bool data_sync_retry;
-extern int	recovery_init_sync_method;
+extern int	recovery_init_sync_method pg_attribute_hidden();
 
 /*
  * This is private to fd.c, but exported for save/restore_backend_variables()
diff --git a/src/include/storage/large_object.h b/src/include/storage/large_object.h
index ae1e2482ea..a7ec3052fd 100644
--- a/src/include/storage/large_object.h
+++ b/src/include/storage/large_object.h
@@ -79,7 +79,7 @@ typedef struct LargeObjectDesc
 /*
  * GUC: backwards-compatibility flag to suppress LO permission checks
  */
-extern bool lo_compat_privileges;
+extern bool lo_compat_privileges pg_attribute_hidden();
 
 /*
  * Function definitions...
diff --git a/src/include/storage/lock.h b/src/include/storage/lock.h
index 9b2a421c32..e63fbebae9 100644
--- a/src/include/storage/lock.h
+++ b/src/include/storage/lock.h
@@ -34,14 +34,14 @@ typedef struct PROC_QUEUE
 } PROC_QUEUE;
 
 /* GUC variables */
-extern int	max_locks_per_xact;
+extern int	max_locks_per_xact pg_attribute_hidden();
 
 #ifdef LOCK_DEBUG
-extern int	Trace_lock_oidmin;
-extern bool Trace_locks;
-extern bool Trace_userlocks;
-extern int	Trace_lock_table;
-extern bool Debug_deadlocks;
+extern int	Trace_lock_oidmin pg_attribute_hidden();
+extern bool Trace_locks pg_attribute_hidden();
+extern bool Trace_userlocks pg_attribute_hidden();
+extern int	Trace_lock_table pg_attribute_hidden();
+extern bool Debug_deadlocks pg_attribute_hidden();
 #endif							/* LOCK_DEBUG */
 
 
diff --git a/src/include/storage/lwlock.h b/src/include/storage/lwlock.h
index a8f052e484..5c339662ef 100644
--- a/src/include/storage/lwlock.h
+++ b/src/include/storage/lwlock.h
@@ -110,7 +110,7 @@ typedef enum LWLockMode
 
 
 #ifdef LOCK_DEBUG
-extern bool Trace_lwlocks;
+extern bool Trace_lwlocks pg_attribute_hidden();
 #endif
 
 extern bool LWLockAcquire(LWLock *lock, LWLockMode mode);
diff --git a/src/include/storage/pg_shmem.h b/src/include/storage/pg_shmem.h
index 059df1b72c..f44fcc3de7 100644
--- a/src/include/storage/pg_shmem.h
+++ b/src/include/storage/pg_shmem.h
@@ -42,9 +42,9 @@ typedef struct PGShmemHeader	/* standard header for all Postgres shmem */
 } PGShmemHeader;
 
 /* GUC variables */
-extern int	shared_memory_type;
-extern int	huge_pages;
-extern int	huge_page_size;
+extern int	shared_memory_type pg_attribute_hidden();
+extern int	huge_pages pg_attribute_hidden();
+extern int	huge_page_size pg_attribute_hidden();
 
 /* Possible values for huge_pages */
 typedef enum
diff --git a/src/include/storage/predicate.h b/src/include/storage/predicate.h
index 152b698611..81154c2321 100644
--- a/src/include/storage/predicate.h
+++ b/src/include/storage/predicate.h
@@ -22,9 +22,9 @@
 /*
  * GUC variables
  */
-extern int	max_predicate_locks_per_xact;
-extern int	max_predicate_locks_per_relation;
-extern int	max_predicate_locks_per_page;
+extern int	max_predicate_locks_per_xact pg_attribute_hidden();
+extern int	max_predicate_locks_per_relation pg_attribute_hidden();
+extern int	max_predicate_locks_per_page pg_attribute_hidden();
 
 
 /* Number of SLRU buffers to use for Serial SLRU */
diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h
index be67d8a861..c07c9948c0 100644
--- a/src/include/storage/proc.h
+++ b/src/include/storage/proc.h
@@ -382,7 +382,7 @@ extern PGDLLIMPORT int StatementTimeout;
 extern PGDLLIMPORT int LockTimeout;
 extern PGDLLIMPORT int IdleInTransactionSessionTimeout;
 extern PGDLLIMPORT int IdleSessionTimeout;
-extern bool log_lock_waits;
+extern bool log_lock_waits pg_attribute_hidden();
 
 
 /*
diff --git a/src/include/storage/standby.h b/src/include/storage/standby.h
index 38fd85a431..cebfcf2288 100644
--- a/src/include/storage/standby.h
+++ b/src/include/storage/standby.h
@@ -21,10 +21,10 @@
 #include "storage/standbydefs.h"
 
 /* User-settable GUC parameters */
-extern int	vacuum_defer_cleanup_age;
-extern int	max_standby_archive_delay;
-extern int	max_standby_streaming_delay;
-extern bool log_recovery_conflict_waits;
+extern int	vacuum_defer_cleanup_age pg_attribute_hidden();
+extern int	max_standby_archive_delay pg_attribute_hidden();
+extern int	max_standby_streaming_delay pg_attribute_hidden();
+extern bool log_recovery_conflict_waits pg_attribute_hidden();
 
 extern void InitRecoveryTransactionEnvironment(void);
 extern void ShutdownRecoveryTransactionEnvironment(void);
diff --git a/src/include/tcop/tcopprot.h b/src/include/tcop/tcopprot.h
index 968345404e..87cf1327c7 100644
--- a/src/include/tcop/tcopprot.h
+++ b/src/include/tcop/tcopprot.h
@@ -27,9 +27,9 @@
 
 extern CommandDest whereToSendOutput;
 extern PGDLLIMPORT const char *debug_query_string;
-extern int	max_stack_depth;
-extern int	PostAuthDelay;
-extern int	client_connection_check_interval;
+extern int	max_stack_depth pg_attribute_hidden();
+extern int	PostAuthDelay pg_attribute_hidden();
+extern int	client_connection_check_interval pg_attribute_hidden();
 
 /* GUC-configurable parameters */
 
diff --git a/src/include/tsearch/ts_cache.h b/src/include/tsearch/ts_cache.h
index 888f7028b1..a03412ed8c 100644
--- a/src/include/tsearch/ts_cache.h
+++ b/src/include/tsearch/ts_cache.h
@@ -84,7 +84,7 @@ typedef struct
 /*
  * GUC variable for current configuration
  */
-extern char *TSCurrentConfig;
+extern char *TSCurrentConfig pg_attribute_hidden();
 
 
 extern TSParserCacheEntry *lookup_ts_parser_cache(Oid prsId);
diff --git a/src/include/utils/array.h b/src/include/utils/array.h
index 4ae6c3be2f..eeeb2f7995 100644
--- a/src/include/utils/array.h
+++ b/src/include/utils/array.h
@@ -339,7 +339,7 @@ typedef struct ArrayIteratorData *ArrayIterator;
 /*
  * GUC parameter
  */
-extern bool Array_nulls;
+extern bool Array_nulls pg_attribute_hidden();
 
 /*
  * prototypes for functions defined in arrayfuncs.c
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 40fcb0ab6d..986a97b193 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -65,7 +65,7 @@ extern char *regexp_fixed_prefix(text *text_re, bool case_insensitive,
 								 Oid collation, bool *exact);
 
 /* ruleutils.c */
-extern bool quote_all_identifiers;
+extern bool quote_all_identifiers pg_attribute_hidden();
 extern const char *quote_identifier(const char *ident);
 extern char *quote_qualified_identifier(const char *qualifier,
 										const char *ident);
diff --git a/src/include/utils/bytea.h b/src/include/utils/bytea.h
index eb9df9e4f7..0bf0631f39 100644
--- a/src/include/utils/bytea.h
+++ b/src/include/utils/bytea.h
@@ -22,6 +22,6 @@ typedef enum
 	BYTEA_OUTPUT_HEX
 }			ByteaOutputType;
 
-extern int	bytea_output;		/* ByteaOutputType, but int for GUC enum */
+extern int	bytea_output pg_attribute_hidden();		/* ByteaOutputType, but int for GUC enum */
 
 #endif							/* BYTEA_H */
diff --git a/src/include/utils/elog.h b/src/include/utils/elog.h
index f53607e12e..76ac92e4a1 100644
--- a/src/include/utils/elog.h
+++ b/src/include/utils/elog.h
@@ -424,12 +424,12 @@ typedef enum
 	PGERROR_VERBOSE				/* all the facts, ma'am */
 }			PGErrorVerbosity;
 
-extern int	Log_error_verbosity;
-extern char *Log_line_prefix;
+extern int	Log_error_verbosity pg_attribute_hidden();
+extern char *Log_line_prefix pg_attribute_hidden();
 extern int	Log_destination;
-extern char *Log_destination_string;
-extern bool syslog_sequence_numbers;
-extern bool syslog_split_messages;
+extern char *Log_destination_string pg_attribute_hidden();
+extern bool syslog_sequence_numbers pg_attribute_hidden();
+extern bool syslog_split_messages pg_attribute_hidden();
 
 /* Log destination bitmap */
 #define LOG_DESTINATION_STDERR	 1
diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h
index a7c3a4958e..4bbf76c3dc 100644
--- a/src/include/utils/guc.h
+++ b/src/include/utils/guc.h
@@ -233,53 +233,53 @@ typedef enum
 
 
 /* GUC vars that are actually declared in guc.c, rather than elsewhere */
-extern bool Debug_print_plan;
-extern bool Debug_print_parse;
-extern bool Debug_print_rewritten;
-extern bool Debug_pretty_print;
+extern bool Debug_print_plan pg_attribute_hidden();
+extern bool Debug_print_parse pg_attribute_hidden();
+extern bool Debug_print_rewritten pg_attribute_hidden();
+extern bool Debug_pretty_print pg_attribute_hidden();
 
-extern bool log_parser_stats;
-extern bool log_planner_stats;
-extern bool log_executor_stats;
-extern bool log_statement_stats;
-extern bool log_btree_build_stats;
+extern bool log_parser_stats pg_attribute_hidden();
+extern bool log_planner_stats pg_attribute_hidden();
+extern bool log_executor_stats pg_attribute_hidden();
+extern bool log_statement_stats pg_attribute_hidden();
+extern bool log_btree_build_stats pg_attribute_hidden();
 
 extern PGDLLIMPORT bool check_function_bodies;
-extern bool session_auth_is_superuser;
+extern bool session_auth_is_superuser pg_attribute_hidden();
 
-extern bool log_duration;
-extern int	log_parameter_max_length;
-extern int	log_parameter_max_length_on_error;
-extern int	log_min_error_statement;
+extern bool log_duration pg_attribute_hidden();
+extern int	log_parameter_max_length pg_attribute_hidden();
+extern int	log_parameter_max_length_on_error pg_attribute_hidden();
+extern int	log_min_error_statement pg_attribute_hidden();
 extern PGDLLIMPORT int log_min_messages;
 extern PGDLLIMPORT int client_min_messages;
-extern int	log_min_duration_sample;
-extern int	log_min_duration_statement;
-extern int	log_temp_files;
-extern double log_statement_sample_rate;
-extern double log_xact_sample_rate;
-extern char *backtrace_functions;
+extern int	log_min_duration_sample pg_attribute_hidden();
+extern int	log_min_duration_statement pg_attribute_hidden();
+extern int	log_temp_files pg_attribute_hidden();
+extern double log_statement_sample_rate pg_attribute_hidden();
+extern double log_xact_sample_rate pg_attribute_hidden();
+extern char *backtrace_functions pg_attribute_hidden();
 extern char *backtrace_symbol_list;
 
-extern int	temp_file_limit;
+extern int	temp_file_limit pg_attribute_hidden();
 
-extern int	num_temp_buffers;
+extern int	num_temp_buffers pg_attribute_hidden();
 
-extern char *cluster_name;
+extern char *cluster_name pg_attribute_hidden();
 extern PGDLLIMPORT char *ConfigFileName;
-extern char *HbaFileName;
-extern char *IdentFileName;
-extern char *external_pid_file;
+extern char *HbaFileName pg_attribute_hidden();
+extern char *IdentFileName pg_attribute_hidden();
+extern char *external_pid_file pg_attribute_hidden();
 
 extern PGDLLIMPORT char *application_name;
 
-extern int	tcp_keepalives_idle;
-extern int	tcp_keepalives_interval;
-extern int	tcp_keepalives_count;
-extern int	tcp_user_timeout;
+extern int	tcp_keepalives_idle pg_attribute_hidden();
+extern int	tcp_keepalives_interval pg_attribute_hidden();
+extern int	tcp_keepalives_count pg_attribute_hidden();
+extern int	tcp_user_timeout pg_attribute_hidden();
 
 #ifdef TRACE_SORT
-extern bool trace_sort;
+extern bool trace_sort pg_attribute_hidden();
 #endif
 
 /*
diff --git a/src/include/utils/pg_locale.h b/src/include/utils/pg_locale.h
index 2946f46c76..202578c227 100644
--- a/src/include/utils/pg_locale.h
+++ b/src/include/utils/pg_locale.h
@@ -36,10 +36,10 @@
 
 
 /* GUC settings */
-extern char *locale_messages;
-extern char *locale_monetary;
-extern char *locale_numeric;
-extern char *locale_time;
+extern char *locale_messages pg_attribute_hidden();
+extern char *locale_monetary pg_attribute_hidden();
+extern char *locale_numeric pg_attribute_hidden();
+extern char *locale_time pg_attribute_hidden();
 
 /* lc_time localization cache */
 extern char *localized_abbrev_days[];
diff --git a/src/include/utils/plancache.h b/src/include/utils/plancache.h
index ff09c63a02..39f5dbdbd6 100644
--- a/src/include/utils/plancache.h
+++ b/src/include/utils/plancache.h
@@ -35,7 +35,7 @@ typedef enum
 }			PlanCacheMode;
 
 /* GUC parameter */
-extern int	plan_cache_mode;
+extern int	plan_cache_mode pg_attribute_hidden();
 
 #define CACHEDPLANSOURCE_MAGIC		195726186
 #define CACHEDPLAN_MAGIC			953717834
diff --git a/src/include/utils/ps_status.h b/src/include/utils/ps_status.h
index 9f43e1fdf0..1682b02f8e 100644
--- a/src/include/utils/ps_status.h
+++ b/src/include/utils/ps_status.h
@@ -12,7 +12,7 @@
 #ifndef PS_STATUS_H
 #define PS_STATUS_H
 
-extern bool update_process_title;
+extern bool update_process_title pg_attribute_hidden();
 
 extern char **save_ps_display_args(int argc, char **argv);
 
diff --git a/src/include/utils/queryjumble.h b/src/include/utils/queryjumble.h
index 7af6652f3e..38bc6e3f19 100644
--- a/src/include/utils/queryjumble.h
+++ b/src/include/utils/queryjumble.h
@@ -61,7 +61,7 @@ enum ComputeQueryIdType
 };
 
 /* GUC parameters */
-extern int	compute_query_id;
+extern int	compute_query_id pg_attribute_hidden();
 
 
 extern const char *CleanQuerytext(const char *query, int *location, int *len);
diff --git a/src/include/utils/rls.h b/src/include/utils/rls.h
index 46b32347c3..c1bc1d8029 100644
--- a/src/include/utils/rls.h
+++ b/src/include/utils/rls.h
@@ -14,7 +14,7 @@
 #define RLS_H
 
 /* GUC variable */
-extern bool row_security;
+extern bool row_security pg_attribute_hidden();
 
 /*
  * Used by callers of check_enable_rls.
diff --git a/src/include/utils/xml.h b/src/include/utils/xml.h
index d79668f3c4..12721051c6 100644
--- a/src/include/utils/xml.h
+++ b/src/include/utils/xml.h
@@ -75,9 +75,9 @@ extern char *map_sql_identifier_to_xml_name(const char *ident, bool fully_escape
 extern char *map_xml_name_to_sql_identifier(const char *name);
 extern char *map_sql_value_to_xml_value(Datum value, Oid type, bool xml_escape_strings);
 
-extern int	xmlbinary;			/* XmlBinaryType, but int for guc enum */
+extern int	xmlbinary pg_attribute_hidden();			/* XmlBinaryType, but int for guc enum */
 
-extern int	xmloption;			/* XmlOptionType, but int for guc enum */
+extern int	xmloption pg_attribute_hidden();			/* XmlOptionType, but int for guc enum */
 
 extern const TableFuncRoutine XmlTableRoutine;
 
-- 
2.32.0

Reply via email to