From bd8bdb6fddcf45bdd558158e9129a5dbeef47a07 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 7 Nov 2012 13:45:30 +0100 Subject: Resolve warnings about unused variables. --- Source/cmGlobalVisualStudio6Generator.cxx | 1 - Source/cmLocalVisualStudioGenerator.cxx | 1 - Source/cmNinjaNormalTargetGenerator.cxx | 1 + Source/cmVisualStudio10TargetGenerator.cxx | 1 - 4 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index e8ca788..0ec4850 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -200,7 +200,6 @@ void cmGlobalVisualStudio6Generator tt != orderedProjectTargets.end(); ++tt) { cmTarget* target = *tt; - cmMakefile* mf = target->GetMakefile(); // Write the project into the DSW file const char* expath = target->GetProperty("EXTERNAL_MSPROJECT"); if(expath) diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 4bcf4de..ef2bb1d 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -84,7 +84,6 @@ cmLocalVisualStudioGenerator const char* newline_text) { bool useLocal = this->CustomCommandUseLocal(); - const cmCustomCommandLines& commandLines = cc.GetCommandLines(); const char* workingDirectory = cc.GetWorkingDirectory(); cmCustomCommandGenerator ccg(cc, configName, this->Makefile); RelativeRoot relativeRoot = workingDirectory? NONE : START_OUTPUT; diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 6c54ced..853bc12 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -564,6 +564,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() // for instance ARG_MAX is 2096152 on Ubuntu or 262144 on Mac commandLineLengthLimit = ((int)sysconf(_SC_ARG_MAX))-linkRuleLength-1000; #else + (void)linkRuleLength; commandLineLengthLimit = -1; #endif } diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index def4133..d55d573 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -907,7 +907,6 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( cmSourceFile* source) { cmSourceFile& sf = *source; - cmLocalVisualStudio7Generator* lg = this->LocalGenerator; std::string objectName; if(this->GeneratorTarget->ExplicitObjectName.find(&sf) -- cgit v0.12 From 9f16d428a1146e4f108dd67e743c2c00911c4383 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 7 Nov 2012 13:45:52 +0100 Subject: Resolve warnings about used enum values in switch blocks. --- Source/cmLocalVisualStudio6Generator.cxx | 2 ++ Source/cmLocalVisualStudio7Generator.cxx | 2 ++ Source/cmVisualStudio10TargetGenerator.cxx | 3 +++ 3 files changed, 7 insertions(+) diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index f15322b..5ac4403 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -710,6 +710,8 @@ void cmLocalVisualStudio6Generator::SetBuildType(BuildType b, switch(b) { + case WIN32_EXECUTABLE: + break; case STATIC_LIBRARY: this->DSPHeaderTemplate = root; this->DSPHeaderTemplate += "/staticLibHeader.dsptemplate"; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index f9a2d32..cc5db24 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1003,6 +1003,8 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, } switch(target.GetType()) { + case cmTarget::UNKNOWN_LIBRARY: + break; case cmTarget::OBJECT_LIBRARY: { std::string libpath = this->GetTargetDirectory(target); diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index d55d573..ddef365 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -404,6 +404,9 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() case cmTarget::UTILITY: configType += "Utility"; break; + case cmTarget::GLOBAL_TARGET: + case cmTarget::UNKNOWN_LIBRARY: + break; } configType += "\n"; this->WriteString(configType.c_str(), 2); -- cgit v0.12 From 5f6432f2537203084a40f0d204a5643091f6a915 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 7 Nov 2012 13:46:44 +0100 Subject: Resolve warnings about shadowing parameters and local variables. --- Source/cmGlobalVisualStudio8Generator.cxx | 1 - Source/cmGlobalVisualStudioGenerator.cxx | 1 - Source/cmLocalVisualStudio6Generator.cxx | 12 ++++++------ Source/cmLocalVisualStudio7Generator.cxx | 6 +++--- Source/cmcldeps.cxx | 4 ++++ Source/cmw9xcom.cxx | 10 +++++----- 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index bca1754..a6ed2a6 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -204,7 +204,6 @@ void cmGlobalVisualStudio8Generator::AddCheckTarget() // overwritten by the CreateVCProjBuildRule. // (this could be avoided with per-target source files) const char* no_main_dependency = 0; - const char* no_working_directory = 0; if(cmSourceFile* file = mf->AddCustomCommandToOutput( stamps, listFiles, diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 0968b77..ea6757d 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -75,7 +75,6 @@ void cmGlobalVisualStudioGenerator::Generate() #endif // Now make all targets depend on the ALL_BUILD target - cmTargets targets; for(std::vector::iterator i = gen.begin(); i != gen.end(); ++i) { diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 5ac4403..9497e31 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -326,18 +326,18 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout, { cmSystemTools::ReplaceString(source, "$(IntDir)/", ""); #if defined(_WIN32) || defined(__CYGWIN__) - std::ofstream fout(source.c_str(), + std::ofstream sourceFout(source.c_str(), std::ios::binary | std::ios::out | std::ios::trunc); #else - std::ofstream fout(source.c_str(), + std::ofstream sourceFout(source.c_str(), std::ios::out | std::ios::trunc); #endif - if(fout) + if(sourceFout) { - fout.write("# generated from CMake",22); - fout.flush(); - fout.close(); + sourceFout.write("# generated from CMake",22); + sourceFout.flush(); + sourceFout.close(); } } } diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index cc5db24..d954a52 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -914,12 +914,12 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, // for FAT32 file systems, which can cause an empty manifest // to be embedded into the resulting executable. See CMake // bug #2617. - const char* tool = "VCManifestTool"; + const char* manifestTool = "VCManifestTool"; if(this->FortranProject) { - tool = "VFManifestTool"; + manifestTool = "VFManifestTool"; } - fout << "\t\t\t\n"; } diff --git a/Source/cmcldeps.cxx b/Source/cmcldeps.cxx index 34350bf..04dab59 100644 --- a/Source/cmcldeps.cxx +++ b/Source/cmcldeps.cxx @@ -237,12 +237,14 @@ int main() { // needed to suppress filename output of msvc tools std::string srcfilename; + { std::string::size_type pos = srcfile.rfind("\\"); if (pos == std::string::npos) { srcfilename = srcfile; } else { srcfilename = srcfile.substr(pos + 1); } + } std::string nol = " /nologo "; std::string show = " /showIncludes "; @@ -266,10 +268,12 @@ int main() { // call cl in object dir so the .i is generated there std::string objdir; + { std::string::size_type pos = objfile.rfind("\\"); if (pos != std::string::npos) { objdir = objfile.substr(0, pos); } + } // extract dependencies with cl.exe int exit_code = process(srcfilename, dfile, objfile, diff --git a/Source/cmw9xcom.cxx b/Source/cmw9xcom.cxx index e6014b3..ab238d5 100644 --- a/Source/cmw9xcom.cxx +++ b/Source/cmw9xcom.cxx @@ -31,14 +31,14 @@ int main (int argc, char *argv[]) int cc; for ( cc = 2; cc < argc; cc ++ ) { - std::string arg = argv[cc]; - if ( (arg.find_first_of(" ") != arg.npos) && - (arg.find_first_of("\"") == arg.npos) ) + std::string nextArg = argv[cc]; + if ( (nextArg.find_first_of(" ") != nextArg.npos) && + (nextArg.find_first_of("\"") == nextArg.npos) ) { - arg = "\"" + arg + "\""; + nextArg = "\"" + nextArg + "\""; } command += " "; - command += arg; + command += nextArg; } return cmWin32ProcessExecution::Windows9xHack(command.c_str()); -- cgit v0.12 From 21e8a08bcf91c4a7908502d3d9e3f9fa18aa0724 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 8 Nov 2012 18:29:03 +0100 Subject: Resolve ambiguity warning regarding use of && and ||. This is not ambiguous to the compiler, but it may seem ambiguous to the reader. From reading 3a53005f (Build object library targets in VS), 5484550a (Detect and set Unicode character set in VS 10), and 9e01aefd (VS: Add support for WinRT project properties (#12930)), this appears to be the intentional semantic. --- Source/cmVisualStudio10TargetGenerator.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index ddef365..d3b3950 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -428,8 +428,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() mfcLine += useOfMfcValue + "\n"; this->WriteString(mfcLine.c_str(), 2); - if(this->Target->GetType() <= cmTarget::OBJECT_LIBRARY && - this->ClOptions[*i]->UsingUnicode() || + if((this->Target->GetType() <= cmTarget::OBJECT_LIBRARY && + this->ClOptions[*i]->UsingUnicode()) || this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) { this->WriteString("Unicode\n", 2); -- cgit v0.12 From 737534cdce7957dd882d9acd0cf03d39fab1ece0 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 9 Nov 2012 00:23:17 +0100 Subject: Remove references to ancient and removed parts of the code. This file came from ITK, and probably came from python before that. This commit fixes a warning about the unused _PyPopenProcs variable. --- Source/cmWin32ProcessExecution.cxx | 56 -------------------------------------- 1 file changed, 56 deletions(-) diff --git a/Source/cmWin32ProcessExecution.cxx b/Source/cmWin32ProcessExecution.cxx index 9a536c1..5752ab6 100644 --- a/Source/cmWin32ProcessExecution.cxx +++ b/Source/cmWin32ProcessExecution.cxx @@ -271,13 +271,6 @@ bool cmWin32ProcessExecution::Wait(int timeout) return this->PrivateClose(timeout); } -/* - * Internal dictionary mapping popen* file pointers to process handles, - * for use when retrieving the process exit code. See _PyPclose() below - * for more information on this dictionary's use. - */ -static void *_PyPopenProcs = NULL; - static BOOL RealPopenCreateProcess(const char *cmdstring, const char *path, const char *szConsoleSpawn, @@ -679,18 +672,6 @@ bool cmWin32ProcessExecution::PrivateOpen(const char *cmdstring, } } - /* - * Insert the files we've created into the process dictionary - * all referencing the list with the process handle and the - * initial number of files (see description below in _PyPclose). - * Since if _PyPclose later tried to wait on a process when all - * handles weren't closed, it could create a deadlock with the - * child, we spend some energy here to try to ensure that we - * either insert all file handles into the dictionary or none - * at all. It's a little clumsy with the various popen modes - * and variable number of files involved. - */ - /* Child is launched. Close the parents copy of those pipe * handles that only the child should have open. You need to * make sure that no handles to the write end of the output pipe @@ -761,43 +742,6 @@ cmWin32ProcessExecution::~cmWin32ProcessExecution() this->CloseHandles(); } -/* - * Wrapper for fclose() to use for popen* files, so we can retrieve the - * exit code for the child process and return as a result of the close. - * - * This function uses the _PyPopenProcs dictionary in order to map the - * input file pointer to information about the process that was - * originally created by the popen* call that created the file pointer. - * The dictionary uses the file pointer as a key (with one entry - * inserted for each file returned by the original popen* call) and a - * single list object as the value for all files from a single call. - * The list object contains the Win32 process handle at [0], and a file - * count at [1], which is initialized to the total number of file - * handles using that list. - * - * This function closes whichever handle it is passed, and decrements - * the file count in the dictionary for the process handle pointed to - * by this file. On the last close (when the file count reaches zero), - * this function will wait for the child process and then return its - * exit code as the result of the close() operation. This permits the - * files to be closed in any order - it is always the close() of the - * final handle that will return the exit code. - */ - - /* RED_FLAG 31-Aug-2000 Tim - * This is always called (today!) between a pair of - * Py_BEGIN_ALLOW_THREADS/ Py_END_ALLOW_THREADS - * macros. So the thread running this has no valid thread state, as - * far as Python is concerned. However, this calls some Python API - * functions that cannot be called safely without a valid thread - * state, in particular PyDict_GetItem. - * As a temporary hack (although it may last for years ...), we - * *rely* on not having a valid thread state in this function, in - * order to create our own "from scratch". - * This will deadlock if _PyPclose is ever called by a thread - * holding the global lock. - */ - bool cmWin32ProcessExecution::PrivateClose(int /* timeout */) { HANDLE hProcess = this->ProcessHandle; -- cgit v0.12