Commit d9fd2f54 authored by Kitware Robot's avatar Kitware Robot Committed by Brad King
Browse files

Revise C++ coding style using clang-format

Run the `Utilities/Scripts/clang-format.bash` script to update
all our C++ code to a new style defined by `.clang-format`.
Use `clang-format` version 3.8.

* 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 82df6dea
#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"
#ifdef __CLASSIC_C__
int main(argc, argv) int argc; char *argv[];
int main(argc, argv) int argc;
char* argv[];
#else
int main(int argc, char *argv[])
int main(int argc, char* argv[])
#endif
{
int require = 0;
......
#ifndef __cplusplus
# error "A C compiler has been selected for C++."
#error "A C compiler has been selected for C++."
#endif
#include "CMakeCompilerABI.h"
int main(int argc, char* argv[])
{
int require = 0;
......
/* Size of a pointer-to-data in bytes. */
#define SIZEOF_DPTR (sizeof(void*))
const char info_sizeof_dptr[] = {
'I', 'N', 'F', 'O', ':', 's', 'i', 'z', 'e', 'o', 'f', '_', 'd', 'p', 't', 'r', '[',
('0' + ((SIZEOF_DPTR / 10)%10)),
('0' + (SIZEOF_DPTR % 10)),
']','\0'
const char info_sizeof_dptr[] = {
'I', 'N', 'F', 'O', ':', 's', 'i', 'z', 'e', 'o', 'f', '_', 'd', 'p', 't',
'r', '[', ('0' + ((SIZEOF_DPTR / 10) % 10)), ('0' + (SIZEOF_DPTR % 10)), ']',
'\0'
/* clang-format needs this comment to break after the opening brace */
};
/* 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(__ELF__)
# define ABI_ID "ELF"
#define ABI_ID "ELF"
#endif
#if defined(ABI_ID)
......
......@@ -6,11 +6,13 @@ void* runner(void*);
int res = 0;
#ifdef __CLASSIC_C__
int main(){
int main()
{
int ac;
char*av[];
char* av[];
#else
int main(int ac, char*av[]){
int main(int ac, char* av[])
{
#endif
pthread_t tid[2];
pthread_create(&tid[0], 0, runner, (void*)1);
......@@ -22,17 +24,18 @@ int main(int ac, char*av[]){
pthread_join(tid[0], 0);
pthread_join(tid[1], 0);
if(ac > 1000){return *av[0];}
if (ac > 1000) {
return *av[0];
}
return res;
}
void* runner(void* args)
{
int cc;
for ( cc = 0; cc < 10; cc ++ )
{
for (cc = 0; cc < 10; cc++) {
printf("%p CC: %d\n", args, cc);
}
res ++;
}
res++;
return 0;
}
......@@ -3,24 +3,26 @@
#ifdef __cplusplus
extern "C"
#endif
char CHECK_FUNCTION_EXISTS();
char
CHECK_FUNCTION_EXISTS();
#ifdef __CLASSIC_C__
int main(){
int main()
{
int ac;
char*av[];
char* av[];
#else
int main(int ac, char*av[]){
int main(int ac, char* av[])
{
#endif
CHECK_FUNCTION_EXISTS();
if(ac > 1000)
{
if (ac > 1000) {
return *av[0];
}
}
return 0;
}
#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 */
......@@ -3,18 +3,22 @@
extern int CHECK_VARIABLE_EXISTS;
#ifdef __CLASSIC_C__
int main(){
int main()
{
int ac;
char*av[];
char* av[];
#else
int main(int ac, char*av[]){
int main(int ac, char* av[])
{
#endif
if(ac > 1000){return *av[0];}
if (ac > 1000) {
return *av[0];
}
return CHECK_VARIABLE_EXISTS;
}
#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 */
void my_module_(void) {}
void my_module_(void)
{
}
void mymodule_(void) {}
void mymodule_(void)
{
}
#include <iostream>
int main(int,char *[])
int main(int, char* [])
{
return 0;
}
int main(int, char*[])
int main(int, char* [])
{
int i;
for(int i=0; i < 1; ++i);
for (int i = 0; i < 1; ++i)
;
(void)i;
return 0;
}
#include <sstream>
int main(int, char*[])
int main(int, char* [])
{
std::ostringstream os;
os << "12345";
if(os.str().size() == 5)
{
if (os.str().size() == 5) {
return 0;
}
}
return -1;
}
#include <list>
int main(int, char*[])
int main(int, char* [])
{
std::list<int>();
return 0;
......
This diff is collapsed.
......@@ -49,17 +49,17 @@ public:
/**
* Compare \a version with QtIFW framework version
*/
bool IsVersionLess(const char *version);
bool IsVersionLess(const char* version);
/**
* Compare \a version with QtIFW framework version
*/
bool IsVersionGreater(const char *version);
bool IsVersionGreater(const char* version);
/**
* Compare \a version with QtIFW framework version
*/
bool IsVersionEqual(const char *version);
bool IsVersionEqual(const char* version);
protected:
// cmCPackGenerator reimplementation
......@@ -90,9 +90,8 @@ protected:
*
* @return Pointer to component
*/
virtual cmCPackComponent* GetComponent(
const std::string& projectName,
const std::string& componentName);
virtual cmCPackComponent* GetComponent(const std::string& projectName,
const std::string& componentName);
/**
* @brief Get group of component
......@@ -104,8 +103,7 @@ protected:
* @return Pointer to component group
*/
virtual cmCPackComponentGroup* GetComponentGroup(
const std::string& projectName,
const std::string& groupName);
const std::string& projectName, const std::string& groupName);
enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir() const;
virtual bool SupportsAbsoluteDestination() const;
......@@ -118,11 +116,11 @@ protected:
std::string GetRootPackageName();
std::string GetGroupPackageName(cmCPackComponentGroup *group) const;
std::string GetComponentPackageName(cmCPackComponent *component) const;
std::string GetGroupPackageName(cmCPackComponentGroup* group) const;
std::string GetComponentPackageName(cmCPackComponent* component) const;
cmCPackIFWPackage* GetGroupPackage(cmCPackComponentGroup *group) const;
cmCPackIFWPackage* GetComponentPackage(cmCPackComponent *component) const;
cmCPackIFWPackage* GetGroupPackage(cmCPackComponentGroup* group) const;
cmCPackIFWPackage* GetComponentPackage(cmCPackComponent* component) const;
void WriteGeneratedByToStrim(cmXMLWriter& xout);
......
......@@ -20,310 +20,239 @@
#include <cmXMLWriter.h>
#ifdef cmCPackLogger
# undef cmCPackLogger
#undef cmCPackLogger
#endif
#define cmCPackLogger(logType, msg) \
do { \
std::ostringstream cmCPackLog_msg; \
cmCPackLog_msg << msg; \
if(Generator) { \
Generator->Logger->Log(logType, __FILE__, __LINE__, \
cmCPackLog_msg.str().c_str()); \
} \
} while ( 0 )
cmCPackIFWInstaller::cmCPackIFWInstaller() :
Generator(0)
#define cmCPackLogger(logType, msg) \
do { \
std::ostringstream cmCPackLog_msg; \
cmCPackLog_msg << msg; \
if (Generator) { \
Generator->Logger->Log(logType, __FILE__, __LINE__, \
cmCPackLog_msg.str().c_str()); \
} \
} while (0)
cmCPackIFWInstaller::cmCPackIFWInstaller()
: Generator(0)
{
}
const char *cmCPackIFWInstaller::GetOption(const std::string &op) const
const char* cmCPackIFWInstaller::GetOption(const std::string& op) const
{
return Generator ? Generator->GetOption(op) : 0;
}
bool cmCPackIFWInstaller::IsOn(const std::string &op) const
bool cmCPackIFWInstaller::IsOn(const std::string& op) const
{
return Generator ? Generator->IsOn(op) : false;
}
bool cmCPackIFWInstaller::IsVersionLess(const char *version)
bool cmCPackIFWInstaller::IsVersionLess(const char* version)
{
return Generator ? Generator->IsVersionLess(version) : false;
}
bool cmCPackIFWInstaller::IsVersionGreater(const char *version)
bool cmCPackIFWInstaller::IsVersionGreater(const char* version)
{
return Generator ? Generator->IsVersionGreater(version) : false;
}
bool cmCPackIFWInstaller::IsVersionEqual(const char *version)
bool cmCPackIFWInstaller::IsVersionEqual(const char* version)
{
return Generator ? Generator->IsVersionEqual(version) : false;
}
void cmCPackIFWInstaller::ConfigureFromOptions()
{
// Name;
if (const char* optIFW_PACKAGE_NAME =
this->GetOption("CPACK_IFW_PACKAGE_NAME"))
{
this->GetOption("CPACK_IFW_PACKAGE_NAME")) {
Name = optIFW_PACKAGE_NAME;
}
else if (const char* optPACKAGE_NAME =
this->GetOption("CPACK_PACKAGE_NAME"))
{
} else if (const char* optPACKAGE_NAME =
this->GetOption("CPACK_PACKAGE_NAME")) {
Name = optPACKAGE_NAME;
}
else
{
} else {
Name = "Your package";
}
}
// Title;
if (const char* optIFW_PACKAGE_TITLE =
GetOption("CPACK_IFW_PACKAGE_TITLE"))
{
GetOption("CPACK_IFW_PACKAGE_TITLE")) {
Title = optIFW_PACKAGE_TITLE;
}
else if (const char* optPACKAGE_DESCRIPTION_SUMMARY =
GetOption("CPACK_PACKAGE_DESCRIPTION_SUMMARY"))
{
} else if (const char* optPACKAGE_DESCRIPTION_SUMMARY =
GetOption("CPACK_PACKAGE_DESCRIPTION_SUMMARY")) {
Title = optPACKAGE_DESCRIPTION_SUMMARY;
}
else
{
} else {
Title = "Your package description";
}
}
// Version;
if (const char* option = GetOption("CPACK_PACKAGE_VERSION"))
{
if (const char* option = GetOption("CPACK_PACKAGE_VERSION")) {
Version = option;
}
else
{
} else {
Version = "1.0.0";
}
}
// Publisher
if(const char* optIFW_PACKAGE_PUBLISHER =
GetOption("CPACK_IFW_PACKAGE_PUBLISHER"))
{
if (const char* optIFW_PACKAGE_PUBLISHER =
GetOption("CPACK_IFW_PACKAGE_PUBLISHER")) {
Publisher = optIFW_PACKAGE_PUBLISHER;
}
else if(const char* optPACKAGE_VENDOR = GetOption("CPACK_PACKAGE_VENDOR"))
{
} else if (const char* optPACKAGE_VENDOR =
GetOption("CPACK_PACKAGE_VENDOR")) {
Publisher = optPACKAGE_VENDOR;
}
}
// ProductUrl
if(const char* option = GetOption("CPACK_IFW_PRODUCT_URL"))
{
if (const char* option = GetOption("CPACK_IFW_PRODUCT_URL")) {
ProductUrl = option;
}
}
// ApplicationIcon
if(const char* option = GetOption("CPACK_IFW_PACKAGE_ICON"))
{
if(cmSystemTools::FileExists(option))
{
if (const char* option = GetOption("CPACK_IFW_PACKAGE_ICON")) {
if (cmSystemTools::FileExists(option)) {
InstallerApplicationIcon = option;
}
else
{
} else {
// TODO: implement warning
}
}
}
// WindowIcon
if(const char* option = GetOption("CPACK_IFW_PACKAGE_WINDOW_ICON"))
{
if(cmSystemTools::FileExists(option))
{
if (const char* option = GetOption("CPACK_IFW_PACKAGE_WINDOW_ICON")) {
if (cmSystemTools::FileExists(option)) {
InstallerWindowIcon = option;
}
else
{
} else {
// TODO: implement warning
}
}
}
// Logo
if(const char* option = GetOption("CPACK_IFW_PACKAGE_LOGO"))
{
if(cmSystemTools::FileExists(option))
{
if (const char* option = GetOption("CPACK_IFW_PACKAGE_LOGO")) {
if (cmSystemTools::FileExists(option)) {
Logo = option;
}
else
{
} else {
// TODO: implement warning
}
}
}
// Start menu
if (const char* optIFW_START_MENU_DIR =
this->GetOption("CPACK_IFW_PACKAGE_START_MENU_DIRECTORY"))
{
this->GetOption("CPACK_IFW_PACKAGE_START_MENU_DIRECTORY")) {
StartMenuDir = optIFW_START_MENU_DIR;
}
else
{
} else {
StartMenuDir = Name;
}
}
// Default target directory for installation
if (const char* optIFW_TARGET_DIRECTORY =
GetOption("CPACK_IFW_TARGET_DIRECTORY"))
{
GetOption("CPACK_IFW_TARGET_DIRECTORY")) {
TargetDir = optIFW_TARGET_DIRECTORY;
}
else if (const char *optPACKAGE_INSTALL_DIRECTORY =
GetOption("CPACK_PACKAGE_INSTALL_DIRECTORY"))
{
} else if (const char* optPACKAGE_INSTALL_DIRECTORY =
GetOption("CPACK_PACKAGE_INSTALL_DIRECTORY")) {
TargetDir = "@ApplicationsDir@/";
TargetDir += optPACKAGE_INSTALL_DIRECTORY;
}
else
{
} else {
TargetDir = "@RootDir@/usr/local";
}
}
// Default target directory for installation with administrator rights
if (const char* option = GetOption("CPACK_IFW_ADMIN_TARGET_DIRECTORY"))
{
if (const char* option = GetOption("CPACK_IFW_ADMIN_TARGET_DIRECTORY")) {
AdminTargetDir = option;
}
}
// Repositories
Repositories.clear();
RepositoryStruct Repo;
if(const char *site = this->GetOption("CPACK_DOWNLOAD_SITE"))
{
if (const char* site = this->GetOption("CPACK_DOWNLOAD_SITE")) {
Repo.Url = site;
Repositories.push_back(Repo);
}
if(const char *RepoAllStr = this->GetOption("CPACK_IFW_REPOSITORIES_ALL"))
{
}
if (const char* RepoAllStr = this->GetOption("CPACK_IFW_REPOSITORIES_ALL")) {
std::vector<std::string> RepoAllVector;
cmSystemTools::ExpandListArgument(RepoAllStr,
RepoAllVector);
for(std::vector<std::string>::iterator
rit = RepoAllVector.begin(); rit != RepoAllVector.end(); ++rit)
{
std::string prefix = "CPACK_IFW_REPOSITORY_"
+ cmsys::SystemTools::UpperCase(*rit)
+ "_";
// Url
if (const char* url = GetOption(prefix + "URL"))
{
Repo.Url = url;
}
else
{
Repo.Url = "";
}
// Enabled
if (IsOn(prefix + "DISABLED"))
{
Repo.Enabled = "0";
}
else
{
Repo.Enabled = "";
}
// Username
if (const char* username = GetOption(prefix + "USERNAME"))
{
Repo.Username = username;
}
else
{
Repo.Username = "";
}
// Password
if (const char* password = GetOption(prefix + "PASSWORD"))
{
Repo.Password = password;
}
else
{
Repo.Password = "";
}
// DisplayName
if (const char* displayName = GetOption(prefix + "DISPLAY_NAME"))
{
Repo.DisplayName = displayName;
}
else