summaryrefslogtreecommitdiffstats
path: root/Tests/LoadCommandOneConfig
diff options
context:
space:
mode:
authorKitware Robot <kwrobot@kitware.com>2016-05-16 14:34:04 (GMT)
committerBrad King <brad.king@kitware.com>2016-05-16 20:05:19 (GMT)
commitd9fd2f5402eeaa345691313658e02b51038f570b (patch)
treedca71b9a7e267f4c6300da3eb770415381726785 /Tests/LoadCommandOneConfig
parent82df6deaafb36cbbfd450202bb20b320f637751a (diff)
downloadCMake-d9fd2f5402eeaa345691313658e02b51038f570b.zip
CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.gz
CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.bz2
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.
Diffstat (limited to 'Tests/LoadCommandOneConfig')
-rw-r--r--Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c146
1 files changed, 56 insertions, 90 deletions
diff --git a/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c b/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c
index eac121d..3558f89 100644
--- a/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c
+++ b/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c
@@ -5,63 +5,55 @@
typedef struct
{
- char *LibraryName;
+ char* LibraryName;
int Argc;
char** Argv;
} cmVTKWrapTclData;
/* do almost everything in the initial pass */
-static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[])
+static int CCONV InitialPass(void* inf, void* mf, int argc, char* argv[])
{
char* file;
char* str;
- char *srcs;
+ char* srcs;
const char* cstr;
char buffer[1024];
- void *source_file;
- char *args[2];
- char *ccArgs[4];
- char *ccDep[1];
- char *ccOut[1];
- cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf;
-
- cmVTKWrapTclData *cdata =
- (cmVTKWrapTclData *)malloc(sizeof(cmVTKWrapTclData));
+ void* source_file;
+ char* args[2];
+ char* ccArgs[4];
+ char* ccDep[1];
+ char* ccOut[1];
+ cmLoadedCommandInfo* info = (cmLoadedCommandInfo*)inf;
+
+ cmVTKWrapTclData* cdata =
+ (cmVTKWrapTclData*)malloc(sizeof(cmVTKWrapTclData));
cdata->LibraryName = "BOO";
cdata->Argc = argc;
cdata->Argv = argv;
- info->CAPI->SetClientData(info,cdata);
+ info->CAPI->SetClientData(info, cdata);
/* Now check and see if the value has been stored in the cache */
/* already, if so use that value and don't look for the program */
- if(!info->CAPI->IsOn(mf,"TEST_COMMAND_TEST1"))
- {
+ if (!info->CAPI->IsOn(mf, "TEST_COMMAND_TEST1")) {
info->CAPI->AddDefinition(mf, "TEST_DEF", "HOO");
return 1;
- }
+ }
info->CAPI->AddDefinition(mf, "TEST_DEF", "HOO");
cdata->LibraryName = "HOO";
info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE", "ON",
- "Test cache variable",
- CM_CACHE_BOOL);
+ "Test cache variable", CM_CACHE_BOOL);
info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE1", "",
- "Test cache variable 1",
- CM_CACHE_PATH);
+ "Test cache variable 1", CM_CACHE_PATH);
info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE2", "",
- "Test cache variable 2",
- CM_CACHE_FILEPATH);
+ "Test cache variable 2", CM_CACHE_FILEPATH);
info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE3", "",
- "Test cache variable 3",
- CM_CACHE_STRING);
+ "Test cache variable 3", CM_CACHE_STRING);
info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE4", "",
- "Test cache variable 4",
- CM_CACHE_INTERNAL);
+ "Test cache variable 4", CM_CACHE_INTERNAL);
info->CAPI->AddCacheDefinition(mf, "SOME_CACHE_VARIABLE5", "",
- "Test cache variable 5",
- CM_CACHE_STATIC);
-
+ "Test cache variable 5", CM_CACHE_STATIC);
file = info->CAPI->ExpandVariablesInString(mf, "${CMAKE_COMMAND}", 0, 0);
@@ -83,20 +75,17 @@ static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[])
info->CAPI->DisplaySatus(mf, info->CAPI->GetCurrentDirectory(mf));
info->CAPI->DisplaySatus(mf, info->CAPI->GetCurrentOutputDirectory(mf));
sprintf(buffer, "Cache version: %d.%d, CMake version: %d.%d",
- info->CAPI->GetCacheMajorVersion(mf),
- info->CAPI->GetCacheMinorVersion(mf),
- info->CAPI->GetMajorVersion(mf),
- info->CAPI->GetMinorVersion(mf));
+ info->CAPI->GetCacheMajorVersion(mf),
+ info->CAPI->GetCacheMinorVersion(mf),
+ info->CAPI->GetMajorVersion(mf), info->CAPI->GetMinorVersion(mf));
info->CAPI->DisplaySatus(mf, buffer);
- if ( info->CAPI->CommandExists(mf, "SET") )
- {
+ if (info->CAPI->CommandExists(mf, "SET")) {
info->CAPI->DisplaySatus(mf, "Command SET exists");
- }
- if ( info->CAPI->CommandExists(mf, "SET_FOO_BAR") )
- {
+ }
+ if (info->CAPI->CommandExists(mf, "SET_FOO_BAR")) {
info->CAPI->SetError(mf, "Command SET_FOO_BAR should not exists");
return 0;
- }
+ }
info->CAPI->AddDefineFlag(mf, "-DADDED_DEFINITION");
source_file = info->CAPI->CreateNewSourceFile(mf);
@@ -106,17 +95,14 @@ static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[])
cstr = info->CAPI->SourceFileGetFullPath(source_file);
sprintf(buffer, "Should be empty (source file full path): [%s]", cstr);
info->CAPI->DisplaySatus(mf, buffer);
- info->CAPI->DefineSourceFileProperty(mf,"SOME_PROPERTY","unused old prop",
- "This property is no longer used",
- 0);
- if ( info->CAPI->SourceFileGetPropertyAsBool(source_file, "SOME_PROPERTY") )
- {
+ info->CAPI->DefineSourceFileProperty(mf, "SOME_PROPERTY", "unused old prop",
+ "This property is no longer used", 0);
+ if (info->CAPI->SourceFileGetPropertyAsBool(source_file, "SOME_PROPERTY")) {
info->CAPI->SetError(mf, "Property SOME_PROPERTY should not be defined");
return 0;
- }
- info->CAPI->DefineSourceFileProperty(mf,"SOME_PROPERTY2","nice prop",
- "This property is for testing.",
- 0);
+ }
+ info->CAPI->DefineSourceFileProperty(mf, "SOME_PROPERTY2", "nice prop",
+ "This property is for testing.", 0);
info->CAPI->SourceFileSetProperty(source_file, "SOME_PROPERTY2", "HERE");
cstr = info->CAPI->SourceFileGetProperty(source_file, "ABSTRACT");
sprintf(buffer, "Should be 0 (source file abstract property): [%p]", cstr);
@@ -124,8 +110,8 @@ static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[])
info->CAPI->DestroySourceFile(source_file);
- srcs = argv[2];
- info->CAPI->AddExecutable(mf,"LoadedCommand",1, &srcs, 0);
+ srcs = argv[2];
+ info->CAPI->AddExecutable(mf, "LoadedCommand", 1, &srcs, 0);
/* add customs commands to generate the source file */
ccArgs[0] = "-E";
@@ -134,30 +120,19 @@ static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[])
ccArgs[3] = argv[1];
ccDep[0] = ccArgs[2];
ccOut[0] = ccArgs[3];
- info->CAPI->AddCustomCommand(mf, "LoadedCommand.cxx.in",
- file,
- 4, ccArgs,
- 1, ccDep,
- 1, ccOut,
- "LoadedCommand");
-
+ info->CAPI->AddCustomCommand(mf, "LoadedCommand.cxx.in", file, 4, ccArgs, 1,
+ ccDep, 1, ccOut, "LoadedCommand");
ccArgs[2] = argv[1];
ccArgs[3] = argv[2];
ccDep[0] = ccArgs[2];
ccOut[0] = ccArgs[3];
- info->CAPI->AddCustomCommandToOutput(mf, ccOut[0],
- file,
- 4, ccArgs,
- ccDep[0],
+ info->CAPI->AddCustomCommandToOutput(mf, ccOut[0], file, 4, ccArgs, ccDep[0],
0, 0);
-
ccArgs[1] = "echo";
ccArgs[2] = "Build has finished";
- info->CAPI->AddCustomCommandToTarget(mf, "LoadedCommand",
- file,
- 3, ccArgs,
+ info->CAPI->AddCustomCommandToTarget(mf, "LoadedCommand", file, 3, ccArgs,
CM_POST_BUILD);
info->CAPI->Free(file);
@@ -166,45 +141,40 @@ static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[])
args[1] = "TRUE";
/* code coverage */
- if (info->CAPI->GetTotalArgumentSize(2,args) != 13)
- {
+ if (info->CAPI->GetTotalArgumentSize(2, args) != 13) {
return 0;
- }
- info->CAPI->ExecuteCommand(mf,"SET",2,args);
+ }
+ info->CAPI->ExecuteCommand(mf, "SET", 2, args);
/* make sure we can find the source file */
- if (!info->CAPI->GetSource(mf,argv[1]))
- {
+ if (!info->CAPI->GetSource(mf, argv[1])) {
info->CAPI->SetError(mf, "Source file could not be found!");
return 0;
- }
+ }
return 1;
}
-static void CCONV FinalPass(void *inf, void *mf)
+static void CCONV FinalPass(void* inf, void* mf)
{
- cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf;
+ cmLoadedCommandInfo* info = (cmLoadedCommandInfo*)inf;
/* get our client data from initial pass */
- cmVTKWrapTclData *cdata =
- (cmVTKWrapTclData *)info->CAPI->GetClientData(info);
- if (strcmp(info->CAPI->GetDefinition(mf, "TEST_DEF"),"HOO") ||
- strcmp(cdata->LibraryName,"HOO"))
- {
- fprintf(stderr,"*** Failed LOADED COMMAND Final Pass\n");
- }
+ cmVTKWrapTclData* cdata = (cmVTKWrapTclData*)info->CAPI->GetClientData(info);
+ if (strcmp(info->CAPI->GetDefinition(mf, "TEST_DEF"), "HOO") ||
+ strcmp(cdata->LibraryName, "HOO")) {
+ fprintf(stderr, "*** Failed LOADED COMMAND Final Pass\n");
+ }
}
-static void CCONV Destructor(void *inf)
+static void CCONV Destructor(void* inf)
{
- cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf;
+ cmLoadedCommandInfo* info = (cmLoadedCommandInfo*)inf;
/* get our client data from initial pass */
- cmVTKWrapTclData *cdata =
- (cmVTKWrapTclData *)info->CAPI->GetClientData(info);
+ cmVTKWrapTclData* cdata = (cmVTKWrapTclData*)info->CAPI->GetClientData(info);
free(cdata);
}
#ifdef MUCHO_MUDSLIDE
-void CM_PLUGIN_EXPORT CCONV CMAKE_TEST_COMMANDInit(cmLoadedCommandInfo *info)
+void CM_PLUGIN_EXPORT CCONV CMAKE_TEST_COMMANDInit(cmLoadedCommandInfo* info)
{
info->InitialPass = InitialPass;
info->FinalPass = FinalPass;
@@ -213,7 +183,3 @@ void CM_PLUGIN_EXPORT CCONV CMAKE_TEST_COMMANDInit(cmLoadedCommandInfo *info)
info->Name = "CMAKE_TEST_COMMAND";
}
#endif
-
-
-
-