summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2023-11-23 07:45:05 (GMT)
committerBrad King <brad.king@kitware.com>2024-01-25 19:35:01 (GMT)
commita10d2ad39792a7550c00cd4d351b583b7e61a434 (patch)
tree1a0d28f521341f09aedf089f3eee90be3d0bb9ab /Tests
parent151601c2e3419bd65bb276e77588c551487b4744 (diff)
downloadCMake-a10d2ad39792a7550c00cd4d351b583b7e61a434.zip
CMake-a10d2ad39792a7550c00cd4d351b583b7e61a434.tar.gz
CMake-a10d2ad39792a7550c00cd4d351b583b7e61a434.tar.bz2
Tests: Improve C compatibility of LoadCommand tests
The previous code used `char **` and `const char **`` types as if they were the same. But they are distinct types in C, so when passing these pointers as function arguments, their types have to match. Future C compilers will treat this as an error, similar to what C++ compilers do today.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/LoadCommand/CMakeCommands/cmTestCommand.c13
-rw-r--r--Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c15
2 files changed, 17 insertions, 11 deletions
diff --git a/Tests/LoadCommand/CMakeCommands/cmTestCommand.c b/Tests/LoadCommand/CMakeCommands/cmTestCommand.c
index 7176ebe..ba13727 100644
--- a/Tests/LoadCommand/CMakeCommands/cmTestCommand.c
+++ b/Tests/LoadCommand/CMakeCommands/cmTestCommand.c
@@ -16,14 +16,14 @@ static int CCONV InitialPass(void* inf, void* mf, int argc, char* argv[])
{
char* file;
char* str;
- char* srcs;
+ const char* srcs;
const char* cstr;
char buffer[1024];
void* source_file;
char* args[2];
- char* ccArgs[4];
- char* ccDep[1];
- char* ccOut[1];
+ const char* ccArgs[4];
+ const char* ccDep[1];
+ const char* ccOut[1];
cmLoadedCommandInfo* info = (cmLoadedCommandInfo*)inf;
cmVTKWrapTclData* cdata =
@@ -148,7 +148,10 @@ static int CCONV InitialPass(void* inf, void* mf, int argc, char* argv[])
if (info->CAPI->GetTotalArgumentSize(2, args) != 13) {
return 0;
}
- info->CAPI->ExecuteCommand(mf, "SET", 2, args);
+
+ ccArgs[0] = "TEST_EXEC";
+ ccArgs[1] = "TRUE";
+ info->CAPI->ExecuteCommand(mf, "SET", 2, ccArgs);
/* make sure we can find the source file */
if (!info->CAPI->GetSource(mf, argv[1])) {
diff --git a/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c b/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c
index 7176ebe..e3b332c 100644
--- a/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c
+++ b/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c
@@ -16,14 +16,14 @@ static int CCONV InitialPass(void* inf, void* mf, int argc, char* argv[])
{
char* file;
char* str;
- char* srcs;
- const char* cstr;
+ const char* srcs;
+ char* cstr;
char buffer[1024];
void* source_file;
char* args[2];
- char* ccArgs[4];
- char* ccDep[1];
- char* ccOut[1];
+ const char* ccArgs[4];
+ const char* ccDep[1];
+ const char* ccOut[1];
cmLoadedCommandInfo* info = (cmLoadedCommandInfo*)inf;
cmVTKWrapTclData* cdata =
@@ -148,7 +148,10 @@ static int CCONV InitialPass(void* inf, void* mf, int argc, char* argv[])
if (info->CAPI->GetTotalArgumentSize(2, args) != 13) {
return 0;
}
- info->CAPI->ExecuteCommand(mf, "SET", 2, args);
+
+ ccArgs[0] = "TEST_EXEC";
+ ccArgs[1] = "TRUE";
+ info->CAPI->ExecuteCommand(mf, "SET", 2, ccArgs);
/* make sure we can find the source file */
if (!info->CAPI->GetSource(mf, argv[1])) {