Commit d7204e64 authored by Kitware Robot's avatar Kitware Robot Committed by Brad King

Revise C++ coding style using clang-format-6.0

Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`.  Use `clang-format` version 6.0.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.
parent 12fed3ed
#ifdef __cplusplus
#error "A C++ compiler has been selected for C."
# error "A C++ compiler has been selected for C."
#endif
#ifdef __CLASSIC_C__
#define const
# define const
#endif
#include "CMakeCompilerABI.h"
......
#ifndef __CUDACC__
#error "A C or C++ compiler has been selected for CUDA"
# error "A C or C++ compiler has been selected for CUDA"
#endif
#include "CMakeCompilerABI.h"
......
#ifndef __cplusplus
#error "A C compiler has been selected for C++."
# error "A C compiler has been selected for C++."
#endif
#include "CMakeCompilerABI.h"
......
......@@ -11,27 +11,27 @@ const char info_sizeof_dptr[] = {
/* Application Binary Interface. */
#if defined(__sgi) && defined(_ABIO32)
#define ABI_ID "ELF O32"
# define ABI_ID "ELF O32"
#elif defined(__sgi) && defined(_ABIN32)
#define ABI_ID "ELF N32"
# define ABI_ID "ELF N32"
#elif defined(__sgi) && defined(_ABI64)
#define ABI_ID "ELF 64"
# define ABI_ID "ELF 64"
/* Check for (some) ARM ABIs.
* See e.g. http://wiki.debian.org/ArmEabiPort for some information on this. */
#elif defined(__GNU__) && defined(__ELF__) && defined(__ARM_EABI__)
#define ABI_ID "ELF ARMEABI"
# define ABI_ID "ELF ARMEABI"
#elif defined(__GNU__) && defined(__ELF__) && defined(__ARMEB__)
#define ABI_ID "ELF ARM"
# define ABI_ID "ELF ARM"
#elif defined(__GNU__) && defined(__ELF__) && defined(__ARMEL__)
#define ABI_ID "ELF ARM"
# define ABI_ID "ELF ARM"
#elif defined(__linux__) && defined(__ELF__) && defined(__amd64__) && \
defined(__ILP32__)
#define ABI_ID "ELF X32"
# define ABI_ID "ELF X32"
#elif defined(__ELF__)
#define ABI_ID "ELF"
# define ABI_ID "ELF"
#endif
#if defined(ABI_ID)
......
#ifdef CHECK_FUNCTION_EXISTS
#ifdef __cplusplus
# ifdef __cplusplus
extern "C"
#endif
# endif
char
CHECK_FUNCTION_EXISTS(void);
#ifdef __CLASSIC_C__
# ifdef __CLASSIC_C__
int main()
{
int ac;
char* av[];
#else
# else
int main(int ac, char* av[])
{
#endif
# endif
CHECK_FUNCTION_EXISTS();
if (ac > 1000) {
return *av[0];
......@@ -23,6 +23,6 @@ int main(int ac, char* av[])
#else /* CHECK_FUNCTION_EXISTS */
#error "CHECK_FUNCTION_EXISTS has to specify the function"
# error "CHECK_FUNCTION_EXISTS has to specify the function"
#endif /* CHECK_FUNCTION_EXISTS */
......@@ -2,15 +2,15 @@
extern int CHECK_VARIABLE_EXISTS;
#ifdef __CLASSIC_C__
# ifdef __CLASSIC_C__
int main()
{
int ac;
char* av[];
#else
# else
int main(int ac, char* av[])
{
#endif
# endif
if (ac > 1000) {
return *av[0];
}
......@@ -19,6 +19,6 @@ int main(int ac, char* av[])
#else /* CHECK_VARIABLE_EXISTS */
#error "CHECK_VARIABLE_EXISTS has to specify the variable"
# error "CHECK_VARIABLE_EXISTS has to specify the variable"
#endif /* CHECK_VARIABLE_EXISTS */
#include <mpi.h>
#ifdef __cplusplus
#include <cstdio>
# include <cstdio>
#else
#include <stdio.h>
# include <stdio.h>
#endif
int main(int argc, char* argv[])
......
#include <mpi.h>
#ifdef __cplusplus
#include <cstdio>
# include <cstdio>
#else
#include <stdio.h>
# include <stdio.h>
#endif
#if defined(MPI_VERSION) && defined(MPI_SUBVERSION)
......@@ -21,11 +21,11 @@ const char mpiver_str[] = { 'I', 'N',
int main(int argc, char* argv[])
{
#if defined(MPI_VERSION) && defined(MPI_SUBVERSION)
#ifdef __cplusplus
# ifdef __cplusplus
std::puts(mpiver_str);
#else
# else
puts(mpiver_str);
#endif
# endif
#endif
#ifdef TEST_MPI_MPICXX
MPI::MPI_Init(&argc, &argv);
......
......@@ -61,7 +61,8 @@ int cmCPackIFWGenerator::PackageFiles()
ifwCmd += " --repository " + rd;
}
} else {
cmCPackIFWLogger(WARNING, "The \"CPACK_IFW_REPOSITORIES_DIRECTORIES\" "
cmCPackIFWLogger(WARNING,
"The \"CPACK_IFW_REPOSITORIES_DIRECTORIES\" "
<< "variable is set, but content will be skipped, "
<< "because this feature available only since "
<< "QtIFW 3.1. Please update your QtIFW instance."
......@@ -93,7 +94,8 @@ int cmCPackIFWGenerator::PackageFiles()
ofs << "# Run command: " << ifwCmd << std::endl
<< "# Output:" << std::endl
<< output << std::endl;
cmCPackIFWLogger(ERROR, "Problem running IFW command: "
cmCPackIFWLogger(ERROR,
"Problem running IFW command: "
<< ifwCmd << std::endl
<< "Please check " << ifwTmpFile << " for errors"
<< std::endl);
......@@ -102,15 +104,16 @@ int cmCPackIFWGenerator::PackageFiles()
if (!this->Repository.RepositoryUpdate.empty() &&
!this->Repository.PatchUpdatesXml()) {
cmCPackIFWLogger(WARNING, "Problem patch IFW \"Updates\" "
cmCPackIFWLogger(WARNING,
"Problem patch IFW \"Updates\" "
<< "file: "
<< this->toplevel + "/repository/Updates.xml"
<< std::endl);
}
cmCPackIFWLogger(OUTPUT, "- repository: " << this->toplevel
<< "/repository generated"
<< std::endl);
cmCPackIFWLogger(OUTPUT,
"- repository: " << this->toplevel
<< "/repository generated" << std::endl);
}
// Run binary creator
......@@ -145,7 +148,8 @@ int cmCPackIFWGenerator::PackageFiles()
ifwCmd += " --repository " + rd;
}
} else {
cmCPackIFWLogger(WARNING, "The \"CPACK_IFW_REPOSITORIES_DIRECTORIES\" "
cmCPackIFWLogger(WARNING,
"The \"CPACK_IFW_REPOSITORIES_DIRECTORIES\" "
<< "variable is set, but content will be skipped, "
<< "because this feature available only since "
<< "QtIFW 3.1. Please update your QtIFW instance."
......@@ -203,7 +207,8 @@ int cmCPackIFWGenerator::PackageFiles()
ofs << "# Run command: " << ifwCmd << std::endl
<< "# Output:" << std::endl
<< output << std::endl;
cmCPackIFWLogger(ERROR, "Problem running IFW command: "
cmCPackIFWLogger(ERROR,
"Problem running IFW command: "
<< ifwCmd << std::endl
<< "Please check " << ifwTmpFile << " for errors"
<< std::endl);
......@@ -257,7 +262,8 @@ int cmCPackIFWGenerator::InitializeInternal()
}
if (this->BinCreator.empty()) {
cmCPackIFWLogger(ERROR, "Cannot find QtIFW compiler \"binarycreator\": "
cmCPackIFWLogger(ERROR,
"Cannot find QtIFW compiler \"binarycreator\": "
"likely it is not installed, or not in your PATH"
<< std::endl);
return 0;
......@@ -415,7 +421,8 @@ cmCPackComponent* cmCPackIFWGenerator::GetComponent(
}
} else {
this->Packages.erase(name);
cmCPackIFWLogger(ERROR, "Cannot configure package \""
cmCPackIFWLogger(ERROR,
"Cannot configure package \""
<< name << "\" for component \"" << component->Name
<< "\"" << std::endl);
}
......@@ -450,7 +457,8 @@ cmCPackComponentGroup* cmCPackIFWGenerator::GetComponentGroup(
this->BinaryPackages.insert(package);
} else {
this->Packages.erase(name);
cmCPackIFWLogger(ERROR, "Cannot configure package \""
cmCPackIFWLogger(ERROR,
"Cannot configure package \""
<< name << "\" for component group \"" << group->Name
<< "\"" << std::endl);
}
......@@ -596,7 +604,8 @@ cmCPackIFWRepository* cmCPackIFWGenerator::GetRepository(
} else {
this->Repositories.erase(repositoryName);
repository = nullptr;
cmCPackIFWLogger(WARNING, "Invalid repository \""
cmCPackIFWLogger(WARNING,
"Invalid repository \""
<< repositoryName << "\""
<< " configuration. Repository will be skipped."
<< std::endl);
......
......@@ -22,7 +22,9 @@
*
* http://qt-project.org/doc/qtinstallerframework/index.html
*/
class cmCPackIFWGenerator : public cmCPackGenerator, public cmCPackIFWCommon
class cmCPackIFWGenerator
: public cmCPackGenerator
, public cmCPackIFWCommon
{
public:
cmCPackTypeMacro(cmCPackIFWGenerator, cmCPackGenerator);
......
......@@ -24,7 +24,8 @@ void cmCPackIFWInstaller::printSkippedOptionWarning(
const std::string& optionName, const std::string& optionValue)
{
cmCPackIFWLogger(
WARNING, "Option "
WARNING,
"Option "
<< optionName << " is set to \"" << optionValue
<< "\" but will be skipped because the specified file does not exist."
<< std::endl);
......@@ -146,7 +147,8 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
if (this->WizardStyle != "Modern" && this->WizardStyle != "Aero" &&
this->WizardStyle != "Mac" && this->WizardStyle != "Classic") {
cmCPackIFWLogger(
WARNING, "Option CPACK_IFW_PACKAGE_WIZARD_STYLE has unknown value \""
WARNING,
"Option CPACK_IFW_PACKAGE_WIZARD_STYLE has unknown value \""
<< option << "\". Expected values are: Modern, Aero, Mac, Classic."
<< std::endl);
}
......@@ -469,7 +471,8 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
cmsys::SystemTools::CopyFileIfDifferent(this->Resources[i], path);
resources.push_back(std::move(name));
} else {
cmCPackIFWLogger(WARNING, "Can't copy resources from \""
cmCPackIFWLogger(WARNING,
"Can't copy resources from \""
<< this->Resources[i]
<< "\". Resource will be skipped." << std::endl);
}
......
......@@ -226,7 +226,8 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component)
if (const char* option = this->GetOption(prefix + "PRIORITY")) {
this->SortingPriority = option;
cmCPackIFWLogger(
WARNING, "The \"PRIORITY\" option is set "
WARNING,
"The \"PRIORITY\" option is set "
<< "for component \"" << component->Name << "\", but there option is "
<< "deprecated. Please use \"SORTING_PRIORITY\" option instead."
<< std::endl);
......@@ -303,7 +304,8 @@ int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group)
if (const char* option = this->GetOption(prefix + "PRIORITY")) {
this->SortingPriority = option;
cmCPackIFWLogger(
WARNING, "The \"PRIORITY\" option is set "
WARNING,
"The \"PRIORITY\" option is set "
<< "for component group \"" << group->Name
<< "\", but there option is "
<< "deprecated. Please use \"SORTING_PRIORITY\" option instead."
......
......@@ -8,7 +8,7 @@
#include <vector>
#ifdef __CYGWIN__
#include <sys/cygwin.h>
# include <sys/cygwin.h>
std::string CMakeToWixPath(const std::string& cygpath)
{
std::vector<char> winpath_chars;
......
......@@ -23,9 +23,9 @@
#include "cmsys/SystemTools.hxx"
#ifdef _WIN32
#include <rpc.h> // for GUID generation (windows only)
# include <rpc.h> // for GUID generation (windows only)
#else
#include <uuid/uuid.h> // for GUID generation (libuuid)
# include <uuid/uuid.h> // for GUID generation (libuuid)
#endif
#include "cmCMakeToWixPath.h"
......@@ -55,8 +55,8 @@ bool cmCPackWIXGenerator::RunWiXCommand(std::string const& command)
{
std::string logFileName = this->CPackTopLevel + "/wix.log";
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Running WiX command: " << command
<< std::endl);
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"Running WiX command: " << command << std::endl);
std::string output;
......@@ -71,7 +71,8 @@ bool cmCPackWIXGenerator::RunWiXCommand(std::string const& command)
logFile.close();
if (!status || returnValue) {
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running WiX candle. "
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Problem running WiX candle. "
"Please check '"
<< logFileName << "' for errors." << std::endl);
......@@ -137,8 +138,8 @@ bool cmCPackWIXGenerator::RunLightCommand(std::string const& objectFiles)
int cmCPackWIXGenerator::PackageFiles()
{
if (!PackageFilesImpl() || cmSystemTools::GetErrorOccuredFlag()) {
cmCPackLogger(cmCPackLog::LOG_ERROR, "Fatal WiX Generator Error"
<< std::endl);
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Fatal WiX Generator Error" << std::endl);
return false;
}
......@@ -148,8 +149,8 @@ int cmCPackWIXGenerator::PackageFiles()
bool cmCPackWIXGenerator::InitializeWiXConfiguration()
{
if (!ReadListFile("CPackWIX.cmake")) {
cmCPackLogger(cmCPackLog::LOG_ERROR, "Error while executing CPackWIX.cmake"
<< std::endl);
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Error while executing CPackWIX.cmake" << std::endl);
return false;
}
......@@ -166,9 +167,10 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration()
std::string guid = GenerateGUID();
SetOption("CPACK_WIX_UPGRADE_GUID", guid.c_str());
cmCPackLogger(
cmCPackLog::LOG_WARNING, "CPACK_WIX_UPGRADE_GUID implicitly set to "
<< guid << " . "
cmCPackLogger(cmCPackLog::LOG_WARNING,
"CPACK_WIX_UPGRADE_GUID implicitly set to "
<< guid
<< " . "
"Please refer to the documentation on how and why "
"you might want to set this explicitly."
<< std::endl);
......@@ -370,7 +372,8 @@ void cmCPackWIXGenerator::CreateWiXPropertiesIncludeFile()
includeFile.AddAttribute("Id", "FindInstallLocation");
includeFile.AddAttribute("Root", "HKLM");
includeFile.AddAttribute(
"Key", "Software\\Microsoft\\Windows\\"
"Key",
"Software\\Microsoft\\Windows\\"
"CurrentVersion\\Uninstall\\[WIX_UPGRADE_DETECTED]");
includeFile.AddAttribute("Name", "InstallLocation");
includeFile.AddAttribute("Type", "raw");
......@@ -613,8 +616,9 @@ bool cmCPackWIXGenerator::GenerateMainSourceFileFromTemplate()
std::string mainSourceFilePath = this->CPackTopLevel + "/main.wxs";
if (!ConfigureFile(wixTemplate.c_str(), mainSourceFilePath.c_str())) {
cmCPackLogger(cmCPackLog::LOG_ERROR, "Failed creating '"
<< mainSourceFilePath << "'' from template." << std::endl);
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Failed creating '" << mainSourceFilePath
<< "'' from template." << std::endl);
return false;
}
......@@ -957,8 +961,8 @@ bool cmCPackWIXGenerator::RequireOption(std::string const& name,
return true;
} else {
cmCPackLogger(cmCPackLog::LOG_ERROR, "Required variable "
<< name << " not set" << std::endl);
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Required variable " << name << " not set" << std::endl);
return false;
}
......
......@@ -66,8 +66,9 @@ void cmWIXAccessControlList::CreatePermissionElement(std::string const& entry)
void cmWIXAccessControlList::ReportError(std::string const& entry,
std::string const& message)
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Failed processing ACL entry '"
<< entry << "': " << message << std::endl);
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Failed processing ACL entry '" << entry << "': " << message
<< std::endl);
}
bool cmWIXAccessControlList::IsBooleanAttribute(std::string const& name)
......
......@@ -13,8 +13,9 @@ bool cmWIXPatch::LoadFragments(std::string const& patchFilePath)
{
cmWIXPatchParser parser(Fragments, Logger);
if (!parser.ParseFile(patchFilePath.c_str())) {
cmCPackLogger(cmCPackLog::LOG_ERROR, "Failed parsing XML patch file: '"
<< patchFilePath << "'" << std::endl);
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Failed parsing XML patch file: '" << patchFilePath << "'"
<< std::endl);
return false;
}
......
......@@ -32,7 +32,8 @@ cmWIXSourceWriter::cmWIXSourceWriter(cmCPackLog* logger,
cmWIXSourceWriter::~cmWIXSourceWriter()
{
if (Elements.size() > 1) {
cmCPackLogger(cmCPackLog::LOG_ERROR, Elements.size() - 1
cmCPackLogger(cmCPackLog::LOG_ERROR,
Elements.size() - 1
<< " WiX elements were still open when closing '"
<< SourceFilename << "'" << std::endl);
return;
......@@ -65,7 +66,8 @@ void cmWIXSourceWriter::EndElement(std::string const& name)
}
if (Elements.back() != name) {
cmCPackLogger(cmCPackLog::LOG_ERROR, "WiX element <"
cmCPackLogger(cmCPackLog::LOG_ERROR,
"WiX element <"
<< Elements.back() << "> can not be closed by </" << name
<< "> in '" << SourceFilename << "'" << std::endl);
return;
......
......@@ -87,8 +87,9 @@ int cmCPackArchiveGenerator::addOneComponentToArchive(
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Adding file: " << rp << std::endl);
archive.Add(rp, 0, nullptr, false);
if (!archive) {
cmCPackLogger(cmCPackLog::LOG_ERROR, "ERROR while packaging files: "
<< archive.GetError() << std::endl);
cmCPackLogger(cmCPackLog::LOG_ERROR,
"ERROR while packaging files: " << archive.GetError()
<< std::endl);
return 0;
}
}
......@@ -111,7 +112,8 @@ int cmCPackArchiveGenerator::addOneComponentToArchive(
} \
cmArchiveWrite archive(gf, this->Compress, this->ArchiveFormat); \
if (!(archive)) { \
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem to create archive < " \
cmCPackLogger(cmCPackLog::LOG_ERROR, \
"Problem to create archive < " \
<< (filename) << ">. ERROR =" << (archive).GetError() \
<< std::endl); \
return 0; \
......@@ -148,7 +150,8 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup)
// Does the component belong to a group?
if (comp.second.Group == nullptr) {
cmCPackLogger(
cmCPackLog::LOG_VERBOSE, "Component <"
cmCPackLog::LOG_VERBOSE,
"Component <"
<< comp.second.Name
<< "> does not belong to any group, package it separately."
<< std::endl);
......@@ -258,7 +261,8 @@ int cmCPackArchiveGenerator::PackageFiles()
std::string rp = cmSystemTools::RelativePath(toplevel, file);
archive.Add(rp, 0, nullptr, false);
if (!archive) {
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem while adding file< "
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Problem while adding file< "
<< file << "> to archive <" << packageFileNames[0]
<< "> .ERROR =" << archive.GetError() << std::endl);
return 0;
......
......@@ -32,8 +32,8 @@ int cmCPackBundleGenerator::InitializeInternal()
"codesign", std::vector<std::string>(), false);
if (codesign_path.empty()) {
cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot locate codesign command"
<< std::endl);
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Cannot locate codesign command" << std::endl);
return 0;
}
this->SetOptionIfNotSet("CPACK_COMMAND_CODESIGN", codesign_path.c_str());
......@@ -59,8 +59,8 @@ int cmCPackBundleGenerator::ConstructBundle()
? this->GetOption("CPACK_BUNDLE_NAME")
<