1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-12 18:59:50 +03:00

main/perl-yaml-syck: fix build with gcc 15

This commit is contained in:
Celeste 2025-07-03 06:54:28 +00:00
parent 59880601e8
commit 7dab2a7719
2 changed files with 300 additions and 2 deletions

View file

@ -13,7 +13,9 @@ license="MIT"
depends="perl"
makedepends="perl-dev"
subpackages="$pkgname-doc"
source="https://cpan.metacpan.org/authors/id/T/TO/TODDR/YAML-Syck-$pkgver.tar.gz"
source="https://cpan.metacpan.org/authors/id/T/TO/TODDR/YAML-Syck-$pkgver.tar.gz
gcc15.patch
"
builddir="$srcdir/$_pkgreal-$pkgver"
build() {
@ -32,4 +34,7 @@ package() {
find "$pkgdir" \( -name perllocal.pod -o -name .packlist \) -delete
}
sha512sums="18288f54026823e84b2d642d880d7758c5d95ba4b56d3fcf758efe59303ea71a49822d7c000b4c7b0629eccd4dcf3c940bc1c26f2b2ef89e4fdba78a35c04760 YAML-Syck-1.34.tar.gz"
sha512sums="
18288f54026823e84b2d642d880d7758c5d95ba4b56d3fcf758efe59303ea71a49822d7c000b4c7b0629eccd4dcf3c940bc1c26f2b2ef89e4fdba78a35c04760 YAML-Syck-1.34.tar.gz
4d5f1c2f4af098b92183f3694e8b070fb3cc06e0008c08b151afcc7687b9db7bf82d64221cef023595912eba3143eb5a7f03059059ce5341d65d829a4db204cd gcc15.patch
"

View file

@ -0,0 +1,293 @@
Patch-Source: https://github.com/cpan-authors/YAML-Syck/pull/64
--
From 6a76793b53b7ac37f74fe2f19c880e603f2a8e56 Mon Sep 17 00:00:00 2001
From: Shlomi Fish <shlomif@shlomifish.org>
Date: Thu, 26 Jun 2025 11:02:24 +0300
Subject: [PATCH] Try to fix builds with GCC 15.
See https://github.com/cpan-authors/YAML-Syck/issues/61 .
I hereby put my changes under CC0 / MITL.
---
emitter.c | 18 +++++++++---------
handler.c | 16 ++++++++--------
perl_syck.h | 4 ++--
syck_.c | 9 +++++----
syck_st.c | 12 +++++++-----
syck_st.h | 26 +++++++++++++++-----------
6 files changed, 46 insertions(+), 39 deletions(-)
diff --git a/emitter.c b/emitter.c
index 7f8c9c1..3f10007 100644
--- a/emitter.c
+++ b/emitter.c
@@ -143,7 +143,7 @@ syck_new_emitter()
return e;
}
-int
+enum st_retval
syck_st_free_anchors( char *key, char *name, char *arg )
{
S_FREE( name );
@@ -397,15 +397,15 @@ syck_emit( SyckEmitter *e, st_data_t n )
/* Look for anchor */
if ( e->anchors != NULL &&
- st_lookup( e->markers, n, (st_data_t *)&oid ) &&
- st_lookup( e->anchors, (st_data_t)oid, (st_data_t *)&anchor_name ) )
+ st_lookup( e->markers, (char*)n, (char* *)&oid ) &&
+ st_lookup( e->anchors, (char*)(st_data_t)oid, (char* *)(st_data_t *)&anchor_name ) )
{
if ( e->anchored == NULL )
{
e->anchored = st_init_numtable();
}
- if ( ! st_lookup( e->anchored, (st_data_t)anchor_name, 0 ) )
+ if ( ! st_lookup( e->anchored, (char*)(st_data_t)anchor_name, (char* *)0 ) )
{
char *an = S_ALLOC_N( char, strlen( anchor_name ) + 3 );
sprintf( an, "&%s ", anchor_name );
@@ -419,7 +419,7 @@ syck_emit( SyckEmitter *e, st_data_t n )
syck_emitter_write( e, an, strlen( anchor_name ) + 2 );
free( an );
- st_insert( e->anchored, (st_data_t)anchor_name, 0 );
+ st_insert( e->anchored, (char*)(st_data_t)anchor_name, 0 );
lvl->anctag = 1;
}
else
@@ -1312,13 +1312,13 @@ syck_emitter_mark_node( SyckEmitter *e, st_data_t n, int flags )
* object. Doesn't yet create an anchor, simply notes the
* position.
*/
- if ( ! st_lookup( e->markers, n, (st_data_t *)&oid ) )
+ if ( ! st_lookup( e->markers, (char*)n, (char* *)(st_data_t *)&oid ) )
{
/*
* Store all markers
*/
oid = e->markers->num_entries + 1;
- st_insert( e->markers, n, (st_data_t)oid );
+ st_insert( e->markers, (char*)n, (char*)(st_data_t)oid );
}
else
{
@@ -1327,7 +1327,7 @@ syck_emitter_mark_node( SyckEmitter *e, st_data_t n, int flags )
e->anchors = st_init_numtable();
}
- if ( ! st_lookup( e->anchors, (st_data_t)oid, (st_data_t *)&anchor_name ) )
+ if ( ! st_lookup( e->anchors, (char*)(st_data_t)oid, (char* *)(st_data_t *)&anchor_name ) )
{
int idx = 0;
char *anc = ( e->anchor_format == NULL ? DEFAULT_ANCHOR_FORMAT : e->anchor_format );
@@ -1343,7 +1343,7 @@ syck_emitter_mark_node( SyckEmitter *e, st_data_t n, int flags )
/*
* Insert into anchors table
*/
- st_insert( e->anchors, (st_data_t)oid, (st_data_t)anchor_name );
+ st_insert( e->anchors, (char*)(st_data_t)oid, (char*)(st_data_t)anchor_name );
}
/* XXX - Flag added by BDRACO as the perl_syck.h now has a max_depth - XXX */
diff --git a/handler.c b/handler.c
index 5de4359..61b7d6b 100644
--- a/handler.c
+++ b/handler.c
@@ -46,7 +46,7 @@ syck_hdlr_add_anchor( SyckParser *p, char *a, SyckNode *n )
if ( p->bad_anchors != NULL )
{
SyckNode *bad;
- if ( st_lookup( p->bad_anchors, (st_data_t)a, (st_data_t *)&bad ) )
+ if ( st_lookup( p->bad_anchors, (char*)(st_data_t)a, (char* *)(st_data_t *)&bad ) )
{
if ( n->kind != syck_str_kind )
{
@@ -59,14 +59,14 @@ syck_hdlr_add_anchor( SyckParser *p, char *a, SyckNode *n )
{
p->anchors = st_init_strtable();
}
- if ( st_lookup( p->anchors, (st_data_t)a, (st_data_t *)&ntmp ) )
+ if ( st_lookup( p->anchors, (char*)(st_data_t)a, (char* *)(st_data_t *)&ntmp ) )
{
if ( ntmp != (void *)1 )
{
syck_free_node( ntmp );
}
}
- st_insert( p->anchors, (st_data_t)a, (st_data_t)n );
+ st_insert( p->anchors, (char*)(st_data_t)a, (char*)(st_data_t)n );
return n;
}
@@ -79,14 +79,14 @@ syck_hdlr_remove_anchor( SyckParser *p, char *a )
{
p->anchors = st_init_strtable();
}
- if ( st_delete( p->anchors, (st_data_t *)&atmp, (st_data_t *)&ntmp ) )
+ if ( st_delete( p->anchors, (char* *)(st_data_t *)&atmp, (char* *)(st_data_t *)&ntmp ) )
{
if ( ntmp != (void *)1 )
{
syck_free_node( ntmp );
}
}
- st_insert( p->anchors, (st_data_t)a, (st_data_t)1 );
+ st_insert( p->anchors, (char*)(st_data_t)a, (char*)(st_data_t)1 );
}
SyckNode *
@@ -96,7 +96,7 @@ syck_hdlr_get_anchor( SyckParser *p, char *a )
if ( p->anchors != NULL )
{
- if ( st_lookup( p->anchors, (st_data_t)a, (st_data_t *)&n ) )
+ if ( st_lookup( p->anchors, (char*)(st_data_t)a, (char* *)(st_data_t *)&n ) )
{
if ( n != (void *)1 )
{
@@ -109,10 +109,10 @@ syck_hdlr_get_anchor( SyckParser *p, char *a )
{
p->bad_anchors = st_init_strtable();
}
- if ( ! st_lookup( p->bad_anchors, (st_data_t)a, (st_data_t *)&n ) )
+ if ( ! st_lookup( p->bad_anchors, (char*)(st_data_t)a, (char* *)(st_data_t *)&n ) )
{
n = (p->bad_anchor_handler)( p, a );
- st_insert( p->bad_anchors, (st_data_t)a, (st_data_t)n );
+ st_insert( p->bad_anchors, (char*)(st_data_t)a, (char*)(st_data_t)n );
}
}
}
diff --git a/perl_syck.h b/perl_syck.h
index 14cd311..9685c55 100644
--- a/perl_syck.h
+++ b/perl_syck.h
@@ -828,7 +828,7 @@ yaml_syck_mark_emitter
if (SvROK(sv)) {
PERL_SYCK_MARK_EMITTER(e, SvRV(sv));
#ifdef YAML_IS_JSON
- st_insert(e->markers, (st_data_t)sv, 0);
+ st_insert(e->markers, (char*)(st_data_t)sv, 0);
e->depth--;
#endif
return;
@@ -868,7 +868,7 @@ yaml_syck_mark_emitter
}
#ifdef YAML_IS_JSON
- st_insert(e->markers, (st_data_t)sv, 0);
+ st_insert(e->markers, (char*)(st_data_t)sv, 0);
--e->depth;
#endif
}
diff --git a/syck_.c b/syck_.c
index 8df83bf..4ff783e 100644
--- a/syck_.c
+++ b/syck_.c
@@ -184,7 +184,7 @@ syck_add_sym( SyckParser *p, char *data )
p->syms = st_init_numtable();
}
id = p->syms->num_entries + 1;
- st_insert( p->syms, id, (st_data_t)data );
+ st_insert( p->syms, (char*)id, (char*)(st_data_t)data );
return id;
}
@@ -192,12 +192,13 @@ int
syck_lookup_sym( SyckParser *p, SYMID id, char **data )
{
if ( p->syms == NULL ) return 0;
- return st_lookup( p->syms, id, (st_data_t *)data );
+ return st_lookup( p->syms, (char *)id, (char**)(st_data_t *)data );
}
-int
-syck_st_free_nodes( char *key, SyckNode *n, char *arg )
+enum st_retval
+syck_st_free_nodes( char *key, char * proto_n, char *arg )
{
+ SyckNode *n = (SyckNode *)proto_n;
if ( n != (void *)1 ) syck_free_node( n );
n = NULL;
return ST_CONTINUE;
diff --git a/syck_st.c b/syck_st.c
index 8c4631b..5bb8356 100644
--- a/syck_st.c
+++ b/syck_st.c
@@ -59,14 +59,16 @@ static struct st_hash_type type_strhash = {
strhash,
};
-static void rehash();
+static void rehash(register st_table *table);
#define alloc(type) (type*)malloc((unsigned)sizeof(type))
#define Calloc(n,s) (char*)calloc((n),(s))
-#define EQUAL(table,x,y) ((x)==(y) || (*table->type->compare)((x),(y)) == 0)
+typedef int (*(do_equal_func))(char *, char *);
+#define EQUAL(table,x,y) ((x)==(y) || (((do_equal_func)(*table->type->compare))((x),(y))) == 0)
-#define do_hash(key,table) (unsigned int)(*(table)->type->hash)((key))
+typedef int (*(do_hash_func))(char *);
+#define do_hash(key,table) (unsigned int)((do_hash_func)(*(table)->type->hash))((key))
#define do_hash_bin(key,table) (do_hash(key, table)%(table)->num_bins)
/*
@@ -475,14 +477,14 @@ st_cleanup_safe(table, never)
{
int num_entries = table->num_entries;
- st_foreach(table, (enum st_retval (*)())delete_never, never);
+ st_foreach(table, (enum st_retval (*)(char*, char*, char*))delete_never, never);
table->num_entries = num_entries;
}
void
st_foreach(table, func, arg)
st_table *table;
- enum st_retval (*func)();
+ enum st_retval (*func)(char*, char*, char*);
char *arg;
{
st_table_entry *ptr, *last, *tmp;
diff --git a/syck_st.h b/syck_st.h
index 6397f87..1df8455 100644
--- a/syck_st.h
+++ b/syck_st.h
@@ -24,17 +24,21 @@ struct st_table {
enum st_retval {ST_CONTINUE, ST_STOP, ST_DELETE};
-st_table *st_init_table();
-st_table *st_init_table_with_size();
-st_table *st_init_numtable();
-st_table *st_init_numtable_with_size();
-st_table *st_init_strtable();
-st_table *st_init_strtable_with_size();
-int st_delete(), st_delete_safe();
-int st_insert(), st_lookup();
-void st_foreach(), st_add_direct(), st_free_table(), st_cleanup_safe();
-st_table *st_copy();
-
+st_table * st_init_table(struct st_hash_type * type);
+st_table * st_init_table_with_size(struct st_hash_type * type, int size);
+st_table * st_init_numtable();
+st_table * st_init_numtable_with_size(int size);
+st_table * st_init_strtable();
+st_table * st_init_strtable_with_size(int size);
+int st_delete(register st_table * table, register char ** key, char ** value);
+int st_delete_safe(register st_table * table, register char ** key, char ** value, char * never);
+int st_insert(register st_table * table, register char * key, char * value);
+int st_lookup(st_table * table, register char * key, char ** value);
+void st_foreach(st_table * table, enum st_retval (*func)(char*, char*, char*), char * arg);
+void st_add_direct(st_table * table, char * key, char * value);
+void st_free_table(st_table * table);
+void st_cleanup_safe(st_table * table, char * never);
+st_table * st_copy(st_table * old_table);
#define ST_NUMCMP ((int (*)()) 0)
#define ST_NUMHASH ((int (*)()) -2)