summaryrefslogtreecommitdiff
path: root/dev-build/cmake/files/cmake-3.28.0-c99.patch
blob: 3af9a5104f66d07cf04af01cad008e6495619a2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
https://gitlab.kitware.com/cmake/cmake/-/merge_requests/9002

From 9ede6138b71ac2ab961b0954b10a9dc03cf77b37 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Thu, 23 Nov 2023 08:45:05 +0100
Subject: [PATCH] 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.
---
 Tests/LoadCommand/CMakeCommands/cmTestCommand.c   | 13 ++++++++-----
 .../CMakeCommands/cmTestCommand.c                 | 15 +++++++++------
 2 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/Tests/LoadCommand/CMakeCommands/cmTestCommand.c b/Tests/LoadCommand/CMakeCommands/cmTestCommand.c
index 7176ebe9d4b..ba13727d2b8 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 7176ebe9d4b..e3b332c1aa9 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])) {
-- 
GitLab