Commit 5b0d1bd9 authored by Sean McBride's avatar Sean McBride Committed by Brad King

Fix clang -Weverything warnings

Mostly add 'static' to private functions/globals.

Change-Id: Ic7fa75bcc0f245e7b4f8d554db4f58ac0c585e2a
parent bff2ea07
......@@ -272,6 +272,7 @@ namespace KWSYS_NAMESPACE
// Create one public symbol in this object file to avoid warnings from
// archivers.
void IOStreamSymbolToAvoidWarning();
void IOStreamSymbolToAvoidWarning()
{
}
......
......@@ -2466,7 +2466,9 @@ bool SystemInformationImplementation::RetrieveCPUPowerManagement()
#endif
}
void SystemInformationStripLeadingSpace(kwsys_stl::string& str)
#if USE_CPUID
// Used only in USE_CPUID implementation below.
static void SystemInformationStripLeadingSpace(kwsys_stl::string& str)
{
// Because some manufacturers have leading white space - we have to post-process the name.
kwsys_stl::string::size_type pos = str.find_first_not_of(" ");
......@@ -2475,6 +2477,7 @@ void SystemInformationStripLeadingSpace(kwsys_stl::string& str)
str = str.substr(pos);
}
}
#endif
/** */
bool SystemInformationImplementation::RetrieveExtendedCPUIdentity()
......
......@@ -3037,7 +3037,7 @@ void SystemTools::CheckTranslationPath(kwsys_stl::string & path)
path.erase(path.end()-1, path.end());
}
void
static void
SystemToolsAppendComponents(
kwsys_stl::vector<kwsys_stl::string>& out_components,
kwsys_stl::vector<kwsys_stl::string>::const_iterator first,
......@@ -4704,7 +4704,7 @@ bool SystemTools::ParseURL( const kwsys_stl::string& URL,
// ----------------------------------------------------------------------
// These must NOT be initialized. Default initialization to zero is
// necessary.
unsigned int SystemToolsManagerCount;
static unsigned int SystemToolsManagerCount;
SystemToolsTranslationMap *SystemTools::TranslationMap;
SystemToolsTranslationMap *SystemTools::LongPathMap;
#ifdef __CYGWIN__
......
......@@ -24,9 +24,9 @@
#include <stddef.h> /* size_t */
#include <string.h> /* strcmp */
void* random_ptr = reinterpret_cast<void*>(0x123);
static void* random_ptr = reinterpret_cast<void*>(0x123);
int argument(const char* arg, const char* value, void* call_data)
static int argument(const char* arg, const char* value, void* call_data)
{
kwsys_ios::cout << "Got argument: \"" << arg << "\" value: \"" << (value?value:"(null)") << "\"" << kwsys_ios::endl;
if ( call_data != random_ptr )
......@@ -37,7 +37,7 @@ int argument(const char* arg, const char* value, void* call_data)
return 1;
}
int unknown_argument(const char* argument, void* call_data)
static int unknown_argument(const char* argument, void* call_data)
{
kwsys_ios::cout << "Got unknown argument: \"" << argument << "\"" << kwsys_ios::endl;
if ( call_data != random_ptr )
......@@ -48,12 +48,12 @@ int unknown_argument(const char* argument, void* call_data)
return 1;
}
bool CompareTwoItemsOnList(bool i1, bool i2) { return i1 == i2; }
bool CompareTwoItemsOnList(int i1, int i2) { return i1 == i2; }
bool CompareTwoItemsOnList(double i1, double i2) { return i1 == i2; }
bool CompareTwoItemsOnList(const char* i1,
static bool CompareTwoItemsOnList(bool i1, bool i2) { return i1 == i2; }
static bool CompareTwoItemsOnList(int i1, int i2) { return i1 == i2; }
static bool CompareTwoItemsOnList(double i1, double i2) { return i1 == i2; }
static bool CompareTwoItemsOnList(const char* i1,
const char* i2) { return strcmp(i1, i2) == 0; }
bool CompareTwoItemsOnList(const kwsys_stl::string& i1,
static bool CompareTwoItemsOnList(const kwsys_stl::string& i1,
const kwsys_stl::string& i2) { return i1 == i2; }
int testCommandLineArguments(int argc, char* argv[])
......
......@@ -35,7 +35,7 @@
// left on disk.
#include <testSystemTools.h>
kwsys_stl::string GetLibName(const char* lname)
static kwsys_stl::string GetLibName(const char* lname)
{
// Construct proper name of lib
kwsys_stl::string slname;
......
......@@ -47,7 +47,7 @@ int runChild(const char* cmd[], int state, int exception, int value,
int share, int output, int delay, double timeout, int poll,
int repeat, int disown);
int test1(int argc, const char* argv[])
static int test1(int argc, const char* argv[])
{
(void)argc; (void)argv;
fprintf(stdout, "Output on stdout from test returning 0.\n");
......@@ -55,7 +55,7 @@ int test1(int argc, const char* argv[])
return 0;
}
int test2(int argc, const char* argv[])
static int test2(int argc, const char* argv[])
{
(void)argc; (void)argv;
fprintf(stdout, "Output on stdout from test returning 123.\n");
......@@ -63,7 +63,7 @@ int test2(int argc, const char* argv[])
return 123;
}
int test3(int argc, const char* argv[])
static int test3(int argc, const char* argv[])
{
(void)argc; (void)argv;
fprintf(stdout, "Output before sleep on stdout from timeout test.\n");
......@@ -80,7 +80,7 @@ int test3(int argc, const char* argv[])
return 0;
}
int test4(int argc, const char* argv[])
static int test4(int argc, const char* argv[])
{
/* Prepare a pointer to an invalid address. Don't use null, because
dereferencing null is undefined behaviour and compilers are free to
......@@ -109,7 +109,7 @@ int test4(int argc, const char* argv[])
return 0;
}
int test5(int argc, const char* argv[])
static int test5(int argc, const char* argv[])
{
int r;
const char* cmd[4];
......@@ -132,7 +132,7 @@ int test5(int argc, const char* argv[])
}
#define TEST6_SIZE (4096*2)
void test6(int argc, const char* argv[])
static void test6(int argc, const char* argv[])
{
int i;
char runaway[TEST6_SIZE+1];
......@@ -156,7 +156,7 @@ void test6(int argc, const char* argv[])
delaying 1/10th of a second should ever have to poll. */
#define MINPOLL 5
#define MAXPOLL 20
int test7(int argc, const char* argv[])
static int test7(int argc, const char* argv[])
{
(void)argc; (void)argv;
fprintf(stdout, "Output on stdout before sleep.\n");
......@@ -176,7 +176,7 @@ int test7(int argc, const char* argv[])
return 0;
}
int test8(int argc, const char* argv[])
static int test8(int argc, const char* argv[])
{
/* Create a disowned grandchild to test handling of processes
that exit before their children. */
......@@ -200,7 +200,7 @@ int test8(int argc, const char* argv[])
return r;
}
int test8_grandchild(int argc, const char* argv[])
static int test8_grandchild(int argc, const char* argv[])
{
(void)argc; (void)argv;
fprintf(stdout, "Output on stdout from grandchild before sleep.\n");
......@@ -221,7 +221,7 @@ int test8_grandchild(int argc, const char* argv[])
return 0;
}
int runChild2(kwsysProcess* kp,
static int runChild2(kwsysProcess* kp,
const char* cmd[], int state, int exception, int value,
int share, int output, int delay, double timeout,
int poll, int disown)
......@@ -505,7 +505,7 @@ int main(int argc, const char* argv[])
fprintf(stderr, "Output on stderr after test %d.\n", n);
fflush(stdout);
fflush(stderr);
#if _WIN32
#if defined(_WIN32)
if(argv0) { free(argv0); }
#endif
return r;
......
......@@ -32,7 +32,7 @@
#include <string.h> /* strcmp */
//----------------------------------------------------------------------------
const char* toUnixPaths[][2] =
static const char* toUnixPaths[][2] =
{
{ "/usr/local/bin/passwd", "/usr/local/bin/passwd" },
{ "/usr/lo cal/bin/pa sswd", "/usr/lo cal/bin/pa sswd" },
......@@ -52,8 +52,8 @@ const char* toUnixPaths[][2] =
{0, 0}
};
bool CheckConvertToUnixSlashes(kwsys_stl::string input,
kwsys_stl::string output)
static bool CheckConvertToUnixSlashes(kwsys_stl::string input,
kwsys_stl::string output)
{
kwsys_stl::string result = input;
kwsys::SystemTools::ConvertToUnixSlashes(result);
......@@ -69,17 +69,17 @@ bool CheckConvertToUnixSlashes(kwsys_stl::string input,
}
//----------------------------------------------------------------------------
const char* checkEscapeChars[][4] =
static const char* checkEscapeChars[][4] =
{
{ "1 foo 2 bar 2", "12", "\\", "\\1 foo \\2 bar \\2"},
{ " {} ", "{}", "#", " #{#} "},
{0, 0, 0, 0}
};
bool CheckEscapeChars(kwsys_stl::string input,
const char *chars_to_escape,
char escape_char,
kwsys_stl::string output)
static bool CheckEscapeChars(kwsys_stl::string input,
const char *chars_to_escape,
char escape_char,
kwsys_stl::string output)
{
kwsys_stl::string result = kwsys::SystemTools::EscapeChars(
input.c_str(), chars_to_escape, escape_char);
......@@ -95,7 +95,7 @@ bool CheckEscapeChars(kwsys_stl::string input,
}
//----------------------------------------------------------------------------
bool CheckFileOperations()
static bool CheckFileOperations()
{
bool res = true;
......@@ -129,7 +129,7 @@ bool CheckFileOperations()
}
//----------------------------------------------------------------------------
bool CheckStringOperations()
static bool CheckStringOperations()
{
bool res = true;
......@@ -329,7 +329,7 @@ bool CheckStringOperations()
//----------------------------------------------------------------------------
bool CheckPutEnv(const char* env, const char* name, const char* value)
static bool CheckPutEnv(const char* env, const char* name, const char* value)
{
if(!kwsys::SystemTools::PutEnv(env))
{
......@@ -348,7 +348,7 @@ bool CheckPutEnv(const char* env, const char* name, const char* value)
return true;
}
bool CheckUnPutEnv(const char* env, const char* name)
static bool CheckUnPutEnv(const char* env, const char* name)
{
if(!kwsys::SystemTools::UnPutEnv(env))
{
......@@ -365,7 +365,7 @@ bool CheckUnPutEnv(const char* env, const char* name)
return true;
}
bool CheckEnvironmentOperations()
static bool CheckEnvironmentOperations()
{
bool res = true;
res &= CheckPutEnv("A=B", "A", "B");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment