Improve C compatibility of LoadCommand tests
Related to: <https://fedoraproject.org/wiki/Changes/PortingToModernC> <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>
This commit is contained in:
parent
a2c98e0624
commit
2081d2ee8b
83
cmake-c99.patch
Normal file
83
cmake-c99.patch
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
|
Submitted upstream:
|
||||||
|
|
||||||
|
<https://gitlab.kitware.com/cmake/cmake/-/merge_requests/9002>
|
||||||
|
|
||||||
|
diff --git a/Tests/LoadCommand/CMakeCommands/cmTestCommand.c b/Tests/LoadCommand/CMakeCommands/cmTestCommand.c
|
||||||
|
index 7176ebe9d4bd3c4e..ba13727d2b83a051 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 7176ebe9d4bd3c4e..e3b332c1aa9d9108 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])) {
|
@ -72,7 +72,7 @@
|
|||||||
%global patch_version 0
|
%global patch_version 0
|
||||||
|
|
||||||
# For handling bump release by rpmdev-bumpspec and mass rebuild
|
# For handling bump release by rpmdev-bumpspec and mass rebuild
|
||||||
%global baserelease 1
|
%global baserelease 2
|
||||||
|
|
||||||
# Set to RC version if building RC, else comment out.
|
# Set to RC version if building RC, else comment out.
|
||||||
%global rcsuf rc3
|
%global rcsuf rc3
|
||||||
@ -117,6 +117,7 @@ Source5: %{name}.req
|
|||||||
# http://public.kitware.com/Bug/view.php?id=12965
|
# http://public.kitware.com/Bug/view.php?id=12965
|
||||||
# https://bugzilla.redhat.com/show_bug.cgi?id=822796
|
# https://bugzilla.redhat.com/show_bug.cgi?id=822796
|
||||||
Patch100: %{name}-findruby.patch
|
Patch100: %{name}-findruby.patch
|
||||||
|
Patch101: cmake-c99.patch
|
||||||
|
|
||||||
# Patch for renaming on EPEL
|
# Patch for renaming on EPEL
|
||||||
%if 0%{?name_suffix:1}
|
%if 0%{?name_suffix:1}
|
||||||
@ -549,6 +550,9 @@ popd
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Nov 23 2023 Florian Weimer <fweimer@redhat.com> - 3.28.0~rc3-2
|
||||||
|
- Improve C compatibility of LoadCommand tests
|
||||||
|
|
||||||
* Tue Oct 24 2023 Björn Esser <besser82@fedoraproject.org> - 3.28.0~rc3-1
|
* Tue Oct 24 2023 Björn Esser <besser82@fedoraproject.org> - 3.28.0~rc3-1
|
||||||
- cmake-3.28.0-rc3
|
- cmake-3.28.0-rc3
|
||||||
Fixes rhbz#2243343
|
Fixes rhbz#2243343
|
||||||
|
Loading…
Reference in New Issue
Block a user