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 #ifdef __cplusplus
#error "A C++ compiler has been selected for C." # error "A C++ compiler has been selected for C."
#endif #endif
#ifdef __CLASSIC_C__ #ifdef __CLASSIC_C__
#define const # define const
#endif #endif
#include "CMakeCompilerABI.h" #include "CMakeCompilerABI.h"
......
#ifndef __CUDACC__ #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 #endif
#include "CMakeCompilerABI.h" #include "CMakeCompilerABI.h"
......
#ifndef __cplusplus #ifndef __cplusplus
#error "A C compiler has been selected for C++." # error "A C compiler has been selected for C++."
#endif #endif
#include "CMakeCompilerABI.h" #include "CMakeCompilerABI.h"
......
...@@ -11,27 +11,27 @@ const char info_sizeof_dptr[] = { ...@@ -11,27 +11,27 @@ const char info_sizeof_dptr[] = {
/* Application Binary Interface. */ /* Application Binary Interface. */
#if defined(__sgi) && defined(_ABIO32) #if defined(__sgi) && defined(_ABIO32)
#define ABI_ID "ELF O32" # define ABI_ID "ELF O32"
#elif defined(__sgi) && defined(_ABIN32) #elif defined(__sgi) && defined(_ABIN32)
#define ABI_ID "ELF N32" # define ABI_ID "ELF N32"
#elif defined(__sgi) && defined(_ABI64) #elif defined(__sgi) && defined(_ABI64)
#define ABI_ID "ELF 64" # define ABI_ID "ELF 64"
/* Check for (some) ARM ABIs. /* Check for (some) ARM ABIs.
* See e.g. http://wiki.debian.org/ArmEabiPort for some information on this. */ * See e.g. http://wiki.debian.org/ArmEabiPort for some information on this. */
#elif defined(__GNU__) && defined(__ELF__) && defined(__ARM_EABI__) #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__) #elif defined(__GNU__) && defined(__ELF__) && defined(__ARMEB__)
#define ABI_ID "ELF ARM" # define ABI_ID "ELF ARM"
#elif defined(__GNU__) && defined(__ELF__) && defined(__ARMEL__) #elif defined(__GNU__) && defined(__ELF__) && defined(__ARMEL__)
#define ABI_ID "ELF ARM" # define ABI_ID "ELF ARM"
#elif defined(__linux__) && defined(__ELF__) && defined(__amd64__) && \ #elif defined(__linux__) && defined(__ELF__) && defined(__amd64__) && \
defined(__ILP32__) defined(__ILP32__)
#define ABI_ID "ELF X32" # define ABI_ID "ELF X32"
#elif defined(__ELF__) #elif defined(__ELF__)
#define ABI_ID "ELF" # define ABI_ID "ELF"
#endif #endif
#if defined(ABI_ID) #if defined(ABI_ID)
......
#ifdef CHECK_FUNCTION_EXISTS #ifdef CHECK_FUNCTION_EXISTS
#ifdef __cplusplus # ifdef __cplusplus
extern "C" extern "C"
#endif # endif
char char
CHECK_FUNCTION_EXISTS(void); CHECK_FUNCTION_EXISTS(void);
#ifdef __CLASSIC_C__ # ifdef __CLASSIC_C__
int main() int main()
{ {
int ac; int ac;
char* av[]; char* av[];
#else # else
int main(int ac, char* av[]) int main(int ac, char* av[])
{ {
#endif # endif
CHECK_FUNCTION_EXISTS(); CHECK_FUNCTION_EXISTS();
if (ac > 1000) { if (ac > 1000) {
return *av[0]; return *av[0];
...@@ -23,6 +23,6 @@ int main(int ac, char* av[]) ...@@ -23,6 +23,6 @@ int main(int ac, char* av[])
#else /* CHECK_FUNCTION_EXISTS */ #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 */ #endif /* CHECK_FUNCTION_EXISTS */
...@@ -2,15 +2,15 @@ ...@@ -2,15 +2,15 @@
extern int CHECK_VARIABLE_EXISTS; extern int CHECK_VARIABLE_EXISTS;
#ifdef __CLASSIC_C__ # ifdef __CLASSIC_C__
int main() int main()
{ {
int ac; int ac;
char* av[]; char* av[];
#else # else
int main(int ac, char* av[]) int main(int ac, char* av[])
{ {
#endif # endif
if (ac > 1000) { if (ac > 1000) {
return *av[0]; return *av[0];
} }
...@@ -19,6 +19,6 @@ int main(int ac, char* av[]) ...@@ -19,6 +19,6 @@ int main(int ac, char* av[])
#else /* CHECK_VARIABLE_EXISTS */ #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 */ #endif /* CHECK_VARIABLE_EXISTS */
#include <mpi.h> #include <mpi.h>
#ifdef __cplusplus #ifdef __cplusplus
#include <cstdio> # include <cstdio>
#else #else
#include <stdio.h> # include <stdio.h>
#endif #endif
int main(int argc, char* argv[]) int main(int argc, char* argv[])
......
#include <mpi.h> #include <mpi.h>
#ifdef __cplusplus #ifdef __cplusplus
#include <cstdio> # include <cstdio>
#else #else
#include <stdio.h> # include <stdio.h>
#endif #endif
#if defined(MPI_VERSION) && defined(MPI_SUBVERSION) #if defined(MPI_VERSION) && defined(MPI_SUBVERSION)
...@@ -21,11 +21,11 @@ const char mpiver_str[] = { 'I', 'N', ...@@ -21,11 +21,11 @@ const char mpiver_str[] = { 'I', 'N',
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
#if defined(MPI_VERSION) && defined(MPI_SUBVERSION) #if defined(MPI_VERSION) && defined(MPI_SUBVERSION)
#ifdef __cplusplus # ifdef __cplusplus
std::puts(mpiver_str); std::puts(mpiver_str);
#else # else
puts(mpiver_str); puts(mpiver_str);
#endif # endif
#endif #endif
#ifdef TEST_MPI_MPICXX #ifdef TEST_MPI_MPICXX
MPI::MPI_Init(&argc, &argv); MPI::MPI_Init(&argc, &argv);
......
...@@ -61,7 +61,8 @@ int cmCPackIFWGenerator::PackageFiles() ...@@ -61,7 +61,8 @@ int cmCPackIFWGenerator::PackageFiles()
ifwCmd += " --repository " + rd; ifwCmd += " --repository " + rd;
} }
} else { } else {
cmCPackIFWLogger(WARNING, "The \"CPACK_IFW_REPOSITORIES_DIRECTORIES\" " cmCPackIFWLogger(WARNING,
"The \"CPACK_IFW_REPOSITORIES_DIRECTORIES\" "
<< "variable is set, but content will be skipped, " << "variable is set, but content will be skipped, "
<< "because this feature available only since " << "because this feature available only since "
<< "QtIFW 3.1. Please update your QtIFW instance." << "QtIFW 3.1. Please update your QtIFW instance."
...@@ -93,7 +94,8 @@ int cmCPackIFWGenerator::PackageFiles() ...@@ -93,7 +94,8 @@ int cmCPackIFWGenerator::PackageFiles()
ofs << "# Run command: " << ifwCmd << std::endl ofs << "# Run command: " << ifwCmd << std::endl
<< "# Output:" << std::endl << "# Output:" << std::endl
<< output << std::endl; << output << std::endl;
cmCPackIFWLogger(ERROR, "Problem running IFW command: " cmCPackIFWLogger(ERROR,
"Problem running IFW command: "
<< ifwCmd << std::endl << ifwCmd << std::endl
<< "Please check " << ifwTmpFile << " for errors" << "Please check " << ifwTmpFile << " for errors"
<< std::endl); << std::endl);
...@@ -102,15 +104,16 @@ int cmCPackIFWGenerator::PackageFiles() ...@@ -102,15 +104,16 @@ int cmCPackIFWGenerator::PackageFiles()
if (!this->Repository.RepositoryUpdate.empty() && if (!this->Repository.RepositoryUpdate.empty() &&
!this->Repository.PatchUpdatesXml()) { !this->Repository.PatchUpdatesXml()) {
cmCPackIFWLogger(WARNING, "Problem patch IFW \"Updates\" " cmCPackIFWLogger(WARNING,
"Problem patch IFW \"Updates\" "
<< "file: " << "file: "
<< this->toplevel + "/repository/Updates.xml" << this->toplevel + "/repository/Updates.xml"
<< std::endl); << std::endl);
} }
cmCPackIFWLogger(OUTPUT, "- repository: " << this->toplevel cmCPackIFWLogger(OUTPUT,
<< "/repository generated" "- repository: " << this->toplevel
<< std::endl); << "/repository generated" << std::endl);
} }
// Run binary creator // Run binary creator
...@@ -145,7 +148,8 @@ int cmCPackIFWGenerator::PackageFiles() ...@@ -145,7 +148,8 @@ int cmCPackIFWGenerator::PackageFiles()
ifwCmd += " --repository " + rd; ifwCmd += " --repository " + rd;
} }
} else { } else {
cmCPackIFWLogger(WARNING, "The \"CPACK_IFW_REPOSITORIES_DIRECTORIES\" " cmCPackIFWLogger(WARNING,
"The \"CPACK_IFW_REPOSITORIES_DIRECTORIES\" "
<< "variable is set, but content will be skipped, " << "variable is set, but content will be skipped, "
<< "because this feature available only since " << "because this feature available only since "
<< "QtIFW 3.1. Please update your QtIFW instance." << "QtIFW 3.1. Please update your QtIFW instance."
...@@ -203,7 +207,8 @@ int cmCPackIFWGenerator::PackageFiles() ...@@ -203,7 +207,8 @@ int cmCPackIFWGenerator::PackageFiles()
ofs << "# Run command: " << ifwCmd << std::endl ofs << "# Run command: " << ifwCmd << std::endl
<< "# Output:" << std::endl << "# Output:" << std::endl
<< output << std::endl; << output << std::endl;
cmCPackIFWLogger(ERROR, "Problem running IFW command: " cmCPackIFWLogger(ERROR,
"Problem running IFW command: "
<< ifwCmd << std::endl << ifwCmd << std::endl
<< "Please check " << ifwTmpFile << " for errors" << "Please check " << ifwTmpFile << " for errors"
<< std::endl); << std::endl);
...@@ -257,8 +262,9 @@ int cmCPackIFWGenerator::InitializeInternal() ...@@ -257,8 +262,9 @@ int cmCPackIFWGenerator::InitializeInternal()
} }
if (this->BinCreator.empty()) { if (this->BinCreator.empty()) {
cmCPackIFWLogger(ERROR, "Cannot find QtIFW compiler \"binarycreator\": " cmCPackIFWLogger(ERROR,
"likely it is not installed, or not in your PATH" "Cannot find QtIFW compiler \"binarycreator\": "
"likely it is not installed, or not in your PATH"
<< std::endl); << std::endl);
return 0; return 0;
} }
...@@ -415,7 +421,8 @@ cmCPackComponent* cmCPackIFWGenerator::GetComponent( ...@@ -415,7 +421,8 @@ cmCPackComponent* cmCPackIFWGenerator::GetComponent(
} }
} else { } else {
this->Packages.erase(name); this->Packages.erase(name);
cmCPackIFWLogger(ERROR, "Cannot configure package \"" cmCPackIFWLogger(ERROR,
"Cannot configure package \""
<< name << "\" for component \"" << component->Name << name << "\" for component \"" << component->Name
<< "\"" << std::endl); << "\"" << std::endl);
} }
...@@ -450,7 +457,8 @@ cmCPackComponentGroup* cmCPackIFWGenerator::GetComponentGroup( ...@@ -450,7 +457,8 @@ cmCPackComponentGroup* cmCPackIFWGenerator::GetComponentGroup(
this->BinaryPackages.insert(package); this->BinaryPackages.insert(package);
} else { } else {
this->Packages.erase(name); this->Packages.erase(name);
cmCPackIFWLogger(ERROR, "Cannot configure package \"" cmCPackIFWLogger(ERROR,
"Cannot configure package \""
<< name << "\" for component group \"" << group->Name << name << "\" for component group \"" << group->Name
<< "\"" << std::endl); << "\"" << std::endl);
} }
...@@ -596,7 +604,8 @@ cmCPackIFWRepository* cmCPackIFWGenerator::GetRepository( ...@@ -596,7 +604,8 @@ cmCPackIFWRepository* cmCPackIFWGenerator::GetRepository(
} else { } else {
this->Repositories.erase(repositoryName); this->Repositories.erase(repositoryName);
repository = nullptr; repository = nullptr;
cmCPackIFWLogger(WARNING, "Invalid repository \"" cmCPackIFWLogger(WARNING,
"Invalid repository \""
<< repositoryName << "\"" << repositoryName << "\""
<< " configuration. Repository will be skipped." << " configuration. Repository will be skipped."
<< std::endl); << std::endl);
......
...@@ -22,7 +22,9 @@ ...@@ -22,7 +22,9 @@
* *
* http://qt-project.org/doc/qtinstallerframework/index.html * http://qt-project.org/doc/qtinstallerframework/index.html
*/ */
class cmCPackIFWGenerator : public cmCPackGenerator, public cmCPackIFWCommon class cmCPackIFWGenerator
: public cmCPackGenerator
, public cmCPackIFWCommon
{ {
public: public:
cmCPackTypeMacro(cmCPackIFWGenerator, cmCPackGenerator); cmCPackTypeMacro(cmCPackIFWGenerator, cmCPackGenerator);
......
...@@ -24,7 +24,8 @@ void cmCPackIFWInstaller::printSkippedOptionWarning( ...@@ -24,7 +24,8 @@ void cmCPackIFWInstaller::printSkippedOptionWarning(
const std::string& optionName, const std::string& optionValue) const std::string& optionName, const std::string& optionValue)
{ {
cmCPackIFWLogger( cmCPackIFWLogger(
WARNING, "Option " WARNING,
"Option "
<< optionName << " is set to \"" << optionValue << optionName << " is set to \"" << optionValue
<< "\" but will be skipped because the specified file does not exist." << "\" but will be skipped because the specified file does not exist."
<< std::endl); << std::endl);
...@@ -146,7 +147,8 @@ void cmCPackIFWInstaller::ConfigureFromOptions() ...@@ -146,7 +147,8 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
if (this->WizardStyle != "Modern" && this->WizardStyle != "Aero" && if (this->WizardStyle != "Modern" && this->WizardStyle != "Aero" &&
this->WizardStyle != "Mac" && this->WizardStyle != "Classic") { this->WizardStyle != "Mac" && this->WizardStyle != "Classic") {
cmCPackIFWLogger( 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." << option << "\". Expected values are: Modern, Aero, Mac, Classic."
<< std::endl); << std::endl);
} }
...@@ -469,7 +471,8 @@ void cmCPackIFWInstaller::GenerateInstallerFile() ...@@ -469,7 +471,8 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
cmsys::SystemTools::CopyFileIfDifferent(this->Resources[i], path); cmsys::SystemTools::CopyFileIfDifferent(this->Resources[i], path);
resources.push_back(std::move(name)); resources.push_back(std::move(name));
} else { } else {
cmCPackIFWLogger(WARNING, "Can't copy resources from \"" cmCPackIFWLogger(WARNING,
"Can't copy resources from \""
<< this->Resources[i] << this->Resources[i]
<< "\". Resource will be skipped." << std::endl); << "\". Resource will be skipped." << std::endl);
} }
......
...@@ -226,7 +226,8 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component) ...@@ -226,7 +226,8 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component)
if (const char* option = this->GetOption(prefix + "PRIORITY")) { if (const char* option = this->GetOption(prefix + "PRIORITY")) {
this->SortingPriority = option; this->SortingPriority = option;
cmCPackIFWLogger( cmCPackIFWLogger(
WARNING, "The \"PRIORITY\" option is set " WARNING,
"The \"PRIORITY\" option is set "
<< "for component \"" << component->Name << "\", but there option is " << "for component \"" << component->Name << "\", but there option is "
<< "deprecated. Please use \"SORTING_PRIORITY\" option instead." << "deprecated. Please use \"SORTING_PRIORITY\" option instead."
<< std::endl); << std::endl);
...@@ -303,7 +304,8 @@ int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group) ...@@ -303,7 +304,8 @@ int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group)
if (const char* option = this->GetOption(prefix + "PRIORITY")) { if (const char* option = this->GetOption(prefix + "PRIORITY")) {
this->SortingPriority = option; this->SortingPriority = option;
cmCPackIFWLogger( cmCPackIFWLogger(
WARNING, "The \"PRIORITY\" option is set " WARNING,
"The \"PRIORITY\" option is set "
<< "for component group \"" << group->Name << "for component group \"" << group->Name
<< "\", but there option is " << "\", but there option is "
<< "deprecated. Please use \"SORTING_PRIORITY\" option instead." << "deprecated. Please use \"SORTING_PRIORITY\" option instead."
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <vector> #include <vector>
#ifdef __CYGWIN__ #ifdef __CYGWIN__
#include <sys/cygwin.h> # include <sys/cygwin.h>
std::string CMakeToWixPath(const std::string& cygpath) std::string CMakeToWixPath(const std::string& cygpath)
{ {
std::vector<char> winpath_chars; std::vector<char> winpath_chars;
......
...@@ -23,9 +23,9 @@ ...@@ -23,9 +23,9 @@
#include "cmsys/SystemTools.hxx" #include "cmsys/SystemTools.hxx"
#ifdef _WIN32 #ifdef _WIN32
#include <rpc.h> // for GUID generation (windows only) # include <rpc.h> // for GUID generation (windows only)
#else #else
#include <uuid/uuid.h> // for GUID generation (libuuid) # include <uuid/uuid.h> // for GUID generation (libuuid)
#endif #endif
#include "cmCMakeToWixPath.h" #include "cmCMakeToWixPath.h"
...@@ -55,8 +55,8 @@ bool cmCPackWIXGenerator::RunWiXCommand(std::string const& command) ...@@ -55,8 +55,8 @@ bool cmCPackWIXGenerator::RunWiXCommand(std::string const& command)
{ {
std::string logFileName = this->CPackTopLevel + "/wix.log"; std::string logFileName = this->CPackTopLevel + "/wix.log";
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Running WiX command: " << command cmCPackLogger(cmCPackLog::LOG_DEBUG,
<< std::endl); "Running WiX command: " << command << std::endl);
std::string output; std::string output;
...@@ -71,8 +71,9 @@ bool cmCPackWIXGenerator::RunWiXCommand(std::string const& command) ...@@ -71,8 +71,9 @@ bool cmCPackWIXGenerator::RunWiXCommand(std::string const& command)
logFile.close(); logFile.close();
if (!status || returnValue) { if (!status || returnValue) {
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running WiX candle. " cmCPackLogger(cmCPackLog::LOG_ERROR,
"Please check '" "Problem running WiX candle. "
"Please check '"
<< logFileName << "' for errors." << std::endl); << logFileName << "' for errors." << std::endl);
return false; return false;
...@@ -137,8 +138,8 @@ bool cmCPackWIXGenerator::RunLightCommand(std::string const& objectFiles) ...@@ -137,8 +138,8 @@ bool cmCPackWIXGenerator::RunLightCommand(std::string const& objectFiles)
int cmCPackWIXGenerator::PackageFiles() int cmCPackWIXGenerator::PackageFiles()
{ {
if (!PackageFilesImpl() || cmSystemTools::GetErrorOccuredFlag()) {