SHA256
1
0
forked from pool/gap-xgap

3 Commits

Author SHA256 Message Date
89784a6a8e Add gcc15.patch 2025-06-18 21:22:23 +02:00
cd9b210310 POSIX sh compatibility 2025-02-28 00:01:31 +01:00
4ebe5794a2 Add gcc14.patch 2024-08-21 22:59:16 +02:00
4 changed files with 409 additions and 4 deletions

View File

@@ -1,3 +1,18 @@
-------------------------------------------------------------------
Wed Jun 18 19:22:09 UTC 2025 - Jan Engelhardt <jengelh@inai.de>
- Add gcc15.patch
-------------------------------------------------------------------
Thu Feb 27 23:00:16 UTC 2025 - Jan Engelhardt <jengelh@inai.de>
- Make specfile conform to POSIX sh
-------------------------------------------------------------------
Wed Aug 21 20:58:38 UTC 2024 - Jan Engelhardt <jengelh@inai.de>
- Add gcc14.patch
-------------------------------------------------------------------
Sat Mar 23 22:09:27 UTC 2024 - Jan Engelhardt <jengelh@inai.de>

View File

@@ -1,7 +1,7 @@
#
# spec file for package gap-xgap
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -25,6 +25,8 @@ Group: Productivity/Scientific/Math
URL: https://gap-packages.github.io/xgap/
#Git-Clone: https://github.com/gap-packages/xgap
Source: https://github.com/gap-packages/xgap/releases/download/v%version/xgap-%version.tar.gz
Patch1: gcc14.patch
Patch2: gcc15.patch
BuildRequires: c_compiler
BuildRequires: fdupes
BuildRequires: gap-devel
@@ -38,7 +40,7 @@ Requires: gap-core >= 4.7
The XGAP package allows to use graphics in GAP.
%prep
%autosetup -n xgap-%version
%autosetup -n xgap-%version -p1
%build
./configure --with-gaproot="%gapdir"
@@ -46,9 +48,8 @@ The XGAP package allows to use graphics in GAP.
%install
%gappkg_simple_install
pushd "%buildroot/$moddir"
cd "%buildroot/$moddir"
rm -Rfv configure config.* bin/*/config.* bin/*/configure cnf src.x11
popd
%fdupes %buildroot/%_prefix
%files -f %name.files

30
gcc14.patch Normal file
View File

@@ -0,0 +1,30 @@
From 0c83898a23ad4c7b5b68a9fcf5899a68fa272e58 Mon Sep 17 00:00:00 2001
From: Jan Engelhardt <jengelh@inai.de>
Date: Wed, 21 Aug 2024 22:49:31 +0200
Subject: [PATCH] build: resolve compile error under gcc-14
References: https://github.com/gap-packages/xgap/pull/33
xcmds.c: In function "FunChangeList":
xcmds.c:715:36: error: passing argument 2 of "XawListChange" from
incompatible pointer type [-Wincompatible-pointer-types]
715 | XawListChange( arg->sel->list, (const char **)text, 0, 0, True );
---
src.x11/xcmds.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src.x11/xcmds.c b/src.x11/xcmds.c
index 644996b..a0242c2 100644
--- a/src.x11/xcmds.c
+++ b/src.x11/xcmds.c
@@ -712,7 +712,7 @@ static Boolean FunChangeList (
text[i] = 0;
/* change list */
- XawListChange( arg->sel->list, (const char **)text, 0, 0, True );
+ XawListChange( arg->sel->list, (String *)text, 0, 0, True );
/* clear old text */
for ( i = 0; arg->sel->text[i]; i++ )
--
2.46.0

359
gcc15.patch Normal file
View File

@@ -0,0 +1,359 @@
From cb04e1a6c29359fe48b7cde15290d41e97c1481d Mon Sep 17 00:00:00 2001
From: Jan Engelhardt <jengelh@inai.de>
Date: Wed, 18 Jun 2025 20:51:26 +0200
Subject: [PATCH] Resolve build failure under gcc 15/-std=c23
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
References: https://github.com/gap-packages/xgap/pull/33
```
../../src.x11/gaptext.c: In function DoSelection:
../../src.x11/gaptext.c:156:13: error: too many arguments to function gap->gap.input_callback; expected 0, have 2
156 | gap->gap.input_callback( buf, 2 );
../../src.x11/gaptext.h:99:27: note: declared here
99 | void (*input_callback)();
../../src.x11/gaptext.c: In function GapTextSelectStart:
../../src.x11/gaptext.c:341:25: error: too many arguments to function gap->gap.check_caret_pos; expected 0, have 2
341 | newPos = oldPos+gap->gap.check_caret_pos(gap->text.insertPos,oldPos);
../../src.x11/gaptext.h:102:27: note: declared here
102 | Int (*check_caret_pos)();
(and others that are more obvious)
```
It is unclear how x.input_callback and x.check_caret_pos ever get
assigned. Due to the use of unspecified argument lists previously,
`check_caret_pos` would be called with arguments of type
XawTextPosition (which are `long`!) whereas `input_callback` would be
called with an `int` (which is not so long).
It is conceivable that the actual function behind some
`input_callback` pointer is expecting XawTextPosition and, because
the function is not getting it, there has been (and continues to do
with this change) illegal memory access past the end of the
arguments-on-stack.
---
src.x11/gaptext.c | 18 ++++++-------
src.x11/gaptext.h | 4 +--
src.x11/pty.c | 2 +-
src.x11/selfile.c | 34 ++++++++++++------------
src.x11/xgap.c | 68 +++++++++++++++++++++++------------------------
src.x11/xgap.h | 2 +-
6 files changed, 64 insertions(+), 64 deletions(-)
diff --git a/src.x11/gaptext.c b/src.x11/gaptext.c
index acdc800..3179072 100644
--- a/src.x11/gaptext.c
+++ b/src.x11/gaptext.c
@@ -14,11 +14,11 @@
#include "utils.h"
#include "gaptext.h"
-extern void _XawTextPrepareToUpdate();
-extern int _XawTextReplace();
-extern void _XawTextSetScrollBars();
-extern void _XawTextCheckResize();
-extern void _XawTextExecuteUpdate();
+extern void _XawTextPrepareToUpdate(GapTextWidget);
+extern int _XawTextReplace(GapTextWidget, Int, Int, XawTextBlock *);
+extern void _XawTextSetScrollBars(GapTextWidget);
+extern void _XawTextCheckResize(GapTextWidget);
+extern void _XawTextExecuteUpdate(GapTextWidget);
/****************************************************************************
@@ -666,7 +666,7 @@ static XawTextPosition GapSrcReadText (
Widget w,
XawTextPosition pos,
XawTextBlock * text,
- unsigned long length )
+ int length )
{
GapSrcObject src = (GapSrcObject) w;
@@ -913,9 +913,9 @@ GapSrcClassRec gapSrcClassRec =
/* extension */ NULL
},
{ /* textSrc_class fields */
- /* Read */ (XawTextPosition (*)())GapSrcReadText,
- /* Replace */ (int (*)()) GapSrcReplaceText,
- /* Scan */ (XawTextPosition (*)()) GapSrcScan,
+ /* Read */ GapSrcReadText,
+ /* Replace */ GapSrcReplaceText,
+ /* Scan */ GapSrcScan,
/* Search */ XtInheritSearch,
/* SetSelection */ XtInheritSetSelection,
/* ConvertSelection */ XtInheritConvertSelection
diff --git a/src.x11/gaptext.h b/src.x11/gaptext.h
index 812535f..34a3a3a 100644
--- a/src.x11/gaptext.h
+++ b/src.x11/gaptext.h
@@ -96,10 +96,10 @@ extern GapTextClassRec gapTextClassRec;
typedef struct
{
/* function to call when receiving input */
- void (*input_callback)();
+ void (*input_callback)(const char *, int);
/* function to position caret */
- Int (*check_caret_pos)();
+ Int (*check_caret_pos)(XawTextPosition, XawTextPosition);
/* input buffer for unprocessed input */
String buffer;
diff --git a/src.x11/pty.c b/src.x11/pty.c
index 483881d..e914bfb 100644
--- a/src.x11/pty.c
+++ b/src.x11/pty.c
@@ -1272,7 +1272,7 @@ static UInt OpenPty(int * master, int * slave)
**
*F StartGapProcess( <name>, <argv> ) . . . start a gap subprocess using ptys
*/
-static void GapStatusHasChanged ()
+static void GapStatusHasChanged (int signo)
{
int w;
diff --git a/src.x11/selfile.c b/src.x11/selfile.c
index e8ba10e..32bda81 100644
--- a/src.x11/selfile.c
+++ b/src.x11/selfile.c
@@ -111,28 +111,28 @@ typedef struct {
} SFDir;
static void
- SFenterList(),
- SFleaveList(),
- SFmotionList(),
- SFbuttonPressList(),
- SFbuttonReleaseList();
+ SFenterList(Widget, long, XEnterWindowEvent *),
+ SFleaveList(Widget, int, XEvent *),
+ SFmotionList(Widget, int, XMotionEvent *),
+ SFbuttonPressList(Widget, int, XButtonPressedEvent *),
+ SFbuttonReleaseList(Widget, int, XButtonReleasedEvent *);
static void
- SFvSliderMovedCallback(),
- SFvFloatSliderMovedCallback(),
- SFhSliderMovedCallback(),
- SFpathSliderMovedCallback(),
- SFvAreaSelectedCallback(),
- SFhAreaSelectedCallback(),
- SFpathAreaSelectedCallback();
+ SFvSliderMovedCallback(Widget, long, int),
+ SFvFloatSliderMovedCallback(Widget, int, float *),
+ SFhSliderMovedCallback(Widget, int, float *),
+ SFpathSliderMovedCallback(Widget, XtPointer, float *),
+ SFvAreaSelectedCallback(Widget, int, int),
+ SFhAreaSelectedCallback(Widget, int, int),
+ SFpathAreaSelectedCallback(Widget, XtPointer, int);
-static Boolean SFworkProc();
+static Boolean SFworkProc(XtPointer);
-static int SFcompareEntries();
+static int SFcompareEntries(const void *, const void *);
-static void SFdirModTimer();
+static void SFdirModTimer(XtPointer, XtIntervalId *);
-static char SFstatChar();
+static char SFstatChar(struct stat *);
/* BSD 4.3 errno.h does not declare errno */
@@ -1157,7 +1157,7 @@ SFpathAreaSelectedCallback(Widget w, XtPointer client_data, int pnew)
}
static Boolean
-SFworkProc()
+SFworkProc(XtPointer xxx)
{
register SFDir *dir;
register SFEntry *entry;
diff --git a/src.x11/xgap.c b/src.x11/xgap.c
index e04fceb..1783cbd 100644
--- a/src.x11/xgap.c
+++ b/src.x11/xgap.c
@@ -255,8 +255,8 @@ static char *FallbackResources[] =
*V GapMenu . . . . . . . . . . . . . . . . . . . . . . . . xgap's "GAP" menu
**
*/
-static void MenuQuitGap () { KeyboardInput( "@C@A@Kquit;\nquit;\n", 18 ); }
-static void MenuKillGap () { KillGap(); }
+static void MenuQuitGap (const TypeMenuItem *mi) { KeyboardInput( "@C@A@Kquit;\nquit;\n", 18 ); }
+static void MenuKillGap (const TypeMenuItem *mi) { KillGap(); }
#ifdef DEBUG_ON
static void MenuResyncGap ()
@@ -341,14 +341,14 @@ static TypeMenuItem GapMenu[] =
*V HelpMenu . . . . . . . . . . . . . . . . . . . . . . xgap's "Help" menu
**
*/
-static void MenuChapters () { SimulateInput( "?Chapters\n" ); }
-static void MenuSections () { SimulateInput( "?Sections\n" ); }
-static void MenuCopyright () { SimulateInput( "?Copyright\n" );}
-static void MenuHelp () { SimulateInput( "?Help\n" ); }
-static void MenuNextHelp () { SimulateInput( "?>\n" ); }
-static void MenuNextChapter () { SimulateInput( "?>>\n" ); }
-static void MenuPrevChapter () { SimulateInput( "?<<\n" ); }
-static void MenuPrevHelp () { SimulateInput( "?<\n" ); }
+static void MenuChapters (const TypeMenuItem *mi) { SimulateInput( "?Chapters\n" ); }
+static void MenuSections (const TypeMenuItem *mi) { SimulateInput( "?Sections\n" ); }
+static void MenuCopyright (const TypeMenuItem *mi) { SimulateInput( "?Copyright\n" );}
+static void MenuHelp (const TypeMenuItem *mi) { SimulateInput( "?Help\n" ); }
+static void MenuNextHelp (const TypeMenuItem *mi) { SimulateInput( "?>\n" ); }
+static void MenuNextChapter (const TypeMenuItem *mi) { SimulateInput( "?>>\n" ); }
+static void MenuPrevChapter (const TypeMenuItem *mi) { SimulateInput( "?<<\n" ); }
+static void MenuPrevHelp (const TypeMenuItem *mi) { SimulateInput( "?<\n" ); }
static TypeMenuItem HelpMenu[] =
@@ -372,11 +372,11 @@ static TypeMenuItem HelpMenu[] =
*V RunMenu . . . . . . . . . . . . . . . . . . . . . . . . xgap's "Run" menu
**
*/
-static void MenuInterrupt () { InterruptGap(); }
-static void MenuQuitBreak () { SimulateInput( "quit;\n" ); }
-static void MenuContBreak () { SimulateInput( "return;\n" ); }
-static void MenuGarbColl () { SimulateInput( "GASMAN(\"collect\");\n" ); }
-static void MenuGarbMesg () { SimulateInput( "GASMAN(\"message\");\n" ); }
+static void MenuInterrupt (const TypeMenuItem *mi) { InterruptGap(); }
+static void MenuQuitBreak (const TypeMenuItem *mi) { SimulateInput( "quit;\n" ); }
+static void MenuContBreak (const TypeMenuItem *mi) { SimulateInput( "return;\n" ); }
+static void MenuGarbColl (const TypeMenuItem *mi) { SimulateInput( "GASMAN(\"collect\");\n" ); }
+static void MenuGarbMesg (const TypeMenuItem *mi) { SimulateInput( "GASMAN(\"message\");\n" ); }
static TypeMenuItem RunMenu[] =
{
@@ -483,7 +483,7 @@ static void MenuSelected (
caddr_t dummy )
{
if ( item->click != 0 )
- (*(item->click))(item);
+ item->click(item);
else
{
fputs( "Warning: menu item ", stderr );
@@ -806,11 +806,11 @@ static void CreateGapWindow ( void )
*F MyErrorHandler(<dis>) . . . . . . . . . . . . kill gap in case of X error
*/
-static int (*OldErrorHandler)();
+static int (*OldErrorHandler)(Display *, XErrorEvent *);
static int MyErrorHandler ( dis, evt )
Display * dis;
- XErrorEvent evt;
+ XErrorEvent * evt;
{
# ifdef DEBUG_ON
fputs( "killing gap because of X error\n", stderr );
@@ -824,7 +824,7 @@ static int MyErrorHandler ( dis, evt )
**
*F MyIOErrorHandler(<dis>) . . . . . . . . . . . kill gap in case of X error
*/
-static int (*OldIOErrorHandler)();
+static int (*OldIOErrorHandler)(Display *);
static int MyIOErrorHandler ( dis )
Display * dis;
@@ -843,50 +843,50 @@ static int MyIOErrorHandler ( dis )
*/
#ifdef DEBUG_ON
-static void (*OldSignalHandlerHUP)();
-static void (*OldSignalHandlerINT)();
-static void (*OldSignalHandlerQUIT)();
-static void (*OldSignalHandlerILL)();
-static void (*OldSignalHandlerIOT)();
-static void (*OldSignalHandlerBUS)();
-static void (*OldSignalHandlerSEGV)();
+static void (*OldSignalHandlerHUP)(int);
+static void (*OldSignalHandlerINT)(int);
+static void (*OldSignalHandlerQUIT)(int);
+static void (*OldSignalHandlerILL)(int);
+static void (*OldSignalHandlerIOT)(int);
+static void (*OldSignalHandlerBUS)(int);
+static void (*OldSignalHandlerSEGV)(int);
-static void MySignalHandlerHUP ()
+static void MySignalHandlerHUP (int signo)
{
fputs( "killing gap because of signal HUP\n", stderr );
KillGap();
OldSignalHandlerHUP();
exit(1);
}
-static void MySignalHandlerINT ()
+static void MySignalHandlerINT (int signo)
{
fputs( "killing gap because of signal INT\n", stderr );
KillGap();
OldSignalHandlerINT();
exit(1);
}
-static void MySignalHandlerQUIT ()
+static void MySignalHandlerQUIT (int signo)
{
fputs( "killing gap because of signal QUIT\n", stderr );
KillGap();
OldSignalHandlerQUIT();
exit(1);
}
-static void MySignalHandlerILL ()
+static void MySignalHandlerILL (int signo)
{
fputs( "killing gap because of signal ILL\n", stderr );
KillGap();
OldSignalHandlerILL();
exit(1);
}
-static void MySignalHandlerIOT ()
+static void MySignalHandlerIOT (int signo)
{
fputs( "killing gap because of signal IOT\n", stderr );
KillGap();
OldSignalHandlerIOT();
exit(1);
}
-static void MySignalHandlerBUS ()
+static void MySignalHandlerBUS (int signo)
{
fputs( "killing gap because of signal BUS\n", stderr );
KillGap();
@@ -894,7 +894,7 @@ static void MySignalHandlerBUS ()
exit(1);
}
-static void MySignalHandlerSEGV ()
+static void MySignalHandlerSEGV (int signo)
{
fputs( "killing gap because of signal SEGV\n", stderr );
KillGap();
@@ -904,7 +904,7 @@ static void MySignalHandlerSEGV ()
#else
-static void MySignalHandler ()
+static void MySignalHandler (int signo)
{
KillGap();
exit(1);
diff --git a/src.x11/xgap.h b/src.x11/xgap.h
index aabc989..f66b7b0 100644
--- a/src.x11/xgap.h
+++ b/src.x11/xgap.h
@@ -25,7 +25,7 @@
typedef struct _menu_item
{
char * label;
- void (*click)();
+ void (*click)(const struct _menu_item *);
int sensitive;
Widget entry;
}
--
2.49.0