Fix gcc-14 -Werror=calloc-transposed-args compatibility

This commit is contained in:
William Cohen 2024-01-29 16:34:57 -05:00
parent 461c2dd0bd
commit dcb84740cd
2 changed files with 28 additions and 2 deletions

21
libpfm-gcc14.patch Normal file
View File

@ -0,0 +1,21 @@
commit cb944829e0940d74009e09b8985b4f2139f5cb3b
Author: William Cohen <wcohen@redhat.com>
Date: Mon Jan 29 16:23:43 2024 -0500
Correct s390x code to avoid GCC-14 -Werror=calloc-transposed-args errors
diff --git a/lib/pfmlib_s390x_cpumf.c b/lib/pfmlib_s390x_cpumf.c
index d8ce22d..718f5f8 100644
--- a/lib/pfmlib_s390x_cpumf.c
+++ b/lib/pfmlib_s390x_cpumf.c
@@ -216,8 +216,8 @@ static int pfm_cpumcf_init(void *this)
break;
}
- cpumcf_pe = calloc(sizeof(*cpumcf_pe),
- cfvn_set_count + csvn_set_count + ext_set_count);
+ cpumcf_pe = calloc(cfvn_set_count + csvn_set_count + ext_set_count,
+ sizeof(*cpumcf_pe));
if (cpumcf_pe == NULL)
return PFM_ERR_NOMEM;

View File

@ -12,7 +12,7 @@
Name: libpfm
Version: 4.13.0
Release: 7%{?dist}
Release: 8%{?dist}
Summary: Library to encode performance events for use by perf tool
@ -20,6 +20,7 @@ License: MIT
URL: http://perfmon2.sourceforge.net/
Source0: http://sourceforge.net/projects/perfmon2/files/libpfm4/%{name}-%{version}.tar.gz
Patch2: libpfm-python3-setup.patch
Patch3: libpfm-gcc14.patch
BuildRequires: make
BuildRequires: gcc
@ -73,7 +74,8 @@ Python bindings for libpfm4 and perf_event_open system call.
%prep
%setup -q
%patch2 -p1 -b .python3
%patch -P2 -p1 -b .python3
%patch -P3 -p1 -b .gcc14
# to prevent setuptools from installing an .egg, we need to pass --root to setup.py install
# see https://github.com/pypa/setuptools/issues/3143
# and https://github.com/pypa/pip/issues/11501
@ -133,6 +135,9 @@ rm $RPM_BUILD_ROOT%{_libdir}/lib*.a
%endif
%changelog
* Mon Jan 29 2024 William Cohen <wcohen@redhat.com> - 4.13.0-8
- Fix gcc-14 -Werror=calloc-transposed-args compatibility
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 4.13.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild