1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-04 09:43:08 +02:00

Enable missing-variable-declarations compiler warning.

Warn if a global variable is defined without a previous declaration. Use this option to detect global variables that do not have a matching extern declaration in a header file.
This commit is contained in:
David Steele 2024-11-18 10:58:00 -05:00
parent 4ae160aa34
commit 33d7681347
7 changed files with 21 additions and 12 deletions

View File

@ -70,6 +70,9 @@ warning_enable = [
# Warn if a global function is defined without a previous prototype declaration
'-Wmissing-prototypes',
# Warn if a global variable is defined without a previous declaration
'-Wmissing-variable-declarations',
# Warn about anything that depends on the “size of” a function type or of void
'-Wpointer-arith',

View File

@ -48,7 +48,7 @@ STRING_EXTERN(GCS_QUERY_NAME_STR, GCS_QUERY_NA
STRING_STATIC(GCS_QUERY_PAGE_TOKEN_STR, "pageToken");
STRING_STATIC(GCS_QUERY_PREFIX_STR, "prefix");
STRING_EXTERN(GCS_QUERY_UPLOAD_ID_STR, GCS_QUERY_UPLOAD_ID);
STRING_EXTERN(GCS_QUERY_VERSIONS_STR, "versions");
STRING_STATIC(GCS_QUERY_VERSIONS_STR, "versions");
/***********************************************************************************************************************************
JSON tokens

View File

@ -23,14 +23,14 @@ libssh2 shim error prefix
/***********************************************************************************************************************************
Script that defines how shim functions operate
***********************************************************************************************************************************/
HrnLibSsh2 hrnLibSsh2Script[1024];
bool hrnLibSsh2ScriptDone = true;
unsigned int hrnLibSsh2ScriptIdx;
static HrnLibSsh2 hrnLibSsh2Script[1024];
static bool hrnLibSsh2ScriptDone = true;
static unsigned int hrnLibSsh2ScriptIdx;
// If there is a script failure change the behavior of cleanup functions to return immediately so the real error will be reported
// rather than a bogus scripting error during cleanup
bool hrnLibSsh2ScriptFail;
char hrnLibSsh2ScriptError[4096];
static bool hrnLibSsh2ScriptFail;
static char hrnLibSsh2ScriptError[4096];
/***********************************************************************************************************************************
Set libssh2 script

View File

@ -26,9 +26,9 @@ Include shimmed C modules
/***********************************************************************************************************************************
Log settings for testing
***********************************************************************************************************************************/
LogLevel logLevelTest = logLevelInfo;
LogLevel logLevelTestDefault = logLevelOff;
bool logDryRunTest = false;
static LogLevel logLevelTest = logLevelInfo;
static LogLevel logLevelTestDefault = logLevelOff;
static bool logDryRunTest = false;
/***********************************************************************************************************************************
Name of file where logs are stored for testing
@ -38,7 +38,7 @@ static char logFile[1024];
/***********************************************************************************************************************************
Buffer where log results are loaded for comparison purposes
***********************************************************************************************************************************/
char harnessLogBuffer[256 * 1024];
static char harnessLogBuffer[256 * 1024];
/***********************************************************************************************************************************
Open a log file -- centralized here for error handling

View File

@ -47,7 +47,7 @@ Constants
/***********************************************************************************************************************************
Local data
***********************************************************************************************************************************/
struct HrnServerLocal
static struct HrnServerLocal
{
unsigned int portOffsetNext; // Next server port offset to be returned
} hrnServerLocal;

View File

@ -275,7 +275,7 @@ hrnFileWrite(const char *fileName, const unsigned char *buffer, size_t bufferSiz
}
/**********************************************************************************************************************************/
char harnessDiffBuffer[256 * 1024];
static char harnessDiffBuffer[256 * 1024];
const char *
hrnDiff(const char *expected, const char *actual)

View File

@ -49,6 +49,7 @@ The test code is included directly so it can freely interact with the included C
#define TEST_PROJECT_EXE "{[C_TEST_PROJECT_EXE]}"
#ifdef HRN_FEATURE_STRING
STRING_DECLARE(TEST_PROJECT_EXE_STR);
STRING_EXTERN(TEST_PROJECT_EXE_STR, TEST_PROJECT_EXE);
#endif
@ -56,6 +57,7 @@ STRING_EXTERN(TEST_PROJECT_EXE_STR, TEST_PROJECT_EXE);
#define TEST_PATH "{[C_TEST_PATH]}"
#ifdef HRN_FEATURE_STRING
STRING_DECLARE(TEST_PATH_STR);
STRING_EXTERN(TEST_PATH_STR, TEST_PATH);
#endif
@ -63,6 +65,7 @@ STRING_EXTERN(TEST_PATH_STR, TEST_PATH);
#define HRN_PATH_REPO "{[C_HRN_PATH_REPO]}"
#ifdef HRN_FEATURE_STRING
STRING_DECLARE(HRN_PATH_REPO_STR);
STRING_EXTERN(HRN_PATH_REPO_STR, HRN_PATH_REPO);
#endif
@ -70,6 +73,7 @@ STRING_EXTERN(HRN_PATH_REPO_STR, HRN_PATH_REPO);
#define HRN_PATH "{[C_HRN_PATH]}"
#ifdef HRN_FEATURE_STRING
STRING_DECLARE(HRN_PATH_STR);
STRING_EXTERN(HRN_PATH_STR, HRN_PATH);
#endif
@ -86,6 +90,7 @@ STRING_EXTERN(HRN_PATH_STR, HRN_PATH);
#define TEST_PG_VERSION "{[C_TEST_PG_VERSION]}"
#ifdef HRN_FEATURE_STRING
STRING_DECLARE(TEST_USER_STR);
STRING_EXTERN(TEST_USER_STR, TEST_USER);
#endif
@ -95,6 +100,7 @@ STRING_EXTERN(TEST_USER_STR, TEST_USER);
#define TEST_GROUP_ID_Z "{[C_TEST_GROUP_ID]}"
#ifdef HRN_FEATURE_STRING
STRING_DECLARE(TEST_GROUP_STR);
STRING_EXTERN(TEST_GROUP_STR, TEST_GROUP);
#endif