Port to C99
Related to: <https://fedoraproject.org/wiki/Changes/PortingToModernC> <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>
This commit is contained in:
parent
2f0be6106b
commit
626632f933
36
libsmi-c99.patch
Normal file
36
libsmi-c99.patch
Normal file
@ -0,0 +1,36 @@
|
||||
Do not define _ISOC11_SOURCE in parser-sming.y
|
||||
|
||||
It overrides _DEFAULT_SOURCE, thereby hiding the declaration of timegm
|
||||
in <time.h>. This will result in build failures with future compilers
|
||||
that do not support implicit function declarations.
|
||||
|
||||
Submitted upstream:
|
||||
|
||||
<https://lists.ibr.cs.tu-bs.de/hyperkitty/list/libsmi@ibr.cs.tu-bs.de/thread/MI6XPAR7JE2AY6UZIMXA3Q7JGD635JRR/>
|
||||
|
||||
diff --git a/lib/parser-sming.c b/lib/parser-sming.c
|
||||
index 823b5a73773275f7..00a1391820f21a16 100644
|
||||
--- a/lib/parser-sming.c
|
||||
+++ b/lib/parser-sming.c
|
||||
@@ -227,7 +227,7 @@
|
||||
|
||||
#ifdef BACKEND_SMING
|
||||
|
||||
-#define _ISOC99_SOURCE
|
||||
+
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
diff --git a/lib/parser-sming.y b/lib/parser-sming.y
|
||||
index 555e570613ad689f..32bddeac93eac7e8 100644
|
||||
--- a/lib/parser-sming.y
|
||||
+++ b/lib/parser-sming.y
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
#ifdef BACKEND_SMING
|
||||
|
||||
-#define _ISOC99_SOURCE
|
||||
+
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
60
libsmi-configure-c99.patch
Normal file
60
libsmi-configure-c99.patch
Normal file
@ -0,0 +1,60 @@
|
||||
Avoid implicit ints and implicit function declarations, to prevent
|
||||
build failures with future compilers.
|
||||
|
||||
It's not clear if old compilers really use <stdio.h> for the exit
|
||||
function. Most of these checks would be better served by using
|
||||
#error, so that they can use AC_TRY_LINK and be compatible with
|
||||
cross-compilation.
|
||||
|
||||
Submitted upstream:
|
||||
|
||||
<https://lists.ibr.cs.tu-bs.de/hyperkitty/list/libsmi@ibr.cs.tu-bs.de/thread/MI6XPAR7JE2AY6UZIMXA3Q7JGD635JRR/>
|
||||
|
||||
diff --git a/configure.in b/configure.in
|
||||
index 9b678e2d915a789d..c032538163bd05ab 100644
|
||||
--- a/configure.in
|
||||
+++ b/configure.in
|
||||
@@ -42,8 +42,8 @@ AC_ARG_WITH(cc,
|
||||
CC="$withval")
|
||||
|
||||
AC_MSG_CHECKING([for additional required compiler flags])
|
||||
-AC_TRY_RUN([#include <stdio.h>
|
||||
- main() {
|
||||
+AC_TRY_RUN([#include <stdlib.h>
|
||||
+ int main(void) {
|
||||
#ifdef __SUNPRO_C
|
||||
exit(0);
|
||||
#else
|
||||
@@ -100,8 +100,8 @@ dirseparator="$withval", dirseparator="")
|
||||
|
||||
AC_MSG_CHECKING([for path separator character])
|
||||
if test "$pathseparator" = "" ; then
|
||||
- AC_TRY_RUN([#include <stdio.h>
|
||||
- main() {
|
||||
+ AC_TRY_RUN([#include <stdlib.h>
|
||||
+ int main(void) {
|
||||
#ifdef _WIN32
|
||||
exit(0);
|
||||
#else
|
||||
@@ -114,8 +114,8 @@ echo $pathseparator
|
||||
|
||||
AC_MSG_CHECKING([for dir separator character])
|
||||
if test "$dirseparator" = "" ; then
|
||||
- AC_TRY_RUN([#include <stdio.h>
|
||||
- main() {
|
||||
+ AC_TRY_RUN([#include <stdlib.h>
|
||||
+ int main(void) {
|
||||
#ifdef _WIN32
|
||||
exit(0);
|
||||
#else
|
||||
@@ -140,8 +140,8 @@ AC_MSG_CHECKING([for 64 bit types])
|
||||
# "warning: decimal constant is so large that it is unsigned"
|
||||
# if used with the (correct) value -9223372036854775808LL.
|
||||
#
|
||||
-AC_TRY_RUN([#include <stdio.h>
|
||||
- main() {
|
||||
+AC_TRY_RUN([#include <stdlib.h>
|
||||
+ int main(void) {
|
||||
long long ll;
|
||||
unsigned long long ull;
|
||||
exit(0);
|
||||
13
libsmi.spec
13
libsmi.spec
@ -1,6 +1,6 @@
|
||||
Name: libsmi
|
||||
Version: 0.4.8
|
||||
Release: 32%{?dist}
|
||||
Release: 33%{?dist}
|
||||
Summary: A library to access SMI MIB information
|
||||
|
||||
License: GPLv2+ and BSD
|
||||
@ -12,6 +12,8 @@ Patch0: libsmi-0.4.8-wget111.patch
|
||||
Patch1: libsmi-0.4.8-CVE-2010-2891.patch
|
||||
Patch2: libsmi-0.4.8-symbols-clash.patch
|
||||
Patch3: libsmi-0.4.8-format-security-fix.patch
|
||||
Patch4: libsmi-configure-c99.patch
|
||||
Patch5: libsmi-c99.patch
|
||||
|
||||
BuildRequires: libtool
|
||||
BuildRequires: flex, bison
|
||||
@ -47,9 +49,15 @@ libsmi-based applications.
|
||||
%patch1 -p1 -b .CVE-2010-2891
|
||||
%patch2 -p1 -b .clash
|
||||
%patch3 -p1 -b .format-security
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
# Avoid re-running bison. The regeneration appears to break the generated
|
||||
# C code.
|
||||
touch -r lib/parser-sming.y lib/parser-sming.c
|
||||
cp %{SOURCE2} .
|
||||
|
||||
%build
|
||||
autoreconf -iv
|
||||
%configure \
|
||||
--enable-smi \
|
||||
--enable-sming \
|
||||
@ -98,6 +106,9 @@ make check ||:
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Apr 14 2023 Florian Weimer <fweimer@redhat.com> - 0.4.8-33
|
||||
- Port to C99
|
||||
|
||||
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.8-32
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user