Improve compatibility with strict(er) C99 compilers
Related to: <https://fedoraproject.org/wiki/Changes/PortingToModernC> <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>
This commit is contained in:
parent
b9b52496b9
commit
ebbc582912
21
stress-ng-c99-1.patch
Normal file
21
stress-ng-c99-1.patch
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
test-pidfd-getfd: Include <syspidfd.h> if available for pidfd_getfd
|
||||||
|
|
||||||
|
Submitted upstream:
|
||||||
|
|
||||||
|
<https://github.com/ColinIanKing/stress-ng/pull/247>
|
||||||
|
|
||||||
|
diff --git a/test/test-pidfd-getfd.c b/test/test-pidfd-getfd.c
|
||||||
|
index d55b6f9a28692417..317c5542b2c423ee 100644
|
||||||
|
--- a/test/test-pidfd-getfd.c
|
||||||
|
+++ b/test/test-pidfd-getfd.c
|
||||||
|
@@ -20,6 +20,10 @@
|
||||||
|
|
||||||
|
#define _GNU_SOURCE
|
||||||
|
|
||||||
|
+#if defined(__has_include) && __has_include(<sys/pidfd.h>)
|
||||||
|
+#include <sys/pidfd.h>
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
/* We don't care about the args, we just want to see if it links */
|
26
stress-ng-c99-2.patch
Normal file
26
stress-ng-c99-2.patch
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
test/test-float.c: Avoid tickling an implicit int error
|
||||||
|
|
||||||
|
The new typedef ensures that ftype is known as a type, even if FLOAT
|
||||||
|
itself does not denote a type. This helps with efforts porting to
|
||||||
|
modern C, where all implicit ints are flagged for investigation.
|
||||||
|
|
||||||
|
Submitted upstream:
|
||||||
|
|
||||||
|
<https://github.com/ColinIanKing/stress-ng/pull/247>
|
||||||
|
|
||||||
|
diff --git a/test/test-float.c b/test/test-float.c
|
||||||
|
index 06cb7f651fc7eb90..0483c9b587d9a4c3 100644
|
||||||
|
--- a/test/test-float.c
|
||||||
|
+++ b/test/test-float.c
|
||||||
|
@@ -58,7 +58,10 @@
|
||||||
|
b = d - (_type)1.0L; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
-static FLOAT HOT OPTIMIZE3 test(void)
|
||||||
|
+/* Avoid implicit int in the definition of test even if FLOAT is not known. */
|
||||||
|
+typedef FLOAT float_type;
|
||||||
|
+
|
||||||
|
+static float_type HOT OPTIMIZE3 test(void)
|
||||||
|
{
|
||||||
|
FLOAT a = 0.0, b = 0.0, c = 0.0, d = 0.0;
|
||||||
|
|
19
stress-ng-c99-3.patch
Normal file
19
stress-ng-c99-3.patch
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
test-fchmodat: Include <sys/stat.h> for the fchmodat prototype
|
||||||
|
|
||||||
|
Submitted upstream:
|
||||||
|
|
||||||
|
<https://github.com/ColinIanKing/stress-ng/pull/247>
|
||||||
|
|
||||||
|
diff --git a/test/test-fchmodat.c b/test/test-fchmodat.c
|
||||||
|
index 7a8f59de42716057..209e6841f3a738f1 100644
|
||||||
|
--- a/test/test-fchmodat.c
|
||||||
|
+++ b/test/test-fchmodat.c
|
||||||
|
@@ -18,7 +18,7 @@
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
-#include <unistd.h>
|
||||||
|
+#include <sys/stat.h>
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
20
stress-ng-c99-4.patch
Normal file
20
stress-ng-c99-4.patch
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
test-aligned-alloc: Define _GNU_SOURCE for the aligned_alloc prototype
|
||||||
|
|
||||||
|
Submitted upstream:
|
||||||
|
|
||||||
|
<https://github.com/ColinIanKing/stress-ng/pull/247>
|
||||||
|
|
||||||
|
diff --git a/test/test-aligned-alloc.c b/test/test-aligned-alloc.c
|
||||||
|
index 0ea91b6a7ccadf12..f29365530b9e5e52 100644
|
||||||
|
--- a/test/test-aligned-alloc.c
|
||||||
|
+++ b/test/test-aligned-alloc.c
|
||||||
|
@@ -16,6 +16,9 @@
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
+
|
||||||
|
+#define _GNU_SOURCE
|
||||||
|
+
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int main(void)
|
@ -1,11 +1,15 @@
|
|||||||
Name: stress-ng
|
Name: stress-ng
|
||||||
Version: 0.15.00
|
Version: 0.15.00
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
Summary: Stress test a computer system in various ways
|
Summary: Stress test a computer system in various ways
|
||||||
|
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
URL: https://github.com/ColinIanKing/stress-ng
|
URL: https://github.com/ColinIanKing/stress-ng
|
||||||
Source0: https://github.com/ColinIanKing/stress-ng/archive/V%{version}/%{name}-%{version}.tar.gz
|
Source0: https://github.com/ColinIanKing/stress-ng/archive/V%{version}/%{name}-%{version}.tar.gz
|
||||||
|
Patch0: stress-ng-c99-1.patch
|
||||||
|
Patch1: stress-ng-c99-2.patch
|
||||||
|
Patch2: stress-ng-c99-3.patch
|
||||||
|
Patch3: stress-ng-c99-4.patch
|
||||||
|
|
||||||
BuildRequires: make
|
BuildRequires: make
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
@ -28,7 +32,7 @@ various physical subsystems of a computer as well as the various operating
|
|||||||
system kernel interfaces.
|
system kernel interfaces.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup -n %{name}-%{version}
|
%autosetup -p1 -n %{name}-%{version}
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%make_build
|
%make_build
|
||||||
@ -50,6 +54,9 @@ install -pm 644 bash-completion/%{name} \
|
|||||||
%{_datadir}/bash-completion/completions/%{name}
|
%{_datadir}/bash-completion/completions/%{name}
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Dec 13 2022 Florian Weimer <fweimer@redhat.com> - 0.15.00-2
|
||||||
|
- Improve compatibility with strict(er) C99 compilers
|
||||||
|
|
||||||
* Wed Dec 07 2022 Fabio Alessandro Locati <fale@fedoraproject.org> - 0.15.00-1
|
* Wed Dec 07 2022 Fabio Alessandro Locati <fale@fedoraproject.org> - 0.15.00-1
|
||||||
- Update to 0.15.00
|
- Update to 0.15.00
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user