Source: fix many -Wmissing-prototypes warnings by marking functions static

This commit is contained in:
Sean McBride 2021-10-18 10:01:05 -04:00
parent 319944b3d2
commit 1cf14f8c03
27 changed files with 200 additions and 182 deletions

View File

@ -692,7 +692,7 @@ void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile* mf)
# define fnc_prefix(s, t) cmHasPrefix(s, t)
#endif
bool IsFileInDir(const std::string& infile, const std::string& indir)
static bool IsFileInDir(const std::string& infile, const std::string& indir)
{
std::string file = cmSystemTools::CollapseFullPath(infile);
std::string dir = cmSystemTools::CollapseFullPath(indir);

View File

@ -55,7 +55,7 @@ cmCursesForm* cmCursesForm::CurrentForm = nullptr;
extern "C" {
void onsig(int /*unused*/)
static void onsig(int /*unused*/)
{
if (cmCursesForm::CurrentForm) {
endwin();

View File

@ -320,9 +320,9 @@ private:
};
#endif
bool DumpFileWithLlvmNm(std::string const& nmPath, const char* filename,
std::set<std::string>& symbols,
std::set<std::string>& dataSymbols)
static bool DumpFileWithLlvmNm(std::string const& nmPath, const char* filename,
std::set<std::string>& symbols,
std::set<std::string>& dataSymbols)
{
std::string output;
// break up command line into a vector
@ -375,9 +375,9 @@ bool DumpFileWithLlvmNm(std::string const& nmPath, const char* filename,
return true;
}
bool DumpFile(std::string const& nmPath, const char* filename,
std::set<std::string>& symbols,
std::set<std::string>& dataSymbols)
static bool DumpFile(std::string const& nmPath, const char* filename,
std::set<std::string>& symbols,
std::set<std::string>& dataSymbols)
{
#ifndef _WIN32
return DumpFileWithLlvmNm(nmPath, filename, symbols, dataSymbols);

View File

@ -12,7 +12,7 @@ inline unsigned char Base32EncodeChar(int schar)
return Base32EncodeTable[schar];
}
void Base32Encode5(const unsigned char src[5], char dst[8])
static void Base32Encode5(const unsigned char src[5], char dst[8])
{
// [0]:5 bits
dst[0] = Base32EncodeChar((src[0] >> 3) & 0x1F);

View File

@ -22,17 +22,17 @@
extern "C" {
void CCONV* cmGetClientData(void* info)
static void CCONV* cmGetClientData(void* info)
{
return ((cmLoadedCommandInfo*)info)->ClientData;
}
void CCONV cmSetClientData(void* info, void* cd)
static void CCONV cmSetClientData(void* info, void* cd)
{
((cmLoadedCommandInfo*)info)->ClientData = cd;
}
void CCONV cmSetError(void* info, const char* err)
static void CCONV cmSetError(void* info, const char* err)
{
if (((cmLoadedCommandInfo*)info)->Error) {
free(((cmLoadedCommandInfo*)info)->Error);
@ -40,30 +40,31 @@ void CCONV cmSetError(void* info, const char* err)
((cmLoadedCommandInfo*)info)->Error = strdup(err);
}
unsigned int CCONV cmGetCacheMajorVersion(void* arg)
static unsigned int CCONV cmGetCacheMajorVersion(void* arg)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
cmState* state = mf->GetState();
return state->GetCacheMajorVersion();
}
unsigned int CCONV cmGetCacheMinorVersion(void* arg)
static unsigned int CCONV cmGetCacheMinorVersion(void* arg)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
cmState* state = mf->GetState();
return state->GetCacheMinorVersion();
}
unsigned int CCONV cmGetMajorVersion(void*)
static unsigned int CCONV cmGetMajorVersion(void*)
{
return cmVersion::GetMajorVersion();
}
unsigned int CCONV cmGetMinorVersion(void*)
static unsigned int CCONV cmGetMinorVersion(void*)
{
return cmVersion::GetMinorVersion();
}
void CCONV cmAddDefinition(void* arg, const char* name, const char* value)
static void CCONV cmAddDefinition(void* arg, const char* name,
const char* value)
{
if (value) {
cmMakefile* mf = static_cast<cmMakefile*>(arg);
@ -72,8 +73,9 @@ void CCONV cmAddDefinition(void* arg, const char* name, const char* value)
}
/* Add a definition to this makefile and the global cmake cache. */
void CCONV cmAddCacheDefinition(void* arg, const char* name, const char* value,
const char* doc, int type)
static void CCONV cmAddCacheDefinition(void* arg, const char* name,
const char* value, const char* doc,
int type)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
@ -99,7 +101,7 @@ void CCONV cmAddCacheDefinition(void* arg, const char* name, const char* value,
}
}
const char* CCONV cmGetProjectName(void* arg)
static const char* CCONV cmGetProjectName(void* arg)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
static std::string name;
@ -107,63 +109,63 @@ const char* CCONV cmGetProjectName(void* arg)
return name.c_str();
}
const char* CCONV cmGetHomeDirectory(void* arg)
static const char* CCONV cmGetHomeDirectory(void* arg)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
return mf->GetHomeDirectory().c_str();
}
const char* CCONV cmGetHomeOutputDirectory(void* arg)
static const char* CCONV cmGetHomeOutputDirectory(void* arg)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
return mf->GetHomeOutputDirectory().c_str();
}
const char* CCONV cmGetStartDirectory(void* arg)
static const char* CCONV cmGetStartDirectory(void* arg)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
return mf->GetCurrentSourceDirectory().c_str();
}
const char* CCONV cmGetStartOutputDirectory(void* arg)
static const char* CCONV cmGetStartOutputDirectory(void* arg)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
return mf->GetCurrentBinaryDirectory().c_str();
}
const char* CCONV cmGetCurrentDirectory(void* arg)
static const char* CCONV cmGetCurrentDirectory(void* arg)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
return mf->GetCurrentSourceDirectory().c_str();
}
const char* CCONV cmGetCurrentOutputDirectory(void* arg)
static const char* CCONV cmGetCurrentOutputDirectory(void* arg)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
return mf->GetCurrentBinaryDirectory().c_str();
}
const char* CCONV cmGetDefinition(void* arg, const char* def)
static const char* CCONV cmGetDefinition(void* arg, const char* def)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
return mf->GetDefinition(def).GetCStr();
}
int CCONV cmIsOn(void* arg, const char* name)
static int CCONV cmIsOn(void* arg, const char* name)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
return static_cast<int>(mf->IsOn(name));
}
/** Check if a command exists. */
int CCONV cmCommandExists(void* arg, const char* name)
static int CCONV cmCommandExists(void* arg, const char* name)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
return static_cast<int>(mf->GetState()->GetCommand(name) ? 1 : 0);
}
void CCONV cmAddDefineFlag(void* arg, const char* definition)
static void CCONV cmAddDefineFlag(void* arg, const char* definition)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
mf->AddDefineFlag(definition);
}
void CCONV cmAddLinkDirectoryForTarget(void* arg, const char* tgt,
const char* d)
static void CCONV cmAddLinkDirectoryForTarget(void* arg, const char* tgt,
const char* d)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
cmTarget* t = mf->FindLocalNonAliasTarget(tgt);
@ -176,8 +178,8 @@ void CCONV cmAddLinkDirectoryForTarget(void* arg, const char* tgt,
t->InsertLinkDirectory(BT<std::string>(d, mf->GetBacktrace()));
}
void CCONV cmAddExecutable(void* arg, const char* exename, int numSrcs,
const char** srcs, int win32)
static void CCONV cmAddExecutable(void* arg, const char* exename, int numSrcs,
const char** srcs, int win32)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
std::vector<std::string> srcs2;
@ -191,10 +193,11 @@ void CCONV cmAddExecutable(void* arg, const char* exename, int numSrcs,
}
}
void CCONV cmAddUtilityCommand(void* arg, const char* utilityName,
const char* command, const char* arguments,
int all, int numDepends, const char** depends,
int, const char**)
static void CCONV cmAddUtilityCommand(void* arg, const char* utilityName,
const char* command,
const char* arguments, int all,
int numDepends, const char** depends,
int, const char**)
{
// Get the makefile instance. Perform an extra variable expansion
// now because the API caller expects it.
@ -226,11 +229,11 @@ void CCONV cmAddUtilityCommand(void* arg, const char* utilityName,
mf->GetPolicyStatus(cmPolicies::CMP0116));
}
void CCONV cmAddCustomCommand(void* arg, const char* source,
const char* command, int numArgs,
const char** args, int numDepends,
const char** depends, int numOutputs,
const char** outputs, const char* target)
static void CCONV cmAddCustomCommand(void* arg, const char* source,
const char* command, int numArgs,
const char** args, int numDepends,
const char** depends, int numOutputs,
const char** outputs, const char* target)
{
// Get the makefile instance. Perform an extra variable expansion
// now because the API caller expects it.
@ -268,11 +271,12 @@ void CCONV cmAddCustomCommand(void* arg, const char* source,
mf->GetPolicyStatus(cmPolicies::CMP0116));
}
void CCONV cmAddCustomCommandToOutput(void* arg, const char* output,
const char* command, int numArgs,
const char** args,
const char* main_dependency,
int numDepends, const char** depends)
static void CCONV cmAddCustomCommandToOutput(void* arg, const char* output,
const char* command, int numArgs,
const char** args,
const char* main_dependency,
int numDepends,
const char** depends)
{
// Get the makefile instance. Perform an extra variable expansion
// now because the API caller expects it.
@ -304,9 +308,10 @@ void CCONV cmAddCustomCommandToOutput(void* arg, const char* output,
mf->GetPolicyStatus(cmPolicies::CMP0116));
}
void CCONV cmAddCustomCommandToTarget(void* arg, const char* target,
const char* command, int numArgs,
const char** args, int commandType)
static void CCONV cmAddCustomCommandToTarget(void* arg, const char* target,
const char* command, int numArgs,
const char** args,
int commandType)
{
// Get the makefile instance.
cmMakefile* mf = static_cast<cmMakefile*>(arg);
@ -376,8 +381,8 @@ static void addLinkLibrary(cmMakefile* mf, std::string const& target,
t->AddLinkLibrary(*mf, lib, llt);
}
void CCONV cmAddLinkLibraryForTarget(void* arg, const char* tgt,
const char* value, int libtype)
static void CCONV cmAddLinkLibraryForTarget(void* arg, const char* tgt,
const char* value, int libtype)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
@ -394,8 +399,8 @@ void CCONV cmAddLinkLibraryForTarget(void* arg, const char* tgt,
}
}
void CCONV cmAddLibrary(void* arg, const char* libname, int shared,
int numSrcs, const char** srcs)
static void CCONV cmAddLibrary(void* arg, const char* libname, int shared,
int numSrcs, const char** srcs)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
std::vector<std::string> srcs2;
@ -409,8 +414,8 @@ void CCONV cmAddLibrary(void* arg, const char* libname, int shared,
srcs2);
}
char CCONV* cmExpandVariablesInString(void* arg, const char* source,
int escapeQuotes, int atOnly)
static char CCONV* cmExpandVariablesInString(void* arg, const char* source,
int escapeQuotes, int atOnly)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
std::string barf = source;
@ -419,8 +424,8 @@ char CCONV* cmExpandVariablesInString(void* arg, const char* source,
return strdup(result.c_str());
}
int CCONV cmExecuteCommand(void* arg, const char* name, int numArgs,
const char** args)
static int CCONV cmExecuteCommand(void* arg, const char* name, int numArgs,
const char** args)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
@ -436,10 +441,10 @@ int CCONV cmExecuteCommand(void* arg, const char* name, int numArgs,
return mf->ExecuteCommand(lff, status);
}
void CCONV cmExpandSourceListArguments(void* arg, int numArgs,
const char** args, int* resArgc,
char*** resArgv,
unsigned int startArgumentIndex)
static void CCONV cmExpandSourceListArguments(void* arg, int numArgs,
const char** args, int* resArgc,
char*** resArgv,
unsigned int startArgumentIndex)
{
(void)arg;
(void)startArgumentIndex;
@ -460,7 +465,7 @@ void CCONV cmExpandSourceListArguments(void* arg, int numArgs,
*resArgv = resargv;
}
void CCONV cmFreeArguments(int argc, char** argv)
static void CCONV cmFreeArguments(int argc, char** argv)
{
int i;
for (i = 0; i < argc; ++i) {
@ -469,7 +474,7 @@ void CCONV cmFreeArguments(int argc, char** argv)
free(argv);
}
int CCONV cmGetTotalArgumentSize(int argc, char** argv)
static int CCONV cmGetTotalArgumentSize(int argc, char** argv)
{
int i;
int result = 0;
@ -497,19 +502,19 @@ struct cmCPluginAPISourceFile
// the CPluginAPI proxy source file.
using cmCPluginAPISourceFileMap =
std::map<cmSourceFile*, std::unique_ptr<cmCPluginAPISourceFile>>;
cmCPluginAPISourceFileMap cmCPluginAPISourceFiles;
static cmCPluginAPISourceFileMap cmCPluginAPISourceFiles;
void* CCONV cmCreateSourceFile(void)
static void* CCONV cmCreateSourceFile(void)
{
return new cmCPluginAPISourceFile;
}
void* CCONV cmCreateNewSourceFile(void*)
static void* CCONV cmCreateNewSourceFile(void*)
{
return new cmCPluginAPISourceFile;
}
void CCONV cmDestroySourceFile(void* arg)
static void CCONV cmDestroySourceFile(void* arg)
{
cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg);
// Only delete if it was created by cmCreateSourceFile or
@ -519,7 +524,7 @@ void CCONV cmDestroySourceFile(void* arg)
}
}
void CCONV* cmGetSource(void* arg, const char* name)
static void CCONV* cmGetSource(void* arg, const char* name)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
if (cmSourceFile* rsf = mf->GetSource(name)) {
@ -543,7 +548,7 @@ void CCONV* cmGetSource(void* arg, const char* name)
return nullptr;
}
void* CCONV cmAddSource(void* arg, void* arg2)
static void* CCONV cmAddSource(void* arg, void* arg2)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
cmCPluginAPISourceFile* osf = static_cast<cmCPluginAPISourceFile*>(arg2);
@ -576,19 +581,19 @@ void* CCONV cmAddSource(void* arg, void* arg2)
return value;
}
const char* CCONV cmSourceFileGetSourceName(void* arg)
static const char* CCONV cmSourceFileGetSourceName(void* arg)
{
cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg);
return sf->SourceName.c_str();
}
const char* CCONV cmSourceFileGetFullPath(void* arg)
static const char* CCONV cmSourceFileGetFullPath(void* arg)
{
cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg);
return sf->FullPath.c_str();
}
const char* CCONV cmSourceFileGetProperty(void* arg, const char* prop)
static const char* CCONV cmSourceFileGetProperty(void* arg, const char* prop)
{
cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg);
if (cmSourceFile* rsf = sf->RealSourceFile) {
@ -600,7 +605,7 @@ const char* CCONV cmSourceFileGetProperty(void* arg, const char* prop)
return sf->Properties.GetPropertyValue(prop).GetCStr();
}
int CCONV cmSourceFileGetPropertyAsBool(void* arg, const char* prop)
static int CCONV cmSourceFileGetPropertyAsBool(void* arg, const char* prop)
{
cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg);
if (cmSourceFile* rsf = sf->RealSourceFile) {
@ -609,8 +614,8 @@ int CCONV cmSourceFileGetPropertyAsBool(void* arg, const char* prop)
return cmIsOn(cmSourceFileGetProperty(arg, prop)) ? 1 : 0;
}
void CCONV cmSourceFileSetProperty(void* arg, const char* prop,
const char* value)
static void CCONV cmSourceFileSetProperty(void* arg, const char* prop,
const char* value)
{
cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg);
if (cmSourceFile* rsf = sf->RealSourceFile) {
@ -623,7 +628,7 @@ void CCONV cmSourceFileSetProperty(void* arg, const char* prop,
}
}
void CCONV cmSourceFileAddDepend(void* arg, const char* depend)
static void CCONV cmSourceFileAddDepend(void* arg, const char* depend)
{
cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg);
if (cmSourceFile* rsf = sf->RealSourceFile) {
@ -633,11 +638,11 @@ void CCONV cmSourceFileAddDepend(void* arg, const char* depend)
}
}
void CCONV cmSourceFileSetName(void* arg, const char* name, const char* dir,
int numSourceExtensions,
const char** sourceExtensions,
int numHeaderExtensions,
const char** headerExtensions)
static void CCONV cmSourceFileSetName(void* arg, const char* name,
const char* dir, int numSourceExtensions,
const char** sourceExtensions,
int numHeaderExtensions,
const char** headerExtensions)
{
cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg);
if (sf->RealSourceFile) {
@ -718,8 +723,9 @@ void CCONV cmSourceFileSetName(void* arg, const char* name, const char* dir,
cmSystemTools::Error(e.str());
}
void CCONV cmSourceFileSetName2(void* arg, const char* name, const char* dir,
const char* ext, int headerFileOnly)
static void CCONV cmSourceFileSetName2(void* arg, const char* name,
const char* dir, const char* ext,
int headerFileOnly)
{
cmCPluginAPISourceFile* sf = static_cast<cmCPluginAPISourceFile*>(arg);
if (sf->RealSourceFile) {
@ -743,48 +749,48 @@ void CCONV cmSourceFileSetName2(void* arg, const char* name, const char* dir,
sf->SourceExtension = ext;
}
char* CCONV cmGetFilenameWithoutExtension(const char* name)
static char* CCONV cmGetFilenameWithoutExtension(const char* name)
{
std::string sres = cmSystemTools::GetFilenameWithoutExtension(name);
return strdup(sres.c_str());
}
char* CCONV cmGetFilenamePath(const char* name)
static char* CCONV cmGetFilenamePath(const char* name)
{
std::string sres = cmSystemTools::GetFilenamePath(name);
return strdup(sres.c_str());
}
char* CCONV cmCapitalized(const char* name)
static char* CCONV cmCapitalized(const char* name)
{
std::string sres = cmSystemTools::Capitalized(name);
return strdup(sres.c_str());
}
void CCONV cmCopyFileIfDifferent(const char* name1, const char* name2)
static void CCONV cmCopyFileIfDifferent(const char* name1, const char* name2)
{
cmSystemTools::CopyFileIfDifferent(name1, name2);
}
void CCONV cmRemoveFile(const char* name)
static void CCONV cmRemoveFile(const char* name)
{
cmSystemTools::RemoveFile(name);
}
void CCONV cmDisplayStatus(void* arg, const char* message)
static void CCONV cmDisplayStatus(void* arg, const char* message)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
mf->DisplayStatus(message, -1);
}
void CCONV cmFree(void* data)
static void CCONV cmFree(void* data)
{
free(data);
}
void CCONV DefineSourceFileProperty(void* arg, const char* name,
const char* briefDocs,
const char* longDocs, int chained)
static void CCONV DefineSourceFileProperty(void* arg, const char* name,
const char* briefDocs,
const char* longDocs, int chained)
{
cmMakefile* mf = static_cast<cmMakefile*>(arg);
mf->GetState()->DefineProperty(name, cmProperty::SOURCE_FILE,
@ -794,7 +800,7 @@ void CCONV DefineSourceFileProperty(void* arg, const char* name,
} // close the extern "C" scope
cmCAPI cmStaticCAPI = {
static cmCAPI cmStaticCAPI = {
cmGetClientData,
cmGetTotalArgumentSize,
cmFreeArguments,

View File

@ -342,7 +342,7 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const
return this->CommandLines[c][0];
}
std::string escapeForShellOldStyle(const std::string& str)
static std::string escapeForShellOldStyle(const std::string& str)
{
std::string result;
#if defined(_WIN32) && !defined(__CYGWIN__)

View File

@ -29,14 +29,14 @@ struct cmELFByteSwapSize
void cmELFByteSwap(char* /*unused*/, cmELFByteSwapSize<1> /*unused*/)
{
}
void cmELFByteSwap(char* data, cmELFByteSwapSize<2> /*unused*/)
static void cmELFByteSwap(char* data, cmELFByteSwapSize<2> /*unused*/)
{
char one_byte;
one_byte = data[0];
data[0] = data[1];
data[1] = one_byte;
}
void cmELFByteSwap(char* data, cmELFByteSwapSize<4> /*unused*/)
static void cmELFByteSwap(char* data, cmELFByteSwapSize<4> /*unused*/)
{
char one_byte;
one_byte = data[0];
@ -46,7 +46,7 @@ void cmELFByteSwap(char* data, cmELFByteSwapSize<4> /*unused*/)
data[1] = data[2];
data[2] = one_byte;
}
void cmELFByteSwap(char* data, cmELFByteSwapSize<8> /*unused*/)
static void cmELFByteSwap(char* data, cmELFByteSwapSize<8> /*unused*/)
{
char one_byte;
one_byte = data[0];

View File

@ -494,8 +494,9 @@ void cmExportFileGenerator::PopulateInterfaceProperty(
properties, missingTargets);
}
void getPropertyContents(cmGeneratorTarget const* tgt, const std::string& prop,
std::set<std::string>& ifaceProperties)
static void getPropertyContents(cmGeneratorTarget const* tgt,
const std::string& prop,
std::set<std::string>& ifaceProperties)
{
cmValue p = tgt->GetProperty(prop);
if (!p) {
@ -505,9 +506,9 @@ void getPropertyContents(cmGeneratorTarget const* tgt, const std::string& prop,
ifaceProperties.insert(content.begin(), content.end());
}
void getCompatibleInterfaceProperties(cmGeneratorTarget const* target,
std::set<std::string>& ifaceProperties,
const std::string& config)
static void getCompatibleInterfaceProperties(
cmGeneratorTarget const* target, std::set<std::string>& ifaceProperties,
const std::string& config)
{
if (target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
// object libraries have no link information, so nothing to compute

View File

@ -353,7 +353,7 @@ void cmFindCommon::AddPathSuffix(std::string const& arg)
this->SearchPathSuffixes.push_back(std::move(suffix));
}
void AddTrailingSlash(std::string& s)
static void AddTrailingSlash(std::string& s)
{
if (!s.empty() && s.back() != '/') {
s += '/';

View File

@ -1261,7 +1261,7 @@ static const struct DeviceLinkNode : public cmGeneratorExpressionNode
}
} deviceLinkNode;
std::string getLinkedTargetsContent(
static std::string getLinkedTargetsContent(
cmGeneratorTarget const* target, std::string const& prop,
cmGeneratorExpressionContext* context,
cmGeneratorExpressionDAGChecker* dagChecker)
@ -1830,8 +1830,8 @@ static const char* targetPolicyWhitelist[] = {
#undef TARGET_POLICY_STRING
};
cmPolicies::PolicyStatus statusForTarget(cmGeneratorTarget const* tgt,
const char* policy)
static cmPolicies::PolicyStatus statusForTarget(cmGeneratorTarget const* tgt,
const char* policy)
{
#define RETURN_POLICY(POLICY) \
if (strcmp(policy, #POLICY) == 0) { \
@ -1846,7 +1846,7 @@ cmPolicies::PolicyStatus statusForTarget(cmGeneratorTarget const* tgt,
return cmPolicies::WARN;
}
cmPolicies::PolicyID policyForString(const char* policy_id)
static cmPolicies::PolicyID policyForString(const char* policy_id)
{
#define RETURN_POLICY_ID(POLICY_ID) \
if (strcmp(policy_id, #POLICY_ID) == 0) { \

View File

@ -173,9 +173,14 @@ private:
BT<std::string> PropertyValue;
};
std::unique_ptr<cmGeneratorTarget::TargetPropertyEntry>
CreateTargetPropertyEntry(const BT<std::string>& propertyValue,
bool evaluateForBuildsystem = false)
std::unique_ptr<
cmGeneratorTarget::
TargetPropertyEntry> static CreateTargetPropertyEntry(const BT<std::
string>&
propertyValue,
bool
evaluateForBuildsystem =
false)
{
if (cmGeneratorExpression::Find(propertyValue.Value) != std::string::npos) {
cmGeneratorExpression ge(propertyValue.Backtrace);
@ -190,7 +195,7 @@ CreateTargetPropertyEntry(const BT<std::string>& propertyValue,
cm::make_unique<TargetPropertyEntryString>(propertyValue));
}
void CreatePropertyGeneratorExpressions(
static void CreatePropertyGeneratorExpressions(
cmBTStringRange entries,
std::vector<std::unique_ptr<cmGeneratorTarget::TargetPropertyEntry>>& items,
bool evaluateForBuildsystem = false)
@ -2926,11 +2931,11 @@ void cmGeneratorTarget::GetAutoUicOptions(std::vector<std::string>& result,
result);
}
void processILibs(const std::string& config,
cmGeneratorTarget const* headTarget, cmLinkItem const& item,
cmGlobalGenerator* gg,
std::vector<cmGeneratorTarget const*>& tgts,
std::set<cmGeneratorTarget const*>& emitted)
static void processILibs(const std::string& config,
cmGeneratorTarget const* headTarget,
cmLinkItem const& item, cmGlobalGenerator* gg,
std::vector<cmGeneratorTarget const*>& tgts,
std::set<cmGeneratorTarget const*>& emitted)
{
if (item.Target && emitted.insert(item.Target).second) {
tgts.push_back(item.Target);
@ -5695,7 +5700,7 @@ std::string valueAsString<std::nullptr_t>(std::nullptr_t /*unused*/)
return "(unset)";
}
std::string compatibilityType(CompatibleType t)
static std::string compatibilityType(CompatibleType t)
{
switch (t) {
case BoolType:
@ -5711,7 +5716,7 @@ std::string compatibilityType(CompatibleType t)
return "";
}
std::string compatibilityAgree(CompatibleType t, bool dominant)
static std::string compatibilityAgree(CompatibleType t, bool dominant)
{
switch (t) {
case BoolType:
@ -5801,23 +5806,23 @@ std::pair<bool, bool> consistentProperty(bool lhs, bool rhs,
return { lhs == rhs, lhs };
}
std::pair<bool, const char*> consistentStringProperty(const char* lhs,
const char* rhs)
static std::pair<bool, const char*> consistentStringProperty(const char* lhs,
const char* rhs)
{
const bool b = strcmp(lhs, rhs) == 0;
return { b, b ? lhs : nullptr };
}
std::pair<bool, std::string> consistentStringProperty(const std::string& lhs,
const std::string& rhs)
static std::pair<bool, std::string> consistentStringProperty(
const std::string& lhs, const std::string& rhs)
{
const bool b = lhs == rhs;
return { b, b ? lhs : valueAsString(nullptr) };
}
std::pair<bool, const char*> consistentNumberProperty(const char* lhs,
const char* rhs,
CompatibleType t)
static std::pair<bool, const char*> consistentNumberProperty(const char* lhs,
const char* rhs,
CompatibleType t)
{
char* pEnd;
@ -5868,9 +5873,9 @@ std::pair<bool, const char*> consistentProperty(const char* lhs,
return { false, nullptr };
}
std::pair<bool, std::string> consistentProperty(const std::string& lhs,
const std::string& rhs,
CompatibleType t)
static std::pair<bool, std::string> consistentProperty(const std::string& lhs,
const std::string& rhs,
CompatibleType t)
{
const std::string null_ptr = valueAsString(nullptr);

View File

@ -833,8 +833,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateFlatClone(cmXCodeObject* orig)
return obj;
}
std::string GetGroupMapKeyFromPath(cmGeneratorTarget* target,
const std::string& fullpath)
static std::string GetGroupMapKeyFromPath(cmGeneratorTarget* target,
const std::string& fullpath)
{
std::string key(target->GetName());
key += "-";

View File

@ -102,7 +102,7 @@ static int getMessageColor(MessageType t)
}
}
void printMessageText(std::ostream& msg, std::string const& text)
static void printMessageText(std::ostream& msg, std::string const& text)
{
msg << ":\n";
cmDocumentationFormatter formatter;
@ -110,7 +110,7 @@ void printMessageText(std::ostream& msg, std::string const& text)
formatter.PrintFormatted(msg, text.c_str());
}
void displayMessage(MessageType t, std::ostringstream& msg)
static void displayMessage(MessageType t, std::ostringstream& msg)
{
// Add a note about warning suppression.
if (t == MessageType::AUTHOR_WARNING) {

View File

@ -103,7 +103,7 @@ static bool isPolicyNewerThan(cmPolicies::PolicyID id, unsigned int majorV,
return false;
}
const char* idToShortDescription(cmPolicies::PolicyID id)
static const char* idToShortDescription(cmPolicies::PolicyID id)
{
switch (id) {
#define POLICY_CASE(ID, SHORT_DESCRIPTION) \

View File

@ -22,10 +22,10 @@
/// @brief Merges newOpts into baseOpts
/// @arg valueOpts list of options that accept a value
void MergeOptions(std::vector<std::string>& baseOpts,
std::vector<std::string> const& newOpts,
std::initializer_list<cm::string_view> valueOpts,
bool isQt5OrLater)
static void MergeOptions(std::vector<std::string>& baseOpts,
std::vector<std::string> const& newOpts,
std::initializer_list<cm::string_view> valueOpts,
bool isQt5OrLater)
{
if (newOpts.empty()) {
return;

View File

@ -2496,8 +2496,8 @@ bool cmSystemTools::GuessLibraryInstallName(std::string const& fullPath,
return false;
}
std::string::size_type cmSystemToolsFindRPath(cm::string_view const& have,
cm::string_view const& want)
static std::string::size_type cmSystemToolsFindRPath(
cm::string_view const& have, cm::string_view const& want)
{
std::string::size_type pos = 0;
while (pos < have.size()) {
@ -2694,11 +2694,11 @@ std::function<bool(std::string*, const cmELF&)> MakeEmptyCallback(
}
}
cm::optional<bool> ChangeRPathELF(std::string const& file,
std::string const& oldRPath,
std::string const& newRPath,
bool removeEnvironmentRPath,
std::string* emsg, bool* changed)
static cm::optional<bool> ChangeRPathELF(std::string const& file,
std::string const& oldRPath,
std::string const& newRPath,
bool removeEnvironmentRPath,
std::string* emsg, bool* changed)
{
auto adjustCallback = [oldRPath, newRPath, removeEnvironmentRPath](
cm::optional<std::string>& outRPath,

View File

@ -2135,8 +2135,8 @@ struct NumberFormatter
{
}
};
std::ostream& operator<<(std::ostream& stream,
NumberFormatter const& formatter)
static std::ostream& operator<<(std::ostream& stream,
NumberFormatter const& formatter)
{
auto const& flags = stream.flags();
if (formatter.Format == FORMAT_DECIMAL) {

View File

@ -77,7 +77,7 @@ int _doLongPathTest()
return res;
}
int _nonExistentDirectoryTest()
static int _nonExistentDirectoryTest()
{
using namespace kwsys;
int res = 0;
@ -105,7 +105,7 @@ int _nonExistentDirectoryTest()
return res;
}
int _copyDirectoryTest()
static int _copyDirectoryTest()
{
using namespace kwsys;
const std::string source(TEST_SYSTEMTOOLS_BINARY_DIR

View File

@ -63,7 +63,7 @@ static char* lowercase(const char* string)
return new_string;
}
int isTestSkipped(const char *name, int n_skipped_tests, char *skipped_tests[]) {
static int isTestSkipped(const char *name, int n_skipped_tests, char *skipped_tests[]) {
int i;
for (i = 0; i < n_skipped_tests; i++) {
if (strcmp(name, skipped_tests[i]) == 0) {

View File

@ -224,7 +224,7 @@ static const std::vector<AllocationComparison> comparisons{
/* clang-format on */
};
bool TestExpectedPackResult(const ExpectedPackResult& expected)
static bool TestExpectedPackResult(const ExpectedPackResult& expected)
{
std::vector<cmCTestBinPackerAllocation> roundRobinAllocations;
roundRobinAllocations.reserve(expected.SlotsNeeded.size());

View File

@ -12,7 +12,7 @@ static const cmCTestResourceSpec spec{ { {
/* clang-format on */
} } };
bool testInitializeFromResourceSpec()
static bool testInitializeFromResourceSpec()
{
bool retval = true;
@ -39,7 +39,7 @@ bool testInitializeFromResourceSpec()
return retval;
}
bool testAllocateResource()
static bool testAllocateResource()
{
bool retval = true;
@ -216,7 +216,7 @@ bool testAllocateResource()
return retval;
}
bool testDeallocateResource()
static bool testDeallocateResource()
{
bool retval = true;
@ -370,7 +370,7 @@ bool testDeallocateResource()
return retval;
}
bool testResourceFree()
static bool testResourceFree()
{
bool retval = true;

View File

@ -104,7 +104,7 @@ static const std::vector<ExpectedParseResult> expectedResults{
/* clang-format on */
};
bool TestExpectedParseResult(const ExpectedParseResult& expected)
static bool TestExpectedParseResult(const ExpectedParseResult& expected)
{
std::vector<std::vector<cmCTestTestHandler::cmCTestTestResourceRequirement>>
result;

View File

@ -116,7 +116,7 @@ public:
# define END_IGNORE_UNINITIALIZED
#endif
void swap(EventLogger& e1, EventLogger& e2)
static void swap(EventLogger& e1, EventLogger& e2)
{
BEGIN_IGNORE_UNINITIALIZED
events.push_back({ Event::SWAP, &e1, &e2, e2.Value });
@ -180,37 +180,37 @@ EventLogger& EventLogger::operator=(int value)
return *this;
}
bool operator==(const EventLogger& lhs, const EventLogger& rhs)
static bool operator==(const EventLogger& lhs, const EventLogger& rhs)
{
events.push_back({ Event::COMPARE_EE_EQ, &lhs, &rhs, lhs.Value });
return lhs.Value == rhs.Value;
}
bool operator!=(const EventLogger& lhs, const EventLogger& rhs)
static bool operator!=(const EventLogger& lhs, const EventLogger& rhs)
{
events.push_back({ Event::COMPARE_EE_NE, &lhs, &rhs, lhs.Value });
return lhs.Value != rhs.Value;
}
bool operator<(const EventLogger& lhs, const EventLogger& rhs)
static bool operator<(const EventLogger& lhs, const EventLogger& rhs)
{
events.push_back({ Event::COMPARE_EE_LT, &lhs, &rhs, lhs.Value });
return lhs.Value < rhs.Value;
}
bool operator<=(const EventLogger& lhs, const EventLogger& rhs)
static bool operator<=(const EventLogger& lhs, const EventLogger& rhs)
{
events.push_back({ Event::COMPARE_EE_LE, &lhs, &rhs, lhs.Value });
return lhs.Value <= rhs.Value;
}
bool operator>(const EventLogger& lhs, const EventLogger& rhs)
static bool operator>(const EventLogger& lhs, const EventLogger& rhs)
{
events.push_back({ Event::COMPARE_EE_GT, &lhs, &rhs, lhs.Value });
return lhs.Value > rhs.Value;
}
bool operator>=(const EventLogger& lhs, const EventLogger& rhs)
static bool operator>=(const EventLogger& lhs, const EventLogger& rhs)
{
events.push_back({ Event::COMPARE_EE_GE, &lhs, &rhs, lhs.Value });
return lhs.Value >= rhs.Value;

View File

@ -8,7 +8,8 @@
#include "cmRST.h"
#include "cmSystemTools.h"
void reportLine(std::ostream& os, bool ret, std::string const& line, bool eol)
static void reportLine(std::ostream& os, bool ret, std::string const& line,
bool eol)
{
if (ret) {
os << "\"" << line << "\" (" << (eol ? "with EOL" : "without EOL") << ")";

View File

@ -64,14 +64,15 @@ bool operator==(const cmUVProcessChain::Status* actual,
return true;
}
bool resultsMatch(const std::vector<const cmUVProcessChain::Status*>& actual,
const std::vector<ExpectedStatus>& expected)
static bool resultsMatch(
const std::vector<const cmUVProcessChain::Status*>& actual,
const std::vector<ExpectedStatus>& expected)
{
return actual.size() == expected.size() &&
std::equal(actual.begin(), actual.end(), expected.begin());
}
std::string getInput(std::istream& input)
static std::string getInput(std::istream& input)
{
char buffer[1024];
std::ostringstream str;
@ -103,8 +104,9 @@ std::ostream& operator<<(
return func(stream);
}
void printResults(const std::vector<const cmUVProcessChain::Status*>& actual,
const std::vector<ExpectedStatus>& expected)
static void printResults(
const std::vector<const cmUVProcessChain::Status*>& actual,
const std::vector<ExpectedStatus>& expected)
{
std::cout << "Expected: " << std::endl;
for (auto const& e : expected) {
@ -129,8 +131,8 @@ void printResults(const std::vector<const cmUVProcessChain::Status*>& actual,
}
}
bool checkExecution(cmUVProcessChainBuilder& builder,
std::unique_ptr<cmUVProcessChain>& chain)
static bool checkExecution(cmUVProcessChainBuilder& builder,
std::unique_ptr<cmUVProcessChain>& chain)
{
std::vector<const cmUVProcessChain::Status*> status;
@ -171,7 +173,7 @@ bool checkExecution(cmUVProcessChainBuilder& builder,
return true;
}
bool checkOutput(std::istream& outputStream, std::istream& errorStream)
static bool checkOutput(std::istream& outputStream, std::istream& errorStream)
{
std::string output = getInput(outputStream);
if (output != "HELO WRD!") {

View File

@ -7,7 +7,7 @@
#include <string>
#include <thread>
std::string getStdin()
static std::string getStdin()
{
char buffer[1024];
std::ostringstream str;

View File

@ -15,9 +15,10 @@
#define TEST_STR_LINE_3 "with libuv's uv_stream_t."
#define TEST_STR TEST_STR_LINE_1 "\n" TEST_STR_LINE_2 "\n" TEST_STR_LINE_3
bool writeDataToStreamPipe(uv_loop_t& loop, cm::uv_pipe_ptr& inputPipe,
char* outputData, unsigned int outputDataLength,
const char* /* unused */)
static bool writeDataToStreamPipe(uv_loop_t& loop, cm::uv_pipe_ptr& inputPipe,
char* outputData,
unsigned int outputDataLength,
const char* /* unused */)
{
int err;
@ -66,9 +67,11 @@ bool writeDataToStreamPipe(uv_loop_t& loop, cm::uv_pipe_ptr& inputPipe,
return true;
}
bool writeDataToStreamProcess(uv_loop_t& loop, cm::uv_pipe_ptr& inputPipe,
char* outputData, unsigned int /* unused */,
const char* cmakeCommand)
static bool writeDataToStreamProcess(uv_loop_t& loop,
cm::uv_pipe_ptr& inputPipe,
char* outputData,
unsigned int /* unused */,
const char* cmakeCommand)
{
int err;
@ -130,7 +133,7 @@ bool writeDataToStreamProcess(uv_loop_t& loop, cm::uv_pipe_ptr& inputPipe,
return true;
}
bool testUVStreambufRead(
static bool testUVStreambufRead(
bool (*cb)(uv_loop_t& loop, cm::uv_pipe_ptr& inputPipe, char* outputData,
unsigned int outputDataLength, const char* cmakeCommand),
const char* cmakeCommand)