From 64b5520346c75ec479042a114390a0bf71909723 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 6 May 2016 14:19:04 -0400 Subject: [PATCH] Isolate formatted streaming blocks with clang-format off/on The clang-format tool can do a good job formatting most code, but well-organized streaming blocks are best left manually formatted. Find blocks of the form os << "...\n" "...\n" ; using the command $ git ls-files -z -- Source | egrep -v -z '^Source/kwsys/' | xargs -0 pcregrep -M --color=always -B 1 -A 1 -n \ '<<[^\n]*\n(^ *("[^\n]*("|<<|;)$|;)\n){2,}' Find blocks of the form os << "...\n" << "...\n" << "...\n"; using the command $ git ls-files -z -- Source | egrep -v -z '^Source/kwsys/' | xargs -0 pcregrep -M --color=always -B 1 -A 1 -n \ '<<[^\n]*\n(^ *<<[^\n]*(\\n"|<<|;)$\n){2,}' Surround such blocks with the pair /* clang-format off */ ... /* clang-format on */ in order to protect them from update by clang-format. Use the C-style `/*...*/` comments instead of C++-style `//...` comments in order to prevent them from ever being swallowed by re-formatting of surrounding comments. --- Source/CPack/cmCPackNSISGenerator.cxx | 2 ++ Source/CTest/cmCTestBuildCommand.cxx | 2 ++ Source/CTest/cmCTestCVS.cxx | 2 ++ Source/CTest/cmCTestGlobalVC.cxx | 2 ++ Source/CTest/cmCTestMultiProcessHandler.cxx | 2 ++ Source/CTest/cmCTestSubmitHandler.cxx | 2 ++ Source/cmAddCustomTargetCommand.cxx | 2 ++ Source/cmAddExecutableCommand.cxx | 2 ++ Source/cmCacheManager.cxx | 4 +++ Source/cmComputeLinkInformation.cxx | 8 +++++ Source/cmConfigureFileCommand.cxx | 2 ++ Source/cmCoreTryCompile.cxx | 6 ++++ Source/cmDocumentation.cxx | 4 +++ Source/cmExportCommand.cxx | 2 ++ Source/cmExportFileGenerator.cxx | 22 +++++++++++++ Source/cmExportInstallFileGenerator.cxx | 8 +++++ Source/cmExtraCodeBlocksGenerator.cxx | 2 ++ Source/cmExtraKateGenerator.cxx | 4 +++ Source/cmFileCommand.cxx | 6 ++++ Source/cmFindPackageCommand.cxx | 2 ++ Source/cmGeneratorExpressionDAGChecker.cxx | 2 ++ Source/cmGeneratorExpressionNode.cxx | 2 ++ Source/cmGeneratorTarget.cxx | 10 ++++++ Source/cmGlobalGenerator.cxx | 14 +++++++++ Source/cmGlobalJOMMakefileGenerator.cxx | 2 ++ Source/cmGlobalNMakeMakefileGenerator.cxx | 2 ++ Source/cmGlobalNinjaGenerator.cxx | 8 +++++ Source/cmGlobalVisualStudio10Generator.cxx | 4 +++ Source/cmGlobalVisualStudio71Generator.cxx | 2 ++ Source/cmGlobalVisualStudio7Generator.cxx | 6 ++++ Source/cmGlobalXCodeGenerator.cxx | 4 +++ Source/cmInstallExportGenerator.cxx | 2 ++ Source/cmInstallTargetGenerator.cxx | 2 ++ Source/cmLinkDirectoriesCommand.cxx | 2 ++ Source/cmListFileCache.cxx | 4 +++ Source/cmLocalGenerator.cxx | 18 +++++++++++ Source/cmLocalUnixMakefileGenerator3.cxx | 18 +++++++++++ Source/cmLocalVisualStudio7Generator.cxx | 34 +++++++++++++++++++++ Source/cmMakefile.cxx | 26 ++++++++++++++++ Source/cmMakefileTargetGenerator.cxx | 8 +++++ Source/cmSystemTools.cxx | 2 ++ Source/cmTryRunCommand.cxx | 2 ++ Source/cmVisualStudio10TargetGenerator.cxx | 10 ++++++ Source/cmake.cxx | 2 ++ Source/cmakemain.cxx | 4 +++ Source/cmcmd.cxx | 6 ++++ 46 files changed, 282 insertions(+) diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index eeb46fdff..a5a9a1943 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -881,6 +881,7 @@ CreateComponentDescription(cmCPackComponent *component, totalSizeInKbytes = 1; } std::ostringstream out; + /* clang-format off */ out << " AddSize " << totalSizeInKbytes << "\n" << " Push \"" << component->ArchiveFile << "\"\n" << " Call DownloadFile\n" @@ -890,6 +891,7 @@ CreateComponentDescription(cmCPackComponent *component, " StrCmp $2 \"success\" +2 0\n" " MessageBox MB_OK \"Failed to unzip $2\"\n" " Delete $INSTDIR\\$0\n"; + /* clang-format on */ componentCode += out.str(); } else diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index 0cfcc64b2..957e3e4ad 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -151,6 +151,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() else { std::ostringstream ostr; + /* clang-format off */ ostr << "has no project to build. If this is a " "\"built with CMake\" project, verify that CTEST_CMAKE_GENERATOR " "and CTEST_PROJECT_NAME are set." @@ -162,6 +163,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() "\n" "Alternatively, set CTEST_BUILD_COMMAND to build the project " "with a custom command line."; + /* clang-format on */ this->SetError(ostr.str()); return 0; } diff --git a/Source/CTest/cmCTestCVS.cxx b/Source/CTest/cmCTestCVS.cxx index 58d86891e..01bc1c44d 100644 --- a/Source/CTest/cmCTestCVS.cxx +++ b/Source/CTest/cmCTestCVS.cxx @@ -203,9 +203,11 @@ private: if(!this->Rev.Rev.empty()) { // Record this revision. + /* clang-format off */ this->CVS->Log << "Found revision " << this->Rev.Rev << "\n" << " author = " << this->Rev.Author << "\n" << " date = " << this->Rev.Date << "\n"; + /* clang-format on */ this->Revisions.push_back(this->Rev); // We only need two revisions. diff --git a/Source/CTest/cmCTestGlobalVC.cxx b/Source/CTest/cmCTestGlobalVC.cxx index c091ec47e..b66793aab 100644 --- a/Source/CTest/cmCTestGlobalVC.cxx +++ b/Source/CTest/cmCTestGlobalVC.cxx @@ -54,9 +54,11 @@ void cmCTestGlobalVC::DoRevision(Revision const& revision, // Report this revision. Revision const& rev = this->Revisions.back(); + /* clang-format off */ this->Log << "Found revision " << rev.Rev << "\n" << " author = " << rev.Author << "\n" << " date = " << rev.Date << "\n"; + /* clang-format on */ // Update information about revisions of the changed files. for(std::vector::const_iterator ci = changes.begin(); diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 143451842..07c78069e 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -382,11 +382,13 @@ void cmCTestMultiProcessHandler::StartNextTests() } else { + /* clang-format off */ cmCTestLog(this->CTest, HANDLER_OUTPUT, "System Load: " << systemLoad << ", " "Max Allowed Load: " << this->TestLoad << ", " "Smallest test " << testWithMinProcessors << " requires " << minProcessorsRequired); + /* clang-format on */ } cmCTestLog(this->CTest, HANDLER_OUTPUT, "*****" << std::endl); diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 6a65839f8..862157764 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -933,12 +933,14 @@ bool cmCTestSubmitHandler::SubmitUsingCP( if ( localprefix.empty() || files.empty() || remoteprefix.empty() || destination.empty() ) { + /* clang-format off */ cmCTestLog(this->CTest, ERROR_MESSAGE, "Missing arguments for submit via cp:\n" << "\tlocalprefix: " << localprefix << "\n" << "\tNumber of files: " << files.size() << "\n" << "\tremoteprefix: " << remoteprefix << "\n" << "\tdestination: " << destination << std::endl); + /* clang-format on */ return 0; } diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index 42bd71c4e..5bf752a19 100644 --- a/Source/cmAddCustomTargetCommand.cxx +++ b/Source/cmAddCustomTargetCommand.cxx @@ -206,10 +206,12 @@ bool cmAddCustomTargetCommand } if (issueMessage) { + /* clang-format off */ e << "The target name \"" << targetName << "\" is reserved or not valid for certain " "CMake features, such as generator expressions, and may result " "in undefined behavior."; + /* clang-format on */ this->Makefile->IssueMessage(messageType, e.str()); if (messageType == cmake::FATAL_ERROR) diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx index a84bb9dee..dccf9d96e 100644 --- a/Source/cmAddExecutableCommand.cxx +++ b/Source/cmAddExecutableCommand.cxx @@ -96,10 +96,12 @@ bool cmAddExecutableCommand } if (issueMessage) { + /* clang-format off */ e << "The target name \"" << exename << "\" is reserved or not valid for certain " "CMake features, such as generator expressions, and may result " "in undefined behavior."; + /* clang-format on */ this->Makefile->IssueMessage(messageType, e.str()); if (messageType == cmake::FATAL_ERROR) diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index afa2ba75b..4dcd613a9 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -318,11 +318,14 @@ bool cmCacheManager::SaveCache(const std::string& path) "This is the directory where this CMakeCache.txt" " was created", cmState::INTERNAL); + /* clang-format off */ fout << "# This is the CMakeCache file.\n" << "# For build in directory: " << currentcwd << "\n" << "# It was generated by CMake: " << cmSystemTools::GetCMakeCommand() << std::endl; + /* clang-format on */ + /* clang-format off */ fout << "# You can edit this file to change values found and used by cmake." << std::endl << "# If you do not want to change any of the values, simply exit the " @@ -335,6 +338,7 @@ bool cmCacheManager::SaveCache(const std::string& path) << "# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT " "TYPE!." << std::endl << "# VALUE is the current value for the KEY.\n\n"; + /* clang-format on */ fout << "########################\n"; fout << "# EXTERNAL cache entries\n"; diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index f88d58ce5..fa11f334b 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -562,6 +562,7 @@ bool cmComputeLinkInformation::Compute() if (!this->CMP0060WarnItems.empty()) { std::ostringstream w; + /* clang-format off */ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0060) << "\n" "Some library files are in directories implicitly searched by " "the linker when invoked for " << this->LinkLanguage << ":\n" @@ -570,6 +571,7 @@ bool cmComputeLinkInformation::Compute() "link line will ask the linker to search for these by library " "name." ; + /* clang-format on */ this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(), this->Target->GetBacktrace()); } @@ -1543,10 +1545,12 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item, { this->CMakeInstance->GetState()->SetGlobalProperty(wid, "1"); std::ostringstream w; + /* clang-format off */ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0008) << "\n" << "Target \"" << this->Target->GetName() << "\" links to item\n" << " " << item << "\n" << "which is a full-path but not a valid library file name."; + /* clang-format on */ this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(), this->Target->GetBacktrace()); } @@ -1561,10 +1565,12 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item, case cmPolicies::REQUIRED_ALWAYS: { std::ostringstream e; + /* clang-format off */ e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0008) << "\n" << "Target \"" << this->Target->GetName() << "\" links to item\n" << " " << item << "\n" << "which is a full-path but not a valid library file name."; + /* clang-format on */ this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(), this->Target->GetBacktrace()); } @@ -1629,6 +1635,7 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories() void cmComputeLinkInformation::PrintLinkPolicyDiagnosis(std::ostream& os) { // Tell the user what to do. + /* clang-format off */ os << "Policy CMP0003 should be set before this line. " << "Add code such as\n" << " if(COMMAND cmake_policy)\n" @@ -1636,6 +1643,7 @@ void cmComputeLinkInformation::PrintLinkPolicyDiagnosis(std::ostream& os) << " endif(COMMAND cmake_policy)\n" << "as early as possible but after the most recent call to " << "cmake_minimum_required or cmake_policy(VERSION). "; + /* clang-format on */ // List the items that might need the old-style paths. os << "This warning appears because target \"" diff --git a/Source/cmConfigureFileCommand.cxx b/Source/cmConfigureFileCommand.cxx index 46b71c59b..94c778b76 100644 --- a/Source/cmConfigureFileCommand.cxx +++ b/Source/cmConfigureFileCommand.cxx @@ -35,9 +35,11 @@ bool cmConfigureFileCommand if(cmSystemTools::FileIsDirectory(this->InputFile)) { std::ostringstream e; + /* clang-format off */ e << "input location\n" << " " << this->InputFile << "\n" << "is a directory but a file was expected."; + /* clang-format on */ this->SetError(e.str()); return false; } diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 231c260c2..18dca9161 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -307,9 +307,11 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, if (!fout) { std::ostringstream e; + /* clang-format off */ e << "Failed to open\n" << " " << outFileName << "\n" << cmSystemTools::GetLastSystemError(); + /* clang-format on */ this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return -1; } @@ -369,11 +371,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, "CMAKE_POLICY_WARNING_CMP0056")) { std::ostringstream w; + /* clang-format off */ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0056) << "\n" "For compatibility with older versions of CMake, try_compile " "is not honoring caller link flags (e.g. CMAKE_EXE_LINKER_FLAGS) " "in the test project." ; + /* clang-format on */ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); } case cmPolicies::OLD: @@ -608,10 +612,12 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, copyFile)) { std::ostringstream emsg; + /* clang-format off */ emsg << "Cannot copy output executable\n" << " '" << this->OutputFile << "'\n" << "to destination specified by COPY_FILE:\n" << " '" << copyFile << "'\n"; + /* clang-format on */ if(!this->FindErrorMessage.empty()) { emsg << this->FindErrorMessage.c_str(); diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 81e67962e..4e8bcb575 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -94,12 +94,14 @@ cmDocumentation::~cmDocumentation() //---------------------------------------------------------------------------- bool cmDocumentation::PrintVersion(std::ostream& os) { + /* clang-format off */ os << this->GetNameString() << " version " << cmVersion::GetCMakeVersion() << "\n" "\n" "CMake suite maintained and supported by Kitware (kitware.com/cmake).\n" ; + /* clang-format on */ return true; } @@ -935,6 +937,7 @@ bool cmDocumentation::PrintOldCustomModules(std::ostream& os) } else if((ext.length()==2) && (ext[1] >='1') && (ext[1]<='9')) { + /* clang-format off */ os << ".TH " << name << " " << ext[1] << " \"" << cmSystemTools::GetCurrentDateTime("%B %d, %Y") << @@ -947,6 +950,7 @@ bool cmDocumentation::PrintOldCustomModules(std::ostream& os) ".PP\n" << detail ; + /* clang-format on */ } else { diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index bbd07db78..f66744eea 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -406,9 +406,11 @@ void cmExportCommand::StorePackageRegistryDir(std::string const& package, else { std::ostringstream e; + /* clang-format off */ e << "Cannot create package registry file:\n" << " " << fname << "\n" << cmSystemTools::GetLastSystemError() << "\n"; + /* clang-format on */ this->Makefile->IssueMessage(cmake::WARNING, e.str()); } } diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 2b3ce148c..9cee308b0 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -106,17 +106,21 @@ bool cmExportFileGenerator::GenerateImportFile() std::ostream& os = *foutPtr; // Protect that file against use with older CMake versions. + /* clang-format off */ os << "# Generated by CMake " << cmVersion::GetCMakeVersion() << "\n\n"; os << "if(\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" LESS 2.5)\n" << " message(FATAL_ERROR \"CMake >= 2.6.0 required\")\n" << "endif()\n"; + /* clang-format on */ // Isolate the file policy level. // We use 2.6 here instead of the current version because newer // versions of CMake should be able to export files imported by 2.6 // until the import format changes. + /* clang-format off */ os << "cmake_policy(PUSH)\n" << "cmake_policy(VERSION 2.6)\n"; + /* clang-format on */ // Start with the import file header. this->GenerateImportHeaderCode(os); @@ -197,10 +201,12 @@ void cmExportFileGenerator::PopulateInterfaceProperty( void cmExportFileGenerator::GenerateRequiredCMakeVersion(std::ostream& os, const char *versionString) { + /* clang-format off */ os << "if(CMAKE_VERSION VERSION_LESS " << versionString << ")\n" " message(FATAL_ERROR \"This file relies on consumers using " "CMake " << versionString << " or greater.\")\n" "endif()\n\n"; + /* clang-format on */ } //---------------------------------------------------------------------------- @@ -296,9 +302,11 @@ static bool checkInterfaceDirs(const std::string &prepro, } if (!cmSystemTools::FileIsFullPath(li->c_str())) { + /* clang-format off */ e << "Target \"" << target->GetName() << "\" " << prop << " property contains relative path:\n" " \"" << *li << "\""; + /* clang-format on */ target->GetLocalGenerator()->IssueMessage(messageType, e.str()); } bool inBinary = isSubDirectory(li->c_str(), topBinaryDir); @@ -350,9 +358,11 @@ static bool checkInterfaceDirs(const std::string &prepro, } if (inBinary) { + /* clang-format off */ e << "Target \"" << target->GetName() << "\" " << prop << " property contains path:\n" " \"" << *li << "\"\nwhich is prefixed in the build directory."; + /* clang-format on */ target->GetLocalGenerator()->IssueMessage(messageType, e.str()); } if (!inSourceBuild) @@ -1016,15 +1026,18 @@ void cmExportFileGenerator::GenerateImportVersionCode(std::ostream& os) { // Store an import file format version. This will let us change the // format later while still allowing old import files to work. + /* clang-format off */ os << "# Commands may need to know the format version.\n" << "set(CMAKE_IMPORT_FILE_VERSION 1)\n" << "\n"; + /* clang-format on */ } //---------------------------------------------------------------------------- void cmExportFileGenerator::GenerateExpectedTargetsCode(std::ostream& os, const std::string &expectedTargets) { + /* clang-format off */ os << "# Protect against multiple inclusion, which would fail when already " "imported targets are added once more.\n" "set(_targetsDefined)\n" @@ -1053,6 +1066,7 @@ void cmExportFileGenerator::GenerateExpectedTargetsCode(std::ostream& os, "unset(_targetsNotDefined)\n" "unset(_expectedTargets)\n" "\n\n"; + /* clang-format on */ } //---------------------------------------------------------------------------- void @@ -1163,15 +1177,19 @@ void cmExportFileGenerator::GenerateMissingTargetsCheckCode(std::ostream& os, { if (missingTargets.empty()) { + /* clang-format off */ os << "# This file does not depend on other imported targets which have\n" "# been exported from the same project but in a separate " "export set.\n\n"; + /* clang-format on */ return; } + /* clang-format off */ os << "# Make sure the targets which have been exported in some other \n" "# export set exist.\n" "unset(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets)\n" "foreach(_target "; + /* clang-format on */ std::set emitted; for(unsigned int i=0; i /usr/lib.\n" @@ -110,6 +113,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) "endif()\n" "unset(_realOrig)\n" "unset(_realCurr)\n"; + /* clang-format on */ } std::string dest = expDest; while(!dest.empty()) @@ -214,6 +218,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) } // Now load per-configuration properties for them. + /* clang-format off */ os << "# Load information for each installed configuration.\n" << "get_filename_component(_DIR \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n" << "file(GLOB CONFIG_FILES \"${_DIR}/" @@ -222,11 +227,14 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) << " include(${f})\n" << "endforeach()\n" << "\n"; + /* clang-format on */ // Cleanup the import prefix variable. + /* clang-format off */ os << "# Cleanup temporary variables.\n" << "set(_IMPORT_PREFIX)\n" << "\n"; + /* clang-format on */ this->GenerateImportedFileCheckLoop(os); bool result = true; diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index f6be583cc..dc50b3e60 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -569,10 +569,12 @@ std::string cmExtraCodeBlocksGenerator::CreateDummyTargetFile( cmGeneratedFileStream fout(filename.c_str()); if(fout) { + /* clang-format off */ fout << "# This is a dummy file for the OBJECT library " << target->GetName() << " for the CMake CodeBlocks project generator.\n" << "# Don't edit, this file will be overwritten.\n"; + /* clang-format on */ } return filename; } diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx index 4b779d813..d112fc981 100644 --- a/Source/cmExtraKateGenerator.cxx +++ b/Source/cmExtraKateGenerator.cxx @@ -69,11 +69,13 @@ void cmExtraKateGenerator::CreateKateProjectFile( return; } + /* clang-format off */ fout << "{\n" "\t\"name\": \"" << this->ProjectName << "\",\n" "\t\"directory\": \"" << lg->GetSourceDirectory() << "\",\n" "\t\"files\": [ { " << this->GenerateFilesString(lg) << "} ],\n"; + /* clang-format on */ this->WriteTargets(lg, fout); fout << "}\n"; } @@ -89,11 +91,13 @@ cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg, "CMAKE_KATE_MAKE_ARGUMENTS"); const char* homeOutputDir = lg->GetBinaryDirectory(); + /* clang-format off */ fout << "\t\"build\": {\n" "\t\t\"directory\": \"" << lg->GetBinaryDirectory() << "\",\n" "\t\t\"default_target\": \"all\",\n" "\t\t\"clean_target\": \"clean\",\n"; + /* clang-format on */ // build, clean and quick are for the build plugin kate <= 4.12: fout << "\t\t\"build\": \"" << make << " -C \\\"" << homeOutputDir diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 575051e61..41b0939fc 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2436,11 +2436,13 @@ cmFileCommand::HandleRPathChangeCommand(std::vector const& args) if(!cmSystemTools::ChangeRPath(file, oldRPath, newRPath, &emsg, &changed)) { std::ostringstream e; + /* clang-format off */ e << "RPATH_CHANGE could not write new RPATH:\n" << " " << newRPath << "\n" << "to the file:\n" << " " << file << "\n" << emsg; + /* clang-format on */ this->SetError(e.str()); success = false; } @@ -2511,9 +2513,11 @@ cmFileCommand::HandleRPathRemoveCommand(std::vector const& args) if(!cmSystemTools::RemoveRPath(file, &emsg, &removed)) { std::ostringstream e; + /* clang-format off */ e << "RPATH_REMOVE could not remove RPATH from file:\n" << " " << file << "\n" << emsg; + /* clang-format on */ this->SetError(e.str()); success = false; } @@ -2668,11 +2672,13 @@ bool cmFileCommand::HandleRename(std::vector const& args) { std::string err = cmSystemTools::GetLastSystemError(); std::ostringstream e; + /* clang-format off */ e << "RENAME failed to rename\n" << " " << oldname << "\n" << "to\n" << " " << newname << "\n" << "because: " << err << "\n"; + /* clang-format on */ this->SetError(e.str()); return false; } diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 97f156366..9e58f7314 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -748,10 +748,12 @@ bool cmFindPackageCommand::HandlePackageMode() std::ostringstream aw; if (configFileSetFOUNDFalse) { + /* clang-format off */ e << "Found package configuration file:\n" " " << this->FileFound << "\n" "but it set " << foundVar << " to FALSE so package \"" << this->Name << "\" is considered to be NOT FOUND."; + /* clang-format on */ if (!notFoundMessage.empty()) { e << " Reason given by package: \n" << notFoundMessage << "\n"; diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx index 00a497c70..fe45e43b2 100644 --- a/Source/cmGeneratorExpressionDAGChecker.cxx +++ b/Source/cmGeneratorExpressionDAGChecker.cxx @@ -118,9 +118,11 @@ void cmGeneratorExpressionDAGChecker::ReportError( { std::ostringstream e; + /* clang-format off */ e << "Error evaluating generator expression:\n" << " " << expr << "\n" << "Dependency loop found."; + /* clang-format on */ context->LG->GetCMakeInstance() ->IssueMessage(cmake::FATAL_ERROR, e.str(), context->Backtrace); diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index a9227b0cf..9f2272c5e 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -1898,9 +1898,11 @@ void reportError(cmGeneratorExpressionContext *context, } std::ostringstream e; + /* clang-format off */ e << "Error evaluating generator expression:\n" << " " << expr << "\n" << result; + /* clang-format on */ context->LG->GetCMakeInstance() ->IssueMessage(cmake::FATAL_ERROR, e.str(), context->Backtrace); diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index f115d83f9..0189d93ef 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -2693,6 +2693,7 @@ static void processIncludeDirectories(cmGeneratorTarget const* tgt, break; } } + /* clang-format off */ e << "Imported target \"" << targetName << "\" includes " "non-existent path\n \"" << *li << "\"\nin its " "INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:\n" @@ -2702,6 +2703,7 @@ static void processIncludeDirectories(cmGeneratorTarget const* tgt, "successfully.\n" "* The installation package was faulty and references files it " "does not provide.\n"; + /* clang-format on */ tgt->GetLocalGenerator()->IssueMessage(messageType, e.str()); return; } @@ -2713,9 +2715,11 @@ static void processIncludeDirectories(cmGeneratorTarget const* tgt, cmake::MessageType messageType = cmake::FATAL_ERROR; if (!targetName.empty()) { + /* clang-format off */ e << "Target \"" << targetName << "\" contains relative " "path in its INTERFACE_INCLUDE_DIRECTORIES:\n" " \"" << *li << "\""; + /* clang-format on */ } else { @@ -5198,6 +5202,7 @@ cmGeneratorTarget::ComputeLinkInterfaceLibraries( && strcmp(newExplicitLibraries, explicitLibraries) != 0) { std::ostringstream w; + /* clang-format off */ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0022) << "\n" "Target \"" << this->GetName() << "\" has an " "INTERFACE_LINK_LIBRARIES property which differs from its " << @@ -5207,6 +5212,7 @@ cmGeneratorTarget::ComputeLinkInterfaceLibraries( " " << newExplicitLibraries << "\n" << linkIfaceProp << ":\n" " " << (explicitLibraries ? explicitLibraries : "(empty)") << "\n"; + /* clang-format on */ this->LocalGenerator->IssueMessage(cmake::AUTHOR_WARNING, w.str()); this->PolicyWarnedCMP0022 = true; } @@ -5269,6 +5275,7 @@ cmGeneratorTarget::ComputeLinkInterfaceLibraries( { newLibraries = "(empty)"; } std::ostringstream w; + /* clang-format off */ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0022) << "\n" "Target \"" << this->GetName() << "\" has an " "INTERFACE_LINK_LIBRARIES property. " @@ -5281,6 +5288,7 @@ cmGeneratorTarget::ComputeLinkInterfaceLibraries( " " << newLibraries << "\n" "Link implementation:\n" " " << oldLibraries << "\n"; + /* clang-format on */ this->LocalGenerator->IssueMessage(cmake::AUTHOR_WARNING, w.str()); this->PolicyWarnedCMP0022 = true; } @@ -5630,6 +5638,7 @@ bool cmGeneratorTarget::GetConfigCommonSourceFiles( sep = "\n "; } std::ostringstream e; + /* clang-format off */ e << "Target \"" << this->GetName() << "\" has source files which vary by " "configuration. This is not supported by the \"" @@ -5639,6 +5648,7 @@ bool cmGeneratorTarget::GetConfigCommonSourceFiles( " " << firstConfigFiles << "\n" "Config \"" << *it << "\":\n" " " << thisConfigFiles << "\n"; + /* clang-format on */ this->LocalGenerator->IssueMessage(cmake::FATAL_ERROR, e.str()); return false; } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 84ade253b..bd809e170 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -111,12 +111,14 @@ bool cmGlobalGenerator::SetGeneratorPlatform(std::string const& p, } std::ostringstream e; + /* clang-format off */ e << "Generator\n" " " << this->GetName() << "\n" "does not support platform specification, but platform\n" " " << p << "\n" "was specified."; + /* clang-format on */ mf->IssueMessage(cmake::FATAL_ERROR, e.str()); return false; } @@ -129,12 +131,14 @@ bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts, return true; } std::ostringstream e; + /* clang-format off */ e << "Generator\n" " " << this->GetName() << "\n" "does not support toolset specification, but toolset\n" " " << ts << "\n" "was specified."; + /* clang-format on */ mf->IssueMessage(cmake::FATAL_ERROR, e.str()); return false; } @@ -696,28 +700,34 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, if(!compilerFile || !*compilerFile || cmSystemTools::IsNOTFOUND(compilerFile)) { + /* clang-format off */ noCompiler << "No " << compilerName << " could be found.\n" ; + /* clang-format on */ } else if(strcmp(lang, "RC") != 0 && strcmp(lang, "ASM_MASM") != 0) { if(!cmSystemTools::FileIsFullPath(compilerFile)) { + /* clang-format off */ noCompiler << "The " << compilerName << ":\n" " " << compilerFile << "\n" "is not a full path and was not found in the PATH.\n" ; + /* clang-format on */ } else if(!cmSystemTools::FileExists(compilerFile)) { + /* clang-format off */ noCompiler << "The " << compilerName << ":\n" " " << compilerFile << "\n" "is not a full path to an existing compiler tool.\n" ; + /* clang-format on */ } } if(!noCompiler.str().empty()) @@ -889,10 +899,12 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf, mf->PolicyOptionalWarningEnabled("CMAKE_POLICY_WARNING_CMP0025")) { std::ostringstream w; + /* clang-format off */ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0025) << "\n" "Converting " << lang << " compiler id \"AppleClang\" to \"Clang\" for compatibility." ; + /* clang-format on */ mf->IssueMessage(cmake::AUTHOR_WARNING, w.str()); } case cmPolicies::OLD: @@ -920,10 +932,12 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf, mf->PolicyOptionalWarningEnabled("CMAKE_POLICY_WARNING_CMP0047")) { std::ostringstream w; + /* clang-format off */ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0047) << "\n" "Converting " << lang << " compiler id \"QCC\" to \"GNU\" for compatibility." ; + /* clang-format on */ mf->IssueMessage(cmake::AUTHOR_WARNING, w.str()); } case cmPolicies::OLD: diff --git a/Source/cmGlobalJOMMakefileGenerator.cxx b/Source/cmGlobalJOMMakefileGenerator.cxx index 31cd2d356..aeb7dd56f 100644 --- a/Source/cmGlobalJOMMakefileGenerator.cxx +++ b/Source/cmGlobalJOMMakefileGenerator.cxx @@ -55,11 +55,13 @@ void cmGlobalJOMMakefileGenerator::PrintCompilerAdvice(std::ostream& os, { if(lang == "CXX" || lang == "C") { + /* clang-format off */ os << "To use the JOM generator with Visual C++, cmake must be run from a " "shell that can use the compiler cl from the command line. This " "environment is unable to invoke the cl compiler. To fix this problem, " "run cmake from the Visual Studio Command Prompt (vcvarsall.bat).\n"; + /* clang-format on */ } this->cmGlobalUnixMakefileGenerator3::PrintCompilerAdvice(os, lang, envVar); } diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx index 0a9f64424..624132934 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.cxx +++ b/Source/cmGlobalNMakeMakefileGenerator.cxx @@ -55,11 +55,13 @@ void cmGlobalNMakeMakefileGenerator::PrintCompilerAdvice(std::ostream& os, { if(lang == "CXX" || lang == "C") { + /* clang-format off */ os << "To use the NMake generator with Visual C++, cmake must be run from a " "shell that can use the compiler cl from the command line. This " "environment is unable to invoke the cl compiler. To fix this problem, " "run cmake from the Visual Studio Command Prompt (vcvarsall.bat).\n"; + /* clang-format on */ } this->cmGlobalUnixMakefileGenerator3::PrintCompilerAdvice(os, lang, envVar); } diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index a8a7262ae..953df6b47 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -820,11 +820,13 @@ void cmGlobalNinjaGenerator::OpenRulesFileStream() this->WriteDisclaimer(*this->RulesFileStream); // Write comment about this file. + /* clang-format off */ *this->RulesFileStream << "# This file contains all the rules used to get the outputs files\n" << "# built from the input files.\n" << "# It is included in the main '" << NINJA_BUILD_FILE << "'.\n\n" ; + /* clang-format on */ } void cmGlobalNinjaGenerator::CloseRulesFileStream() @@ -891,6 +893,7 @@ void cmGlobalNinjaGenerator::AddCXXCompileCommand( } + /* clang-format off */ *this->CompileCommandsStream << "\n{\n" << " \"directory\": \"" << cmGlobalGenerator::EscapeJSON(buildFileDir) << "\",\n" @@ -899,6 +902,7 @@ void cmGlobalNinjaGenerator::AddCXXCompileCommand( << " \"file\": \"" << cmGlobalGenerator::EscapeJSON(sourceFileName) << "\"\n" << "}"; + /* clang-format on */ } void cmGlobalNinjaGenerator::CloseCompileCommandsStream() @@ -1149,9 +1153,11 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) //dependencies that we have no rule for cmGlobalNinjaGenerator::WriteDivider(os); + /* clang-format off */ os << "# Unknown Build Time Dependencies.\n" << "# Tell Ninja that they may appear as side effects of build rules\n" << "# otherwise ordered by order-only dependencies.\n\n"; + /* clang-format on */ //get the list of files that cmake itself has generated as a //product of configuration. @@ -1256,6 +1262,7 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) if (!warnExplicitDepends.empty()) { std::ostringstream w; + /* clang-format off */ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0058) << "\n" "This project specifies custom command DEPENDS on files " "in the build tree that are not specified as the OUTPUT or " @@ -1269,6 +1276,7 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) "Project authors should add the missing BYPRODUCTS or OUTPUT " "options to the custom commands that produce these files." ; + /* clang-format on */ this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, w.str()); } } diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 22ffbcc54..4376dd964 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -337,6 +337,7 @@ void cmGlobalVisualStudio10Generator::Generate() { cmLocalGenerator* lg = this->LongestSource.Target->GetLocalGenerator(); std::ostringstream e; + /* clang-format off */ e << "The binary and/or source directory paths may be too long to generate " "Visual Studio 10 files for this project. " @@ -356,6 +357,7 @@ void cmGlobalVisualStudio10Generator::Generate() "the path length is too long for some internal buffer or API. " "To avoid this problem CMake must use a full path for this file " "which then triggers the VS 10 property dialog bug."; + /* clang-format on */ lg->IssueMessage(cmake::WARNING, e.str().c_str()); } } @@ -566,9 +568,11 @@ bool cmGlobalVisualStudio10Generator::Find64BitTools(cmMakefile* mf) else { std::ostringstream e; + /* clang-format off */ e << "Cannot enable 64-bit tools with Visual Studio 2010 Express.\n" << "Install the Microsoft Windows SDK v7.1 to get 64-bit tools:\n" << " http://msdn.microsoft.com/en-us/windows/bb980924.aspx"; + /* clang-format on */ mf->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); cmSystemTools::SetFatalErrorOccured(); return false; diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 0ca4db172..68a751006 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -204,6 +204,7 @@ cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout, if(ui != this->UtilityDepends.end()) { const char* uname = ui->second.c_str(); + /* clang-format off */ fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" << uname << "\", \"" << this->ConvertToSolutionPath(dir) << (dir[0]? "\\":"") @@ -213,6 +214,7 @@ cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout, << "\t\t{" << guid << "} = {" << guid << "}\n" << "\tEndProjectSection\n" << "EndProject\n"; + /* clang-format on */ } } diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 058183cf8..a5ee336d4 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -704,6 +704,7 @@ cmGlobalVisualStudio7Generator::WriteUtilityDepend( fout.SetCopyIfDifferent(true); std::string guid = this->GetGUID(pname.c_str()); + /* clang-format off */ fout << "Encoding() << "\"?>\n" @@ -716,9 +717,11 @@ cmGlobalVisualStudio7Generator::WriteUtilityDepend( "\t\n" "\t\n" ; + /* clang-format on */ for(std::vector::iterator i = configs.begin(); i != configs.end(); ++i) { + /* clang-format off */ fout << "\t\t\n" "\t\t\n" ; + /* clang-format on */ } + /* clang-format off */ fout << "\t\n" "\t\n" "\t\n" "\n" ; + /* clang-format on */ if(fout.Close()) { diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 19f7a7434..e9ad49c65 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3655,6 +3655,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( makefileStream.SetCopyIfDifferent(true); // one more pass for external depend information not handled // correctly by xcode + /* clang-format off */ makefileStream << "# DO NOT EDIT\n"; makefileStream << "# This makefile makes sure all linkable targets are\n"; makefileStream << "# up-to-date with anything they link to\n" @@ -3664,6 +3665,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( makefileStream << "# For each target create a dummy rule " "so the target does not have to exist\n"; + /* clang-format on */ std::set emitted; for(std::vector::iterator i = targets.begin(); i != targets.end(); ++i) @@ -3688,10 +3690,12 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( makefileStream << "\n\n"; // Write rules to help Xcode relink things at the right time. + /* clang-format off */ makefileStream << "# Rules to remove targets that are older than anything to which they\n" "# link. This forces Xcode to relink the targets from scratch. It\n" "# does not seem to check these dependencies itself.\n"; + /* clang-format on */ for(std::vector::const_iterator ct = this->CurrentConfigurationTypes.begin(); ct != this->CurrentConfigurationTypes.end(); ++ct) diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index a31c0c979..0b623c682 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -216,6 +216,7 @@ void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os, Indent indentN = indent.Next(); Indent indentNN = indentN.Next(); Indent indentNNN = indentNN.Next(); + /* clang-format off */ os << indentN << "file(DIFFERENT EXPORT_FILE_CHANGED FILES\n" << indentN << " \"" << installedFile << "\"\n" << indentN << " \"" << this->MainImportFile << "\")\n"; @@ -229,6 +230,7 @@ void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os, os << indentNN << "endif()\n"; os << indentN << "endif()\n"; os << indent << "endif()\n"; + /* clang-format on */ // Install the main export file. std::vector files; diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 001033329..971cc2319 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -685,9 +685,11 @@ cmInstallTargetGenerator // Write a rule to remove the installed file if its rpath is not the // new rpath. This is needed for existing build/install trees when // the installed rpath changes but the file is not rebuilt. + /* clang-format off */ os << indent << "file(RPATH_CHECK\n" << indent << " FILE \"" << toDestDirPath << "\"\n" << indent << " RPATH \"" << newRpath << "\")\n"; + /* clang-format on */ } //---------------------------------------------------------------------------- diff --git a/Source/cmLinkDirectoriesCommand.cxx b/Source/cmLinkDirectoriesCommand.cxx index b6c0072db..b879de6de 100644 --- a/Source/cmLinkDirectoriesCommand.cxx +++ b/Source/cmLinkDirectoriesCommand.cxx @@ -37,9 +37,11 @@ void cmLinkDirectoriesCommand::AddLinkDir(std::string const& dir) { bool convertToAbsolute = false; std::ostringstream e; + /* clang-format off */ e << "This command specifies the relative path\n" << " " << unixPath << "\n" << "as a link directory.\n"; + /* clang-format on */ switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0015)) { case cmPolicies::WARN: diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 5a161045d..0efe0994d 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -261,9 +261,11 @@ bool cmListFileParser::ParseFunction(const char* name, long line) if(!token) { std::ostringstream error; + /* clang-format off */ error << "Error in cmake code at\n" << this->FileName << ":" << cmListFileLexer_GetCurrentLine(this->Lexer) << ":\n" << "Parse error. Function missing opening \"(\"."; + /* clang-format on */ cmSystemTools::Error(error.str().c_str()); return false; } @@ -382,10 +384,12 @@ bool cmListFileParser::AddArgument(cmListFileLexer_Token* token, bool isError = (this->Separation == SeparationError || delim == cmListFileArgument::Bracket); std::ostringstream m; + /* clang-format off */ m << "Syntax " << (isError? "Error":"Warning") << " in cmake code at\n" << " " << this->FileName << ":" << token->line << ":" << token->column << "\n" << "Argument not separated from preceding token by whitespace."; + /* clang-format on */ if(isError) { this->Makefile->IssueMessage(cmake::FATAL_ERROR, m.str()); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 6db18f74a..18b3ef3e0 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -349,6 +349,7 @@ void cmLocalGenerator::GenerateInstallRules() << std::endl; // Write support code for generating per-configuration install rules. + /* clang-format off */ fout << "# Set the install configuration name.\n" "if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)\n" @@ -362,8 +363,10 @@ void cmLocalGenerator::GenerateInstallRules() "\\\"${CMAKE_INSTALL_CONFIG_NAME}\\\"\")\n" "endif()\n" "\n"; + /* clang-format on */ // Write support code for dealing with component-specific installs. + /* clang-format off */ fout << "# Set the component getting installed.\n" "if(NOT CMAKE_INSTALL_COMPONENT)\n" @@ -375,17 +378,20 @@ void cmLocalGenerator::GenerateInstallRules() " endif()\n" "endif()\n" "\n"; + /* clang-format on */ // Copy user-specified install options to the install code. if(const char* so_no_exe = this->Makefile->GetDefinition("CMAKE_INSTALL_SO_NO_EXE")) { + /* clang-format off */ fout << "# Install shared libraries without execute permission?\n" "if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)\n" " set(CMAKE_INSTALL_SO_NO_EXE \"" << so_no_exe << "\")\n" "endif()\n" "\n"; + /* clang-format on */ } // Ask each install generator to write its code. @@ -426,6 +432,7 @@ void cmLocalGenerator::GenerateInstallRules() // Record the install manifest. if ( toplevel_install ) { + /* clang-format off */ fout << "if(CMAKE_INSTALL_COMPONENT)\n" " set(CMAKE_INSTALL_MANIFEST \"install_manifest_" @@ -438,6 +445,7 @@ void cmLocalGenerator::GenerateInstallRules() " \"${CMAKE_INSTALL_MANIFEST_FILES}\")\n" "file(WRITE \"" << homedir << "/${CMAKE_INSTALL_MANIFEST}\"\n" " \"${CMAKE_INSTALL_MANIFEST_CONTENT}\")\n"; + /* clang-format on */ } } @@ -1594,10 +1602,12 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, "CMAKE_POLICY_WARNING_CMP0065")) { std::ostringstream w; + /* clang-format off */ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0065) << "\n" "For compatibility with older versions of CMake, " "additional flags may be added to export symbols on all " "executables regardless of thier ENABLE_EXPORTS property."; + /* clang-format on */ this->IssueMessage(cmake::AUTHOR_WARNING, w.str()); } case cmPolicies::OLD: @@ -2176,6 +2186,7 @@ void cmLocalGenerator this->WarnCMP0063.insert(target).second) { std::ostringstream w; + /* clang-format off */ w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0063) << "\n" "Target \"" << target->GetName() << "\" of " @@ -2183,6 +2194,7 @@ void cmLocalGenerator "has the following visibility properties set for " << lang << ":\n" << warnCMP0063 << "For compatibility CMake is not honoring them for this target."; + /* clang-format on */ target->GetLocalGenerator()->GetCMakeInstance() ->IssueMessage(cmake::AUTHOR_WARNING, w.str(), target->GetBacktrace()); @@ -2764,6 +2776,7 @@ cmLocalGenerator if(this->ObjectMaxPathViolations.insert(dir_max).second) { std::ostringstream m; + /* clang-format off */ m << "The object file directory\n" << " " << dir_max << "\n" << "has " << dir_max.size() << " characters. " @@ -2774,6 +2787,7 @@ cmLocalGenerator << " " << ssin << "\n" << "cannot be safely placed under this directory. " << "The build may not work correctly."; + /* clang-format on */ this->IssueMessage(cmake::WARNING, m.str()); } } @@ -3034,11 +3048,13 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const if (define[pos] == '(') { std::ostringstream e; + /* clang-format off */ e << "WARNING: Function-style preprocessor definitions may not be " << "passed on the compiler command line because many compilers " << "do not support it.\n" << "CMake is dropping a preprocessor definition: " << define << "\n" << "Consider defining the macro in a (configured) header file.\n"; + /* clang-format on */ cmSystemTools::Message(e.str().c_str()); return false; } @@ -3048,11 +3064,13 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const if(define.find_first_of("#") != define.npos) { std::ostringstream e; + /* clang-format off */ e << "WARNING: Preprocessor definitions containing '#' may not be " << "passed on the compiler command line because many compilers " << "do not support it.\n" << "CMake is dropping a preprocessor definition: " << define << "\n" << "Consider defining the macro in a (configured) header file.\n"; + /* clang-format on */ cmSystemTools::Message(e.str().c_str()); return false; } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 2a0e07d31..7a404af17 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -519,6 +519,7 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() this->WriteDisclaimer(infoFileStream); // Setup relative path conversion tops. + /* clang-format off */ infoFileStream << "# Relative path conversion top directories.\n" << "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" @@ -528,14 +529,17 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() << this->StateSnapshot.GetDirectory().GetRelativePathTopBinary() << "\")\n" << "\n"; + /* clang-format on */ // Tell the dependency scanner to use unix paths if necessary. if(cmSystemTools::GetForceUnixPaths()) { + /* clang-format off */ infoFileStream << "# Force unix paths in dependencies.\n" << "set(CMAKE_FORCE_UNIX_PATHS 1)\n" << "\n"; + /* clang-format on */ } // Store the include regular expressions for this directory. @@ -718,13 +722,16 @@ cmLocalUnixMakefileGenerator3 else { #if !defined(__VMS) + /* clang-format off */ makefileStream << "# The shell in which to execute make rules.\n" << "SHELL = /bin/sh\n" << "\n"; + /* clang-format on */ #endif } + /* clang-format off */ makefileStream << "# The CMake executable.\n" << "CMAKE_COMMAND = " @@ -753,6 +760,7 @@ cmLocalUnixMakefileGenerator3 << this->Convert(this->GetBinaryDirectory(), FULL, SHELL) << "\n" << "\n"; + /* clang-format on */ } //---------------------------------------------------------------------------- @@ -793,27 +801,33 @@ cmLocalUnixMakefileGenerator3 // Switch on WMake feature, if an error or interrupt occurs during // makefile processing, the current target being made may be deleted // without prompting (the same as command line -e option). + /* clang-format off */ makefileStream << "\n" ".ERASE\n" "\n" ; + /* clang-format on */ } if(this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE")) { + /* clang-format off */ makefileStream << "# Produce verbose output by default.\n" << "VERBOSE = 1\n" << "\n"; + /* clang-format on */ } if(this->IsWatcomWMake()) { + /* clang-format off */ makefileStream << "!ifndef VERBOSE\n" ".SILENT\n" "!endif\n" "\n" ; + /* clang-format on */ } else { @@ -1252,12 +1266,14 @@ cmLocalUnixMakefileGenerator3 std::set languages; target->GetLanguages(languages, this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); + /* clang-format off */ fout << "\n" << "# Per-language clean rules from dependency scanning.\n" << "foreach(lang " << cmJoin(languages, " ") << ")\n" << " include(" << this->GetTargetDirectory(target) << "/cmake_clean_${lang}.cmake OPTIONAL)\n" << "endforeach()\n"; + /* clang-format on */ } } @@ -2083,10 +2099,12 @@ void cmLocalUnixMakefileGenerator3 this->ConfigName, l->first); if(!defines.empty()) { + /* clang-format off */ cmakefileStream << "\n" << "# Preprocessor definitions for this target.\n" << "set(CMAKE_TARGET_DEFINITIONS_" << l->first << "\n"; + /* clang-format on */ for(std::set::const_iterator di = defines.begin(); di != defines.end(); ++di) { diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 38b7ac339..3c01a7032 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -794,16 +794,20 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, std::string const& outDir = target->GetType() == cmState::OBJECT_LIBRARY? intermediateDir : target->GetDirectory(configName); + /* clang-format off */ fout << "\t\t\tOutputDirectory=\"" << this->ConvertToXMLOutputPathSingle(outDir.c_str()) << "\"\n"; + /* clang-format on */ } + /* clang-format off */ fout << "\t\t\tIntermediateDirectory=\"" << this->ConvertToXMLOutputPath(intermediateDir.c_str()) << "\"\n" << "\t\t\tConfigurationType=\"" << configType << "\"\n" << "\t\t\tUseOfMFC=\"" << mfcFlag << "\"\n" << "\t\t\tATLMinimizesCRunTimeLibraryUsage=\"false\"\n"; + /* clang-format on */ if (this->FortranProject) { @@ -813,10 +817,12 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, cmSystemTools::GetFilenameWithoutLastExtension(targetNameFull); std::string targetExt = cmSystemTools::GetFilenameLastExtension(targetNameFull); + /* clang-format off */ fout << "\t\t\tTargetName=\"" << this->EscapeForXML(targetName) << "\"\n" "\t\t\tTargetExt=\"" << this->EscapeForXML(targetExt) << "\"\n" ; + /* clang-format on */ } // If unicode is enabled change the character set to unicode, if not @@ -898,11 +904,13 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, if(gg->IsMasmEnabled() && !this->FortranProject) { Options masmOptions(this, Options::MasmCompiler, 0, 0); + /* clang-format off */ fout << "\t\t\t\n"; + /* clang-format on */ } tool = "VCCustomBuildTool"; if(this->FortranProject) @@ -985,9 +995,11 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, { manifestTool = "VFManifestTool"; } + /* clang-format off */ fout << "\t\t\t manifest_srcs; target->GetManifests(manifest_srcs, configName); @@ -1388,6 +1400,7 @@ void cmLocalVisualStudio7Generator::OutputDeploymentDebuggerTool( { if (const char* dir = target->GetProperty("DEPLOYMENT_REMOTE_DIRECTORY")) { + /* clang-format off */ fout << "\t\t\t\n" ; + /* clang-format on */ std::string const exe = dir + std::string("\\") + target->GetFullName(config); + /* clang-format off */ fout << "\t\t\tEscapeForXML(exe) << "\"\n" "\t\t\t\tArguments=\"\"\n" "\t\t\t/>\n" ; + /* clang-format on */ } } } @@ -1961,6 +1977,7 @@ WriteCustomRule(std::ostream& fout, { cmSystemTools::ReplaceString(script, "$(Configuration)", i->c_str()); } + /* clang-format off */ fout << "\t\t\t\t\tEscapeForXML(script.c_str()) << "\"\n" << "\t\t\t\t\tAdditionalDependencies=\""; + /* clang-format on */ if(ccg.GetDepends().empty()) { // There are no real dependencies. Produce an artificial one to @@ -2025,9 +2043,11 @@ void cmLocalVisualStudio7Generator::WriteVCProjBeginGroup(std::ostream& fout, const char* group, const char* ) { + /* clang-format off */ fout << "\t\t\n"; + /* clang-format on */ } @@ -2107,9 +2127,11 @@ void cmLocalVisualStudio7Generator::WriteProjectSCC(std::ostream& fout, if(vsProvider && vsLocalpath && vsProjectname) { + /* clang-format off */ fout << "\tSccProjectName=\"" << vsProjectname << "\"\n" << "\tSccLocalPath=\"" << vsLocalpath << "\"\n" << "\tSccProvider=\"" << vsProvider << "\"\n"; + /* clang-format on */ const char* vsAuxPath = target->GetProperty("VS_SCC_AUXPATH"); if(vsAuxPath) @@ -2128,11 +2150,13 @@ cmLocalVisualStudio7Generator cmGlobalVisualStudio7Generator* gg = static_cast(this->GlobalGenerator); + /* clang-format off */ fout << "Encoding() << "\"?>\n" << "GetIntelProjectVersion() << "\"\n"; + /* clang-format on */ const char* keyword = target->GetProperty("VS_KEYWORD"); if(!keyword) { @@ -2173,11 +2197,13 @@ cmLocalVisualStudio7Generator fout << "\tProjectType=\"" << projectType << "\"\n"; } this->WriteProjectSCC(fout, target); + /* clang-format off */ fout<< "\tKeyword=\"" << keyword << "\">\n" << "\tProjectGUID=\"{" << gg->GetGUID(libName.c_str()) << "}\">\n" << "\t\n" << "\t\tGetPlatformName() << "\"/>\n" << "\t\n"; + /* clang-format on */ } @@ -2196,10 +2222,12 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, cmGlobalVisualStudio7Generator* gg = static_cast(this->GlobalGenerator); + /* clang-format off */ fout << "Encoding() << "\"?>\n" << "GetVersion() == cmGlobalVisualStudioGenerator::VS71) { fout << "\tVersion=\"7.10\"\n"; @@ -2229,12 +2257,15 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, { fout << "\tTargetFrameworkVersion=\"" << targetFrameworkVersion << "\"\n"; } + /* clang-format off */ fout << "\tKeyword=\"" << keyword << "\">\n" << "\t\n" << "\t\tGetPlatformName() << "\"/>\n" << "\t\n"; + /* clang-format on */ if(gg->IsMasmEnabled()) { + /* clang-format off */ fout << "\t\n" "\t\t\n" "\t\n" ; + /* clang-format on */ } } @@ -2261,10 +2293,12 @@ void cmLocalVisualStudio7Generator::WriteVCProjFooter( std::string name = i->substr(10); if(name != "") { + /* clang-format off */ fout << "\t\tGetProperty(*i) << "\"\n" << "\t\t/>\n"; + /* clang-format on */ } } } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 3bc118148..53a257cdf 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -433,10 +433,12 @@ void cmMakefile::IncludeScope::EnforceCMP0011() case cmPolicies::REQUIRED_ALWAYS: { std::ostringstream e; + /* clang-format off */ e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0011) << "\n" << "The included script\n " << this->Makefile->GetExecutionFilePath() << "\n" << "affects policy settings, so it requires this policy to be set."; + /* clang-format on */ this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); } break; @@ -1652,19 +1654,23 @@ void cmMakefile::ConfigureSubDirectory(cmMakefile *mf) { // The file is missing. Check policy CMP0014. std::ostringstream e; + /* clang-format off */ e << "The source directory\n" << " " << currentStart << "\n" << "does not contain a CMakeLists.txt file."; + /* clang-format on */ switch (this->GetPolicyStatus(cmPolicies::CMP0014)) { case cmPolicies::WARN: // Print the warning. + /* clang-format off */ e << "\n" << "CMake does not support this case but it used " << "to work accidentally and is being allowed for " << "compatibility." << "\n" << cmPolicies::GetPolicyWarning(cmPolicies::CMP0014); + /* clang-format on */ this->IssueMessage(cmake::AUTHOR_WARNING, e.str()); case cmPolicies::OLD: // OLD behavior does not warn. @@ -2249,10 +2255,12 @@ void cmMakefile::ExpandVariablesCMP0019() this->ExpandVariablesInString(dirs, true, true); if(pol == cmPolicies::WARN && dirs != includeDirs) { + /* clang-format off */ w << "Evaluated directory INCLUDE_DIRECTORIES\n" << " " << includeDirs << "\n" << "as\n" << " " << dirs << "\n"; + /* clang-format on */ } this->SetProperty("INCLUDE_DIRECTORIES", dirs.c_str()); } @@ -2274,10 +2282,12 @@ void cmMakefile::ExpandVariablesCMP0019() this->ExpandVariablesInString(dirs, true, true); if(pol == cmPolicies::WARN && dirs != includeDirs) { + /* clang-format off */ w << "Evaluated target " << t.GetName() << " INCLUDE_DIRECTORIES\n" << " " << includeDirs << "\n" << "as\n" << " " << dirs << "\n"; + /* clang-format on */ } t.SetProperty("INCLUDE_DIRECTORIES", dirs.c_str()); } @@ -2292,10 +2302,12 @@ void cmMakefile::ExpandVariablesCMP0019() this->ExpandVariablesInString(d, true, true); if(pol == cmPolicies::WARN && d != orig) { + /* clang-format off */ w << "Evaluated link directories\n" << " " << orig << "\n" << "as\n" << " " << d << "\n"; + /* clang-format on */ } } } @@ -2309,10 +2321,12 @@ void cmMakefile::ExpandVariablesCMP0019() this->ExpandVariablesInString(l->first, true, true); if(pol == cmPolicies::WARN && l->first != orig) { + /* clang-format off */ w << "Evaluated link library\n" << " " << orig << "\n" << "as\n" << " " << l->first << "\n"; + /* clang-format on */ } } } @@ -2320,10 +2334,12 @@ void cmMakefile::ExpandVariablesCMP0019() if(!w.str().empty()) { std::ostringstream m; + /* clang-format off */ m << cmPolicies::GetPolicyWarning(cmPolicies::CMP0019) << "\n" << "The following variable evaluations were encountered:\n" << w.str(); + /* clang-format on */ this->IssueMessage(cmake::AUTHOR_WARNING, m.str()); } } @@ -3223,9 +3239,11 @@ void cmMakefile::PopFunctionBlockerBarrier(bool reportError) // Report the context in which the unclosed block was opened. cmListFileContext const& lfc = fb->GetStartingContext(); std::ostringstream e; + /* clang-format off */ e << "A logical block opening on the line\n" << " " << lfc << "\n" << "is not closed."; + /* clang-format on */ this->IssueMessage(cmake::FATAL_ERROR, e.str()); reportError = false; } @@ -3397,11 +3415,13 @@ cmMakefile::RemoveFunctionBlocker(cmFunctionBlocker* fb, cmListFileContext closingContext = cmListFileContext::FromCommandContext(lff, lfc.FilePath); std::ostringstream e; + /* clang-format off */ e << "A logical block opening on the line\n" << " " << lfc << "\n" << "closes on the line\n" << " " << closingContext << "\n" << "with mis-matching arguments."; + /* clang-format on */ this->IssueMessage(cmake::AUTHOR_WARNING, e.str()); } cmFunctionBlocker* b = *pos; @@ -3741,11 +3761,13 @@ std::string cmMakefile::GetModulesFile(const char* filename) const case cmPolicies::WARN: { std::ostringstream e; + /* clang-format off */ e << "File " << currentFile << " includes " << moduleInCMakeModulePath << " (found via CMAKE_MODULE_PATH) which shadows " << moduleInCMakeRoot << ". This may cause errors later on .\n" << cmPolicies::GetPolicyWarning(cmPolicies::CMP0017); + /* clang-format on */ this->IssueMessage(cmake::AUTHOR_WARNING, e.str()); // break; // fall through to OLD behaviour @@ -4288,6 +4310,7 @@ bool cmMakefile::EnforceUniqueDir(const std::string& srcPath, { case cmPolicies::WARN: // Print the warning. + /* clang-format off */ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0013) << "\n" << "The binary directory\n" @@ -4299,6 +4322,7 @@ bool cmMakefile::EnforceUniqueDir(const std::string& srcPath, << "CMake does not support this use case but it used " << "to work accidentally and is being allowed for " << "compatibility."; + /* clang-format on */ this->IssueMessage(cmake::AUTHOR_WARNING, e.str()); case cmPolicies::OLD: // OLD behavior does not warn. @@ -4309,12 +4333,14 @@ bool cmMakefile::EnforceUniqueDir(const std::string& srcPath, << "\n"; case cmPolicies::NEW: // NEW behavior prints the error. + /* clang-format off */ e << "The binary directory\n" << " " << binPath << "\n" << "is already used to build a source directory. " << "It cannot be used to build source directory\n" << " " << srcPath << "\n" << "Specify a unique binary directory name."; + /* clang-format on */ this->IssueMessage(cmake::FATAL_ERROR, e.str()); break; } diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index e14f828e2..50449fbdd 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1057,10 +1057,12 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() // Store multiple output pairs in the depend info file. if(!this->MultipleOutputPairs.empty()) { + /* clang-format off */ *this->InfoFileStream << "\n" << "# Pairs of files generated by the same build rule.\n" << "set(CMAKE_MULTIPLE_OUTPUT_PAIRS\n"; + /* clang-format on */ for(MultipleOutputPairsType::const_iterator pi = this->MultipleOutputPairs.begin(); pi != this->MultipleOutputPairs.end(); ++pi) @@ -1075,10 +1077,12 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() // Store list of targets linked directly or transitively. { + /* clang-format off */ *this->InfoFileStream << "\n" << "# Targets to which this target links.\n" << "set(CMAKE_TARGET_LINKED_INFO_FILES\n"; + /* clang-format on */ std::vector dirs = this->GetLinkedTargetDirectories(); for (std::vector::iterator i = dirs.begin(); i != dirs.end(); ++i) @@ -1089,11 +1093,13 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() << " )\n"; } + /* clang-format off */ *this->InfoFileStream << "\n" << "# Fortran module output directory.\n" << "set(CMAKE_Fortran_TARGET_MODULE_DIR \"" << this->GetFortranModuleDirectory() << "\")\n"; + /* clang-format on */ // and now write the rule to use it std::vector depends; @@ -1308,11 +1314,13 @@ cmMakefileTargetGenerator variableNameExternal = this->LocalGenerator->CreateMakeVariable(this->GeneratorTarget->GetName(), "_EXTERNAL_OBJECTS"); + /* clang-format off */ *this->BuildFileStream << "\n" << "# External object files for target " << this->GeneratorTarget->GetName() << "\n" << variableNameExternal << " ="; + /* clang-format on */ for(std::vector::const_iterator i = this->ExternalObjects.begin(); i != this->ExternalObjects.end(); ++i) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 68c1eb892..5ae99106e 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2618,11 +2618,13 @@ bool cmSystemTools::ChangeRPath(std::string const& file, if(emsg) { std::ostringstream e; + /* clang-format off */ e << "The current " << se_name[i] << " is:\n" << " " << se[i]->Value << "\n" << "which does not contain:\n" << " " << oldRPath << "\n" << "as was expected."; + /* clang-format on */ *emsg = e.str(); } return false; diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index fdc914201..3acc43cde 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -335,6 +335,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, { if (firstTryRun) { + /* clang-format off */ file << "# This file was generated by CMake because it detected " "TRY_RUN() commands\n" "# in crosscompiling mode. It will be overwritten by the next " @@ -342,6 +343,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, "# Copy it to a safe location, set the variables to " "appropriate values\n" "# and use it then to preset the CMake cache (using -C).\n\n"; + /* clang-format on */ } std::string comment ="\n"; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index b4bdb2ad6..65c23ca5b 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -3434,6 +3434,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80() cmGeneratedFileStream fout(manifestFile.c_str()); fout.SetCopyIfDifferent(true); + /* clang-format off */ fout << "\n" "\n" "\t\n" "\n"; + /* clang-format on */ std::string sourceFile = this->ConvertPath(manifestFile, false); this->ConvertToWindowsSlash(sourceFile); @@ -3518,6 +3520,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP81() cmGeneratedFileStream fout(manifestFile.c_str()); fout.SetCopyIfDifferent(true); + /* clang-format off */ fout << "\n" "\n" "\t\n" "\n"; + /* clang-format on */ this->WriteCommonMissingFiles(manifestFile); } @@ -3579,6 +3583,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS80() cmGeneratedFileStream fout(manifestFile.c_str()); fout.SetCopyIfDifferent(true); + /* clang-format off */ fout << "\n" "\n" @@ -3614,6 +3619,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS80() "\t\t\n" "\t\n" "\n"; + /* clang-format on */ this->WriteCommonMissingFiles(manifestFile); } @@ -3632,6 +3638,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS81() cmGeneratedFileStream fout(manifestFile.c_str()); fout.SetCopyIfDifferent(true); + /* clang-format off */ fout << "\n" "\n" "\t\n" "\n"; + /* clang-format on */ this->WriteCommonMissingFiles(manifestFile); } @@ -3690,6 +3698,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS10_0() cmGeneratedFileStream fout(manifestFile.c_str()); fout.SetCopyIfDifferent(true); + /* clang-format off */ fout << "\n" "\n" "\t\n" "\n"; + /* clang-format on */ this->WriteCommonMissingFiles(manifestFile); } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index f176cc10d..589ef1f47 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1229,10 +1229,12 @@ int cmake::HandleDeleteCacheVariables(const std::string& var) } std::vector saved; std::ostringstream warning; + /* clang-format off */ warning << "You have changed variables that require your cache to be deleted.\n" << "Configure will be re-run and you may have to reset some variables.\n" << "The following variables have changed:\n"; + /* clang-format on */ for(std::vector::iterator i = argsSplit.begin(); i != argsSplit.end(); ++i) { diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 785fd9066..d8207fab4 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -257,10 +257,12 @@ int do_cmake(int ac, char const* const* av) { if(strcmp(av[i], "-i") == 0) { + /* clang-format off */ std::cerr << "The \"cmake -i\" wizard mode is no longer supported.\n" "Use the -D option to set cache values on the command line.\n" "Use cmake-gui or ccmake for an interactive dialog.\n"; + /* clang-format on */ return 1; } else if(strcmp(av[i], "--system-information") == 0) @@ -453,11 +455,13 @@ static int do_build(int ac, char const* const* av) } if(dir.empty()) { + /* clang-format off */ std::cerr << "Usage: cmake --build [options] [-- [native-options]]\n" "Options:\n" CMAKE_BUILD_OPTIONS ; + /* clang-format on */ return 1; } diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 01b12a34a..79e1bf09c 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -44,14 +44,19 @@ void CMakeCommandUsage(const char* program) std::ostringstream errorStream; #ifdef CMAKE_BUILD_WITH_CMAKE + /* clang-format off */ errorStream << "cmake version " << cmVersion::GetCMakeVersion() << "\n"; + /* clang-format on */ #else + /* clang-format off */ errorStream << "cmake bootstrap\n"; + /* clang-format on */ #endif // If you add new commands, change here, // and in cmakemain.cxx in the options table + /* clang-format off */ errorStream << "Usage: " << program << " -E [arguments...]\n" << "Available commands: \n" @@ -95,6 +100,7 @@ void CMakeCommandUsage(const char* program) << " create_symlink old new - create a symbolic link new -> old\n" #endif ; + /* clang-format on */ cmSystemTools::Error(errorStream.str().c_str()); }