Hi,
Compiling postgres with said option in CFLAGS really gives an astounding
number of warnings. Except some bison/flex generated ones, none of them
looks acceptable to me.
Most are just file local variables with a missing static and easy to
fix. Several other are actually shared variables, where people simply
haven't bothered to add the variable to a header. Some of them with
comments declaring that fact, others adding longer comments, even others
adding longer comments about that fact.
I've attached the output of such a compilation run for those without
clang.
Greetings,
Andres Freund
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
In file included from /home/andres/src/postgresql/src/port/pg_crc.c:21:
/home/andres/src/postgresql/src/include/utils/pg_crc_tables.h:36:14: warning:
no previous extern declaration for non-static variable 'pg_crc32_table'
[-Wmissing-variable-declarations]
const uint32 pg_crc32_table[256] = {
^
1 warning generated.
In file included from /home/andres/src/postgresql/src/port/pg_crc.c:21:
/home/andres/src/postgresql/src/include/utils/pg_crc_tables.h:36:14: warning:
no previous extern declaration for non-static variable 'pg_crc32_table'
[-Wmissing-variable-declarations]
const uint32 pg_crc32_table[256] = {
^
1 warning generated.
bootparse.c:1267:5: warning: no previous extern declaration for non-static
variable 'boot_yychar' [-Wmissing-variable-declarations]
int yychar;
^
bootparse.c:67:25: note: expanded from macro 'yychar'
#define yychar boot_yychar
^
bootparse.c:1282:5: warning: no previous extern declaration for non-static
variable 'boot_yynerrs' [-Wmissing-variable-declarations]
int yynerrs;
^
bootparse.c:69:25: note: expanded from macro 'yynerrs'
#define yynerrs boot_yynerrs
^
/home/andres/src/postgresql/src/backend/bootstrap/bootstrap.c:52:9: warning: no
previous extern declaration for non-static variable
'bootstrap_data_checksum_version' [-Wmissing-variable-declarations]
uint32 bootstrap_data_checksum_version = 0; /* No checksum
*/
^
pg_shmem.c:41:15: warning: no previous extern declaration for non-static
variable 'UsedShmemSegID' [-Wmissing-variable-declarations]
unsigned long UsedShmemSegID = 0;
^
pg_shmem.c:42:10: warning: no previous extern declaration for non-static
variable 'UsedShmemSegAddr' [-Wmissing-variable-declarations]
void *UsedShmemSegAddr = NULL;
^
1 warning generated.
2 warnings generated.
2 warnings generated.
/home/andres/src/postgresql/src/backend/catalog/heap.c:77:7: warning: no
previous extern declaration for non-static variable
'binary_upgrade_next_heap_pg_class_oid' [-Wmissing-variable-declarations]
Oid binary_upgrade_next_heap_pg_class_oid = InvalidOid;
^
/home/andres/src/postgresql/src/backend/catalog/heap.c:78:7: warning: no
previous extern declaration for non-static variable
'binary_upgrade_next_toast_pg_class_oid' [-Wmissing-variable-declarations]
Oid binary_upgrade_next_toast_pg_class_oid = InvalidOid;
^
/home/andres/src/postgresql/src/backend/nodes/nodes.c:31:10: warning: no
previous extern declaration for non-static variable 'newNodeMacroHolder'
[-Wmissing-variable-declarations]
Node *newNodeMacroHolder;
^
1 warning generated.
/home/andres/src/postgresql/src/backend/libpq/be-secure.c:116:10: warning: no
previous extern declaration for non-static variable 'SSLCipherSuites'
[-Wmissing-variable-declarations]
char *SSLCipherSuites = NULL;
^
/home/andres/src/postgresql/src/backend/libpq/be-secure.c:119:10: warning: no
previous extern declaration for non-static variable 'SSLECDHCurve'
[-Wmissing-variable-declarations]
char *SSLECDHCurve;
^
/home/andres/src/postgresql/src/backend/libpq/be-secure.c:122:9: warning: no
previous extern declaration for non-static variable 'SSLPreferServerCiphers'
[-Wmissing-variable-declarations]
bool SSLPreferServerCiphers;
^
2 warnings generated.
3 warnings generated.
/home/andres/src/postgresql/src/backend/catalog/index.c:72:7: warning: no
previous extern declaration for non-static variable
'binary_upgrade_next_index_pg_class_oid' [-Wmissing-variable-declarations]
Oid binary_upgrade_next_index_pg_class_oid = InvalidOid;
^
/home/andres/src/postgresql/src/backend/postmaster/bgworker.c:93:24: warning:
no previous extern declaration for non-static variable 'BackgroundWorkerData'
[-Wmissing-variable-declarations]
BackgroundWorkerArray *BackgroundWorkerData;
^
/home/andres/src/postgresql/src/backend/libpq/pqcomm.c:102:7: warning: no
previous extern declaration for non-static variable 'Unix_socket_permissions'
[-Wmissing-variable-declarations]
int Unix_socket_permissions;
^
/home/andres/src/postgresql/src/backend/libpq/pqcomm.c:103:10: warning: no
previous extern declaration for non-static variable 'Unix_socket_group'
[-Wmissing-variable-declarations]
char *Unix_socket_group;
^
1 warning generated.
2 warnings generated.
1 warning generated.
/home/andres/src/postgresql/src/backend/commands/event_trigger.c:54:25:
warning: no previous extern declaration for non-static variable
'currentEventTriggerState' [-Wmissing-variable-declarations]
EventTriggerQueryState *currentEventTriggerState = NULL;
^
1 warning generated.
/home/andres/src/postgresql/src/backend/postmaster/postmaster.c:241:10:
warning: no previous extern declaration for non-static variable
'output_config_variable' [-Wmissing-variable-declarations]
char *output_config_variable = NULL;
^
/home/andres/src/postgresql/src/backend/postmaster/postmaster.c:338:7: warning:
no previous extern declaration for non-static variable 'redirection_done'
[-Wmissing-variable-declarations]
bool redirection_done = false; /* stderr redirected for
syslogger? */
^
/home/andres/src/postgresql/src/backend/access/heap/heapam.c:76:7: warning: no
previous extern declaration for non-static variable 'synchronize_seqscans'
[-Wmissing-variable-declarations]
bool synchronize_seqscans = true;
^
2 warnings generated.
/home/andres/src/postgresql/src/backend/catalog/pg_enum.c:34:7: warning: no
previous extern declaration for non-static variable
'binary_upgrade_next_pg_enum_oid' [-Wmissing-variable-declarations]
Oid binary_upgrade_next_pg_enum_oid = InvalidOid;
^
1 warning generated.
1 warning generated.
repl_gram.c:1148:5: warning: no previous extern declaration for non-static
variable 'replication_yychar' [-Wmissing-variable-declarations]
int yychar;
^
repl_gram.c:67:25: note: expanded from macro 'yychar'
#define yychar replication_yychar
^
repl_gram.c:1163:5: warning: no previous extern declaration for non-static
variable 'replication_yynerrs' [-Wmissing-variable-declarations]
int yynerrs;
^
repl_gram.c:69:25: note: expanded from macro 'yynerrs'
#define yynerrs replication_yynerrs
^
2 warnings generated.
/home/andres/src/postgresql/src/backend/commands/tablespace.c:82:10: warning:
no previous extern declaration for non-static variable 'default_tablespace'
[-Wmissing-variable-declarations]
char *default_tablespace = NULL;
^
/home/andres/src/postgresql/src/backend/commands/tablespace.c:83:10: warning:
no previous extern declaration for non-static variable 'temp_tablespaces'
[-Wmissing-variable-declarations]
char *temp_tablespaces = NULL;
^
/home/andres/src/postgresql/src/backend/commands/user.c:41:7: warning: no
previous extern declaration for non-static variable
'binary_upgrade_next_pg_authid_oid' [-Wmissing-variable-declarations]
Oid binary_upgrade_next_pg_authid_oid = InvalidOid;
^
2 warnings generated.
1 warning generated.
/home/andres/src/postgresql/src/backend/commands/typecmds.c:89:7: warning: no
previous extern declaration for non-static variable
'binary_upgrade_next_array_pg_type_oid' [-Wmissing-variable-declarations]
Oid binary_upgrade_next_array_pg_type_oid = InvalidOid;
^
1 warning generated.
/home/andres/src/postgresql/src/backend/access/rmgrdesc/xlogdesc.c:27:32:
warning: no previous extern declaration for non-static variable
'wal_level_options' [-Wmissing-variable-declarations]
const struct config_enum_entry wal_level_options[] = {
^
1 warning generated.
/home/andres/src/postgresql/src/backend/catalog/toasting.c:36:7: warning: no
previous extern declaration for non-static variable
'binary_upgrade_next_toast_pg_type_oid' [-Wmissing-variable-declarations]
Oid binary_upgrade_next_toast_pg_type_oid = InvalidOid;
^
1 warning generated.
/home/andres/src/postgresql/src/backend/catalog/pg_type.c:39:7: warning: no
previous extern declaration for non-static variable
'binary_upgrade_next_pg_type_oid' [-Wmissing-variable-declarations]
Oid binary_upgrade_next_pg_type_oid = InvalidOid;
^
1 warning generated.
/home/andres/src/postgresql/src/backend/tcop/postgres.c:98:7: warning: no
previous extern declaration for non-static variable 'Log_disconnections'
[-Wmissing-variable-declarations]
bool Log_disconnections = false;
^
/home/andres/src/postgresql/src/backend/tcop/postgres.c:124:10: warning: no
previous extern declaration for non-static variable 'stack_base_ptr'
[-Wmissing-variable-declarations]
char *stack_base_ptr = NULL;
^
2 warnings generated.
/home/andres/src/postgresql/src/backend/storage/ipc/dsm_impl.c:93:32: warning:
no previous extern declaration for non-static variable
'dynamic_shared_memory_options' [-Wmissing-variable-declarations]
const struct config_enum_entry dynamic_shared_memory_options[] = {
^
1 warning generated.
/home/andres/src/postgresql/src/backend/access/transam/xlog.c:85:7: warning: no
previous extern declaration for non-static variable 'CommitDelay'
[-Wmissing-variable-declarations]
int CommitDelay = 0; /* precommit delay in
microseconds */
^
/home/andres/src/postgresql/src/backend/access/transam/xlog.c:86:7: warning: no
previous extern declaration for non-static variable 'CommitSiblings'
[-Wmissing-variable-declarations]
int CommitSiblings = 5; /* # concurrent xacts needed to
sleep */
^
/home/andres/src/postgresql/src/backend/access/transam/xlog.c:110:32: warning:
no previous extern declaration for non-static variable 'sync_method_options'
[-Wmissing-variable-declarations]
const struct config_enum_entry sync_method_options[] = {
^
/home/andres/src/postgresql/src/backend/utils/adt/datetime.c:62:10: warning: no
previous extern declaration for non-static variable 'months'
[-Wmissing-variable-declarations]
char *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
^
/home/andres/src/postgresql/src/backend/utils/adt/datetime.c:65:10: warning: no
previous extern declaration for non-static variable 'days'
[-Wmissing-variable-declarations]
char *days[] = {"Sunday", "Monday", "Tuesday", "Wednesday",
^
/home/andres/src/postgresql/src/backend/storage/ipc/shmem.c:84:13: warning: no
previous extern declaration for non-static variable 'ShmemLock'
[-Wmissing-variable-declarations]
slock_t *ShmemLock; /* spinlock for shared memory and LWLock
^
1 warning generated.
/home/andres/src/postgresql/src/backend/storage/page/bufpage.c:25:7: warning:
no previous extern declaration for non-static variable
'ignore_checksum_failure' [-Wmissing-variable-declarations]
bool ignore_checksum_failure = false;
^
1 warning generated.
/home/andres/src/postgresql/src/backend/utils/cache/relfilenodemap.c:36:13:
warning: no previous extern declaration for non-static variable
'relfilenode_skey' [-Wmissing-variable-declarations]
ScanKeyData relfilenode_skey[2];
^
/home/andres/src/postgresql/src/backend/storage/lmgr/lock.c:241:33: warning: no
previous extern declaration for non-static variable
'FastPathStrongRelationLocks' [-Wmissing-variable-declarations]
FastPathStrongRelationLockData *FastPathStrongRelationLocks;
^
1 warning generated.
2 warnings generated.
1 warning generated.
3 warnings generated.
/home/andres/src/postgresql/src/backend/storage/lmgr/s_lock.c:23:10: warning:
no previous extern declaration for non-static variable 'dummy_spinlock'
[-Wmissing-variable-declarations]
slock_t dummy_spinlock;
^
1 warning generated.
/home/andres/src/postgresql/src/backend/utils/init/globals.c:126:7: warning: no
previous extern declaration for non-static variable 'GinFuzzySearchLimit'
[-Wmissing-variable-declarations]
int GinFuzzySearchLimit = 0;
^
/home/andres/src/postgresql/src/backend/utils/init/globals.c:26:17: warning: no
previous extern declaration for non-static variable 'FrontendProtocol'
[-Wmissing-variable-declarations]
ProtocolVersion FrontendProtocol;
^
2 warnings generated.
/home/andres/src/postgresql/src/backend/utils/misc/guc.c:419:7: warning: no
previous extern declaration for non-static variable 'Password_encryption'
[-Wmissing-variable-declarations]
bool Password_encryption = true;
^
/home/andres/src/postgresql/src/backend/utils/misc/guc.c:413:10: warning: no
previous extern declaration for non-static variable 'event_source'
[-Wmissing-variable-declarations]
char *event_source;
^
/home/andres/src/postgresql/src/backend/utils/misc/guc.c:438:10: warning: no
previous extern declaration for non-static variable 'pgstat_temp_directory'
[-Wmissing-variable-declarations]
char *pgstat_temp_directory;
^
/home/andres/src/postgresql/src/backend/utils/misc/guc.c:479:10: warning: no
previous extern declaration for non-static variable 'role_string'
[-Wmissing-variable-declarations]
char *role_string;
^
/home/andres/src/postgresql/src/backend/utils/sort/tuplesort.c:128:7: warning:
no previous extern declaration for non-static variable 'trace_sort'
[-Wmissing-variable-declarations]
bool trace_sort = false;
^
1 warning generated.
4 warnings generated.
/home/andres/src/postgresql/src/interfaces/ecpg/preproc/keywords.c:25:19:
warning: no previous extern declaration for non-static variable
'SQLScanKeywords' [-Wmissing-variable-declarations]
const ScanKeyword SQLScanKeywords[] = {
^
/home/andres/src/postgresql/src/interfaces/ecpg/preproc/keywords.c:29:11:
warning: no previous extern declaration for non-static variable
'NumSQLScanKeywords' [-Wmissing-variable-declarations]
const int NumSQLScanKeywords = lengthof(SQLScanKeywords);
^
2 warnings generated.
preproc.y:63:17: warning: no previous extern declaration for non-static
variable 'ecpg_query' [-Wmissing-variable-declarations]
struct ECPGtype ecpg_query = {ECPGt_char_variable, NULL, NULL, NULL, {NULL}, 0};
^
In file included from preproc.y:14959:
/home/andres/src/postgresql/src/interfaces/ecpg/preproc/pgc.l:67:4: warning: no
previous extern declaration for non-static variable 'yy_buffer'
[-Wmissing-variable-declarations]
} *yy_buffer = NULL;
^
preproc.c:28232:5: warning: no previous extern declaration for non-static
variable 'base_yychar' [-Wmissing-variable-declarations]
int yychar;
^
preproc.c:67:25: note: expanded from macro 'yychar'
#define yychar base_yychar
^
preproc.c:28255:5: warning: no previous extern declaration for non-static
variable 'base_yynerrs' [-Wmissing-variable-declarations]
int yynerrs;
^
preproc.c:69:25: note: expanded from macro 'yynerrs'
#define yynerrs base_yynerrs
^
In file included from preproc.y:14959:
/home/andres/src/postgresql/src/interfaces/ecpg/preproc/pgc.l:59:5: warning: no
previous extern declaration for non-static variable 'state_before'
[-Wmissing-variable-declarations]
int state_before;
^
5 warnings generated.
/home/andres/src/postgresql/src/bin/initdb/initdb.c:185:13: warning: no
previous extern declaration for non-static variable 'subdirs'
[-Wmissing-variable-declarations]
const char *subdirs[] = {
^
/home/andres/src/postgresql/src/bin/pg_basebackup/pg_basebackup.c:37:10:
warning: no previous extern declaration for non-static variable 'basedir'
[-Wmissing-variable-declarations]
char *basedir = NULL;
^
/home/andres/src/postgresql/src/bin/pg_basebackup/pg_basebackup.c:39:7:
warning: no previous extern declaration for non-static variable 'format'
[-Wmissing-variable-declarations]
char format = 'p'; /* p(lain)/t(ar) */
^
/home/andres/src/postgresql/src/bin/pg_basebackup/pg_basebackup.c:40:10:
warning: no previous extern declaration for non-static variable 'label'
[-Wmissing-variable-declarations]
char *label = "pg_basebackup base backup";
^
/home/andres/src/postgresql/src/bin/pg_basebackup/pg_basebackup.c:41:7:
warning: no previous extern declaration for non-static variable 'showprogress'
[-Wmissing-variable-declarations]
bool showprogress = false;
^
/home/andres/src/postgresql/src/bin/pg_basebackup/pg_basebackup.c:42:7:
warning: no previous extern declaration for non-static variable 'verbose'
[-Wmissing-variable-declarations]
int verbose = 0;
^
/home/andres/src/postgresql/src/bin/pg_basebackup/pg_basebackup.c:43:7:
warning: no previous extern declaration for non-static variable 'compresslevel'
[-Wmissing-variable-declarations]
int compresslevel = 0;
^
/home/andres/src/postgresql/src/bin/pg_basebackup/pg_basebackup.c:44:7:
warning: no previous extern declaration for non-static variable 'includewal'
[-Wmissing-variable-declarations]
bool includewal = false;
^
/home/andres/src/postgresql/src/bin/pg_basebackup/pg_basebackup.c:45:7:
warning: no previous extern declaration for non-static variable 'streamwal'
[-Wmissing-variable-declarations]
bool streamwal = false;
^
/home/andres/src/postgresql/src/bin/pg_basebackup/pg_basebackup.c:46:7:
warning: no previous extern declaration for non-static variable
'fastcheckpoint' [-Wmissing-variable-declarations]
bool fastcheckpoint = false;
^
/home/andres/src/postgresql/src/bin/pg_basebackup/pg_basebackup.c:47:7:
warning: no previous extern declaration for non-static variable
'writerecoveryconf' [-Wmissing-variable-declarations]
bool writerecoveryconf = false;
^
/home/andres/src/postgresql/src/bin/pg_basebackup/pg_basebackup.c:48:7:
warning: no previous extern declaration for non-static variable
'standby_message_timeout' [-Wmissing-variable-declarations]
int standby_message_timeout = 10 * 1000; /* 10
sec = default */
^
11 warnings generated.
keywords.c:26:19: warning: no previous extern declaration for non-static
variable 'FEScanKeywords' [-Wmissing-variable-declarations]
const ScanKeyword FEScanKeywords[] = {
^
keywords.c:30:11: warning: no previous extern declaration for non-static
variable 'NumFEScanKeywords' [-Wmissing-variable-declarations]
const int NumFEScanKeywords = lengthof(FEScanKeywords);
^
1 warning generated.
2 warnings generated.
/home/andres/src/postgresql/src/bin/pg_basebackup/pg_receivexlog.c:35:10:
warning: no previous extern declaration for non-static variable 'basedir'
[-Wmissing-variable-declarations]
char *basedir = NULL;
^
/home/andres/src/postgresql/src/bin/pg_basebackup/pg_receivexlog.c:36:7:
warning: no previous extern declaration for non-static variable 'verbose'
[-Wmissing-variable-declarations]
int verbose = 0;
^
/home/andres/src/postgresql/src/bin/pg_basebackup/pg_receivexlog.c:37:7:
warning: no previous extern declaration for non-static variable 'noloop'
[-Wmissing-variable-declarations]
int noloop = 0;
^
/home/andres/src/postgresql/src/bin/pg_basebackup/pg_receivexlog.c:38:7:
warning: no previous extern declaration for non-static variable
'standby_message_timeout' [-Wmissing-variable-declarations]
int standby_message_timeout = 10 * 1000; /* 10
sec = default */
^
/home/andres/src/postgresql/src/bin/pg_basebackup/pg_receivexlog.c:39:15:
warning: no previous extern declaration for non-static variable 'time_to_abort'
[-Wmissing-variable-declarations]
volatile bool time_to_abort = false;
^
5 warnings generated.
/home/andres/src/postgresql/src/bin/pg_dump/keywords.c:26:19: warning: no
previous extern declaration for non-static variable 'FEScanKeywords'
[-Wmissing-variable-declarations]
const ScanKeyword FEScanKeywords[] = {
^
/home/andres/src/postgresql/src/bin/pg_dump/keywords.c:30:11: warning: no
previous extern declaration for non-static variable 'NumFEScanKeywords'
[-Wmissing-variable-declarations]
const int NumFEScanKeywords = lengthof(FEScanKeywords);
^
2 warnings generated.
/home/andres/src/postgresql/src/bin/pg_dump/pg_dump.c:93:7: warning: no
previous extern declaration for non-static variable 'schemaOnly'
[-Wmissing-variable-declarations]
bool schemaOnly;
^
/home/andres/src/postgresql/src/bin/pg_dump/pg_dump.c:94:7: warning: no
previous extern declaration for non-static variable 'dataOnly'
[-Wmissing-variable-declarations]
bool dataOnly;
^
/home/andres/src/postgresql/src/bin/pg_dump/pg_dump.c:95:7: warning: no
previous extern declaration for non-static variable 'dumpSections'
[-Wmissing-variable-declarations]
int dumpSections; /* bitmask of chosen sections */
^
/home/andres/src/postgresql/src/bin/pg_dump/pg_dump.c:96:7: warning: no
previous extern declaration for non-static variable 'aclsSkip'
[-Wmissing-variable-declarations]
bool aclsSkip;
^
/home/andres/src/postgresql/src/bin/pg_dump/pg_dump.c:97:13: warning: no
previous extern declaration for non-static variable 'lockWaitTimeout'
[-Wmissing-variable-declarations]
const char *lockWaitTimeout;
^
keywords.c:26:19: warning: no previous extern declaration for non-static
variable 'FEScanKeywords' [-Wmissing-variable-declarations]
const ScanKeyword FEScanKeywords[] = {
^
keywords.c:30:11: warning: no previous extern declaration for non-static
variable 'NumFEScanKeywords' [-Wmissing-variable-declarations]
const int NumFEScanKeywords = lengthof(FEScanKeywords);
^
2 warnings generated.
5 warnings generated.
pl_gram.c:1931:5: warning: no previous extern declaration for non-static
variable 'plpgsql_yychar' [-Wmissing-variable-declarations]
int yychar;
^
pl_gram.c:67:25: note: expanded from macro 'yychar'
#define yychar plpgsql_yychar
^
pl_gram.c:1954:5: warning: no previous extern declaration for non-static
variable 'plpgsql_yynerrs' [-Wmissing-variable-declarations]
int yynerrs;
^
pl_gram.c:69:25: note: expanded from macro 'yynerrs'
#define yynerrs plpgsql_yynerrs
^
2 warnings generated.
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers