summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/xlispstat-fix-compilation-with-modern-gcc.patch
blob: 46825d1132f95169e67f6f3e5b5eada94e7a9d7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
From 29d14d78a17f2d85bc9e37f380e71221c2055dd8 Mon Sep 17 00:00:00 2001
From: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>
Date: Thu, 23 Oct 2025 22:13:53 +0300
Subject: [PATCH] src: Fix compilation with GCC version 14 or newer

GCC version 14 now treats some deprecation warnings as errors, namely
it is not allowed to use implicit "int" types, implicit function
declarations (see <https://gcc.gnu.org/gcc-14/porting_to.html>.)  In
this patch, deprecated code updated to match the new requirements of
GCC.

* src/c/ddists.c, src/c/objects.c, src/include/sysvr4-foreign.h,
src/c/iviewdat.c, src/c/postscript.c: Explicitly specify variable
types and procedure return value types to satisfy requirements of
GCC version 14 or newer.
* src/c/X11graph.c: Likewise.
(StBlockForInput): Modernize "select" call.
* src/c/X11BSDstuff.c (line_available): Modernize "select" call.
---
 src/c/X11BSDstuff.c          |  4 +++-
 src/c/X11graph.c             | 10 +++++++---
 src/c/ddists.c               |  4 +++-
 src/c/iviewdat.c             |  2 +-
 src/c/objects.c              |  6 ++++--
 src/c/postscript.c           |  7 ++++---
 src/include/sysvr4-foreign.h |  2 +-
 7 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/src/c/X11BSDstuff.c b/src/c/X11BSDstuff.c
index 5bb7144..4a9b91b 100644
--- a/src/c/X11BSDstuff.c
+++ b/src/c/X11BSDstuff.c
@@ -3,6 +3,8 @@
 /* Additions to Xlisp 2.1, Copyright (c) 1989 by David Michael Betz    */
 /* You may give out copies of this software; for conditions see the    */
 /* file COPYING included with this distribution.                       */
+/* Additions to XLISP-STAT 2.1, Copyright (c) 2025,                    */
+/* by Artyom V. Poptsov <poptsov.artyom@gmail.com>                     */
 /*                                                                     */
 /* Some modifications included from WINTERP                            */
 /* WINTERP 1.0 Copyright 1989 Hewlett-Packard Company (by Niels Mayer).*/
@@ -549,7 +551,7 @@ LOCAL int line_available()
   FD_ZERO(&readmask);
   FD_SET(fileno(stdin), &readmask);
 
-  result = select(ndfs, (int *) &readmask, NULL, NULL, &tv);
+  result = select(ndfs, &readmask, NULL, NULL, &tv);
   if (result > 0) return(TRUE);
   /* *** should merge the select here with the one for blocking ***/
   else return(StBlockForInput());
diff --git a/src/c/X11graph.c b/src/c/X11graph.c
index 70dff08..920957c 100644
--- a/src/c/X11graph.c
+++ b/src/c/X11graph.c
@@ -1,6 +1,8 @@
 /* X11graph - X11 support for XLISP-STAT                               */
 /* XLISP-STAT 2.1 Copyright (c) 1990, by Luke Tierney                  */
 /* Additions to Xlisp 2.1, Copyright (c) 1989 by David Michael Betz    */
+/* Additions to XLISP-STAT 2.1, Copyright (c) 2025,                    */
+/* by Artyom V. Poptsov <poptsov.artyom@gmail.com>                     */
 /* You may give out copies of this software; for conditions see the    */
 /* file COPYING included with this distribution.                       */
 
@@ -23,8 +25,8 @@ extern VOID InstallMenuButton P2H(Window, LVAL);
 extern VOID DeleteMenuButton P1H(Window);
 extern VOID StX11FinishMenus(V);
 extern VOID StX11FinishDialogs(V);
-extern StX11InitMenus(V);
-extern StX11InitDialogs(V);
+extern void StX11InitMenus(V);
+extern void StX11InitDialogs(V);
 
 extern char *getenv();
 
@@ -316,7 +318,7 @@ int StBlockForInput()
       if (tmp > maxfd) maxfd = tmp;
       FD_SET(maxfd, &readmask);
     }
-    result = select(maxfd+1, (int *) &readmask, NULL, NULL, NULL);
+    result = select(maxfd+1, &readmask, NULL, NULL, NULL);
     return((FD_ISSET(fileno(stdin), &readmask)) ? TRUE : FALSE);
   }
   else return(FALSE);
@@ -1221,6 +1223,7 @@ VOID StWGetLocation(w, left, top, frame)
 VOID StWSetSize(w, width, height, frame)
      Window w;
      int width, height;
+     int frame;
 {
   Display *dpy = StX11Display();
   StGWWinInfo *gwinfo;
@@ -1286,6 +1289,7 @@ VOID StWGetSize(w, pwidth, pheight, frame)
 VOID StGWSetSize(gwinfo, width, height, frame)
      StGWWinInfo *gwinfo;
      int width, height;
+     int frame;
 {
   Window w;
   if (gwinfo == NULL || (w = gwinfo->window) == NullWindow) return;
diff --git a/src/c/ddists.c b/src/c/ddists.c
index e6abeaa..dcefa23 100644
--- a/src/c/ddists.c
+++ b/src/c/ddists.c
@@ -3,6 +3,8 @@
 /* Additions to Xlisp 2.1, Copyright (c) 1989 by David Michael Betz    */
 /* You may give out copies of this software; for conditions see the    */
 /* file COPYING included with this distribution.                       */
+/* Additions to XLISP-STAT 2.1, Copyright (c) 2025,                    */
+/* by Artyom V. Poptsov <poptsov.artyom@gmail.com>                     */
  
 #include "xlisp.h"
 #include "xlstat.h"
@@ -29,7 +31,7 @@ LOCAL VOID getpoisarg P1H(double *);
 LOCAL double poisson_cdf P2H(int, double);
 LOCAL int binomial_quant P3H(double, int, double);
 LOCAL int poisson_quant P2H(double, double);
-LOCAL poisson_rand P1H(double);
+LOCAL int poisson_rand P1H(double);
 LOCAL int binomial_rand P2H(int, double);
 
 /* numerical distribution function */
diff --git a/src/c/iviewdat.c b/src/c/iviewdat.c
index 0b35e05..28fd2df 100644
--- a/src/c/iviewdat.c
+++ b/src/c/iviewdat.c
@@ -237,7 +237,7 @@ static VOID IViewBasicPointsSetTransformation P2C(IViewBasicPoints, p, double **
 static VOID IViewBasicPointsApplyTransformation P3C(IViewBasicPoints, p,
                                                     double **, a, int *, inbasis)
 {
-  static maxvars = 0;
+  static int maxvars = 0;
   static Fixed **b, *x, **screen_data, *screen_location;
   int vars, n, i, j;
   double *scale = p->scale, *location = p->location;
diff --git a/src/c/objects.c b/src/c/objects.c
index d9c61f2..1084b47 100644
--- a/src/c/objects.c
+++ b/src/c/objects.c
@@ -3,7 +3,9 @@
 /* Additions to Xlisp 2.1, Copyright (c) 1989 by David Michael Betz    */
 /* You may give out copies of this software; for conditions see the    */
 /* file COPYING included with this distribution.                       */
- 
+/* Additions to XLISP-STAT 2.1, Copyright (c) 2025,                    */
+/* by Artyom V. Poptsov <poptsov.artyom@gmail.com>                     */
+
 #include "xlisp.h"
 #include "xlstat.h"
 
@@ -1260,7 +1262,7 @@ LVAL xsobject_isnew(V)
 VOID xsaddmsg P2C(LVAL, object, char *, str)
 {
   LVAL fcn;
-  static offset = FIRST_METHOD_OFFSET;
+  static int offset = FIRST_METHOD_OFFSET;
 
   xlsave1(fcn);
   fcn = cvsubr(funtab[offset].fd_subr,funtab[offset].fd_type,offset);
diff --git a/src/c/postscript.c b/src/c/postscript.c
index 6ddbfb9..ea57351 100644
--- a/src/c/postscript.c
+++ b/src/c/postscript.c
@@ -9,6 +9,7 @@
 /* pbmtops.c - read a portable bitmap and produce a PostScript bitmap file
 **
 ** Copyright (C) 1988 by Jef Poskanzer.
+** Copyright (C) 2025 by Artyom V. Poptsov <poptsov.artyom@gmail.com>
 **
 ** Permission to use, copy, modify, and distribute this software and its
 ** documentation for any purpose and without fee is hereby granted, provided
@@ -60,7 +61,7 @@ static FILE *fp;
 /**************************************************************************/
 
 /* set up global variables and print the postscript preamble */
-psputinit(file, cols, rows, scale )
+void psputinit(file, cols, rows, scale )
      FILEP file;
      int cols, rows;
      double scale;
@@ -120,7 +121,7 @@ psputinit(file, cols, rows, scale )
 }
 
 /* enter a bit into the image */
-psputbit(b)
+void psputbit(b)
      int b;
 {
   if ( bitsperitem == 8 ) {
@@ -133,7 +134,7 @@ psputbit(b)
 }
 
 /* clean up and print the showpage command */
-psputrest( )
+void psputrest( )
 {
   if ( bitsperitem > 0 )
     putitem( );
diff --git a/src/include/sysvr4-foreign.h b/src/include/sysvr4-foreign.h
index f40acc8..709fc6c 100644
--- a/src/include/sysvr4-foreign.h
+++ b/src/include/sysvr4-foreign.h
@@ -16,7 +16,7 @@ LOCAL VOID link_and_load(fname, libs, fort)
      char *fname, *libs;
      int fort;
 {
-  static initialized = FALSE;
+  static int initialized = FALSE;
   void *handle;
 
   if (! initialized) {
-- 
2.51.0