From 8c1ed1e6b9efa3e28e9858ffeb73b7bacad2ef8a Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Fri, 24 Feb 2023 11:08:06 +0100 Subject: [PATCH] Port to C99 Related to: --- perl-Tk-c99.patch | 81 +++++++++++++++++++++++++++++++++++++++++++++++ perl-Tk.spec | 7 +++- 2 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 perl-Tk-c99.patch diff --git a/perl-Tk-c99.patch b/perl-Tk-c99.patch new file mode 100644 index 0000000..2db1e17 --- /dev/null +++ b/perl-Tk-c99.patch @@ -0,0 +1,81 @@ +Avoid implicit ints and implicit function declarations. These +language features have been removed from C in 1999. Future compilers +are likely to stop accepting these constructs by default. + +Submitted upstream: + +diff -ur Tk-804.036.orig/config/signedchar.c Tk-804.036/config/signedchar.c +--- Tk-804.036.orig/config/signedchar.c 2023-02-24 10:48:08.060779006 +0100 ++++ Tk-804.036/config/signedchar.c 2023-02-24 10:48:58.315268904 +0100 +@@ -1,4 +1,4 @@ +-main() ++int main(void) + { + signed char x = 'a'; + return (x - 'a'); +diff -ur Tk-804.036.orig/config/unsigned.c Tk-804.036/config/unsigned.c +--- Tk-804.036.orig/config/unsigned.c 2023-02-24 10:48:08.054779067 +0100 ++++ Tk-804.036/config/unsigned.c 2023-02-24 10:49:27.580971854 +0100 +@@ -1,15 +1,16 @@ ++#include + int main() + { + char x[] = "\377"; + if (x[0] > 0) + { + printf("char is unsigned type\n"); +- exit(0); ++ return 0; + } + else + { + printf("char is signed type\n"); +- exit(1); ++ return 1; + } + } + +diff -ur Tk-804.036.orig/pTk/config/Hstrdup.c Tk-804.036/pTk/config/Hstrdup.c +--- Tk-804.036.orig/pTk/config/Hstrdup.c 2023-02-24 10:48:08.010779514 +0100 ++++ Tk-804.036/pTk/config/Hstrdup.c 2023-02-24 10:53:04.326771841 +0100 +@@ -6,7 +6,7 @@ + {char *e; + char *p = strdup(STRING); + if (!p || strcmp(p,STRING)) +- exit(1); ++ return 1; + return 0; + } + +diff -ur Tk-804.036.orig/pTk/config/Hstrtoul.c Tk-804.036/pTk/config/Hstrtoul.c +--- Tk-804.036.orig/pTk/config/Hstrtoul.c 2023-02-24 10:48:08.013779483 +0100 ++++ Tk-804.036/pTk/config/Hstrtoul.c 2023-02-24 10:50:13.205508745 +0100 +@@ -1,4 +1,5 @@ + #include ++#include + + int main() + {char *e; +diff -ur Tk-804.036.orig/pTk/mTk/generic/tkEvent.c Tk-804.036/pTk/mTk/generic/tkEvent.c +--- Tk-804.036.orig/pTk/mTk/generic/tkEvent.c 2023-02-24 10:48:07.324786476 +0100 ++++ Tk-804.036/pTk/mTk/generic/tkEvent.c 2023-02-24 10:54:20.859995000 +0100 +@@ -1153,6 +1153,7 @@ + Time + TkCurrentTime(dispPtr, fallbackCurrent) + TkDisplay *dispPtr; /* Display for which the time is desired. */ ++ int fallbackCurrent; + { + register XEvent *eventPtr; + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) +diff -ur Tk-804.036.orig/pTk/mTk/generic/tkImage.c Tk-804.036/pTk/mTk/generic/tkImage.c +--- Tk-804.036.orig/pTk/mTk/generic/tkImage.c 2023-02-24 10:48:07.321786507 +0100 ++++ Tk-804.036/pTk/mTk/generic/tkImage.c 2023-02-24 10:55:56.174027554 +0100 +@@ -1083,6 +1083,8 @@ + int y; + int width; + int height; ++int imgWidth; ++int imgHeight; + { + Tk_Tile tile = (Tk_Tile) clientData; + Tk_TileChange *handler; diff --git a/perl-Tk.spec b/perl-Tk.spec index 76c8cf4..e402e9f 100644 --- a/perl-Tk.spec +++ b/perl-Tk.spec @@ -5,7 +5,7 @@ Name: perl-Tk Version: 804.036 -Release: 8%{?dist} +Release: 9%{?dist} Summary: Perl Graphical User Interface ToolKit License: (GPL+ or Artistic) and SWL @@ -16,6 +16,7 @@ Patch0: perl-Tk-widget.patch Patch1: perl-Tk-debian.patch.gz # fix segfaults as in #235666 because of broken cashing code Patch2: perl-Tk-seg.patch +Patch3: perl-Tk-c99.patch # Versions before this have Unicode issues @@ -133,6 +134,7 @@ chmod -x pod/Popup.pod Tixish/lib/Tk/balArrow.xbm #%%patch1 -p1 # patch to fix #235666 ... seems like caching code is broken %patch2 -p1 -b .seg +%patch3 -p1 -b .c99 %build %{__perl} Makefile.PL INSTALLDIRS=vendor X11LIB=%{_libdir} XFT=1 @@ -180,6 +182,9 @@ find __demos/ -type f -exec chmod -x {} \; %changelog +* Fri Feb 24 2023 Florian Weimer - 804.036-9 +- Port to C99 + * Fri Jan 20 2023 Fedora Release Engineering - 804.036-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild