Remove implicit ints and implicit function declarations

Related to:

  <https://fedoraproject.org/wiki/Changes/PortingToModernC>
  <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>
This commit is contained in:
Florian Weimer 2022-11-18 14:15:22 +01:00
parent 4c4c5b1a99
commit c35b75cfd5
3 changed files with 101 additions and 1 deletions

37
tix-configure-c99.patch Normal file
View File

@ -0,0 +1,37 @@
Replace various pre-C99 constructs with C99-compatible versions.
These are in generated autoconf code, which is why configure.in
does not need changes.
diff --git a/configure b/configure
index 55fafeaa0b6e3846..b6147d3426b1c772 100755
--- a/configure
+++ b/configure
@@ -2767,7 +2767,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
for ac_declaration in \
- '' \
+ '#include <stdlib.h>' \
'extern "C" void std::exit (int) throw (); using std::exit;' \
'extern "C" void std::exit (int); using std::exit;' \
'extern "C" void exit (int) throw ();' \
@@ -3470,8 +3470,8 @@ main ()
for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i))
|| toupper (i) != TOUPPER (i))
- exit(2);
- exit (0);
+ return 2;
+ return 0;
}
_ACEOF
rm -f conftest$ac_exeext
@@ -3838,7 +3838,7 @@ main ()
char c[sizeof (long)];
} u;
u.l = 1;
- exit (u.c[sizeof (long) - 1] == 1);
+ return u.c[sizeof (long) - 1] == 1;
}
_ACEOF
rm -f conftest$ac_exeext

56
tix-implicit-int.patch Normal file
View File

@ -0,0 +1,56 @@
Avoid implicit int declarations, a feature removed from C language with C99.
Submitted upstream: <https://sourceforge.net/p/tix/bugs/112/>
diff --git a/generic/tixDiImg.c b/generic/tixDiImg.c
index da20d53c16cca3c7..3fb9f800fcd9e52a 100644
--- a/generic/tixDiImg.c
+++ b/generic/tixDiImg.c
@@ -352,6 +352,8 @@ Tix_ImageItemDisplay(drawable, iPtr, x, y, width, height, xOffset, yOffset,
int y;
int width;
int height;
+ int xOffset;
+ int yOffset;
int flags;
{
TixImageItem *itPtr = (TixImageItem *)iPtr;
diff --git a/generic/tixDiWin.c b/generic/tixDiWin.c
index e62529ecd19a9790..a96cd287e11c34e3 100644
--- a/generic/tixDiWin.c
+++ b/generic/tixDiWin.c
@@ -458,6 +458,8 @@ Tix_WindowItemDisplay(drawable, iPtr, x, y, width, height, xOffset, yOffset,
int y;
int width;
int height;
+ int xOffset;
+ int yOffset;
int flags;
{
TixWindowItem *itPtr = (TixWindowItem *)iPtr;
diff --git a/generic/tixForm.c b/generic/tixForm.c
index 5ab21f15a99bfde9..ba56617e436f748b 100644
--- a/generic/tixForm.c
+++ b/generic/tixForm.c
@@ -150,7 +150,7 @@ static Tcl_HashTable masterInfoHashTable;
/*
* Have static variables in this module been initialized?
*/
-static initialized = 0;
+static int initialized = 0;
static int ReqSize(tkwin, axis)
Tk_Window tkwin;
diff --git a/unix/tixUnixMwm.c b/unix/tixUnixMwm.c
index 3c4ac4d83bc51c80..02b58c16311b2c54 100644
--- a/unix/tixUnixMwm.c
+++ b/unix/tixUnixMwm.c
@@ -768,7 +768,7 @@ GetMwmInfo(interp, tkwin)
Tcl_Interp * interp;
Tk_Window tkwin;
{
- static inited = 0;
+ static int inited = 0;
Tcl_HashEntry *hashPtr;
int isNew;

View File

@ -8,7 +8,7 @@ Summary: A set of extension widgets for Tk
Name: tix
Epoch: 1
Version: %{tixmajor}.3
Release: 34%{?dist}
Release: 35%{?dist}
License: TCL
URL: http://tix.sourceforge.net/
Source0: http://downloads.sourceforge.net/project/%{name}/%{name}/%{version}/Tix%{version}-src.tar.gz
@ -16,6 +16,8 @@ Source0: http://downloads.sourceforge.net/project/%{name}/%{name}/%{version}/Tix
Patch0: tix-8.4.2-link.patch
Patch1: tix-8.4.3-tcl86.patch
Patch2: tix-8.4.3-covscan-fixes.patch
Patch3: tix-implicit-int.patch
Patch4: tix-configure-c99.patch
Requires: tcl(abi) = 8.6
Requires: tcl >= %{tcltkver}, tk >= %{tcltkver}
Requires: /etc/ld.so.conf.d
@ -60,6 +62,8 @@ This package contains the tix documentation
%patch0 -p1 -b .link
%patch1 -p1 -b .tcl86
%patch2 -p1 -b .covscan-fixes
%patch3 -p1 -b .implicit-int
%patch4 -p1 -b .configure-c99
# Remove executable permission of images in html documentation
chmod ugo-x docs/html/gif/tix/*.png docs/html/gif/tix/*.gif \
@ -128,6 +132,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/Tix%{tixmajor}/license.terms
%doc %{tcl_sitelib}/Tix%{tixmajor}
%changelog
* Fri Nov 18 2022 Florian Weimer <fweimer@redhat.com> - 1:8.4.3-35
- Remove implicit ints and implicit function declarations
* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1:8.4.3-34
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild