commit:     04f5a610a10c9a93955c96dd1c5496c7ceae3851
Author:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
AuthorDate: Sat Jan  6 11:40:33 2024 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Sat Jan  6 11:42:43 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=04f5a610

dev-libs/foma: gcc-13 fixes from upstream (open) PRs

Closes: https://bugs.gentoo.org/871411
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 .../foma-0.10-0-fix-BOM_codes-initializer.patch    |  41 ++++++
 dev-libs/foma/files/foma-0.10.0-gcc-13-fixes.patch | 149 +++++++++++++++++++++
 dev-libs/foma/foma-0.10.0_p20220612-r1.ebuild      |  37 +++++
 3 files changed, 227 insertions(+)

diff --git a/dev-libs/foma/files/foma-0.10-0-fix-BOM_codes-initializer.patch 
b/dev-libs/foma/files/foma-0.10-0-fix-BOM_codes-initializer.patch
new file mode 100644
index 000000000000..0aeb26ea9ef3
--- /dev/null
+++ b/dev-libs/foma/files/foma-0.10-0-fix-BOM_codes-initializer.patch
@@ -0,0 +1,41 @@
+From 9a99d2d41809422080606bb49531b38ce1e2111a Mon Sep 17 00:00:00 2001
+From: Florian Weimer <fwei...@redhat.com>
+Date: Thu, 4 Jan 2024 17:15:27 +0100
+Subject: [PATCH] Fix BOM_codes initializer
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Future compilers will reject the current initializer:
+
+io.c:1002:7: error: initialization of ‘char’ from ‘void *’ makes integer from 
pointer without a cast
+ 1002 |     { NULL, 0, NULL },
+      |       ^~~~
+io.c:1002:16: error: initialization of ‘char’ from ‘void *’ makes integer from 
pointer without a cast
+ 1002 |     { NULL, 0, NULL },
+      |                ^~~~
+io.c:996:26: warning: missing braces around initializer [-Wmissing-braces]
+  996 | static BOM BOM_codes[] = {
+      |                          ^
+io.c:996:26: warning: missing braces around initializer [-Wmissing-braces]
+
+
+The reason is that NULL is usually a pointer constant, which is not
+a valid expression for a character.
+---
+ foma/io.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/foma/io.c b/foma/io.c
+index b7bf69b..da1c57a 100644
+--- a/foma/io.c
++++ b/foma/io.c
+@@ -999,7 +999,7 @@ static BOM BOM_codes[] = {
+     { { 0x00, 0x00, 0xFE, 0xFF }, 4, "UTF-32BE" },
+     { { 0xFF, 0xFE }, 2, "UTF16-LE" },
+     { { 0xFE, 0xFF }, 2, "UTF16-BE" },
+-    { NULL, 0, NULL },
++    { { 0, } , 0, NULL },
+ };
+ 
+ BOM *check_BOM(char *buffer) {

diff --git a/dev-libs/foma/files/foma-0.10.0-gcc-13-fixes.patch 
b/dev-libs/foma/files/foma-0.10.0-gcc-13-fixes.patch
new file mode 100644
index 000000000000..32a33cdc6af4
--- /dev/null
+++ b/dev-libs/foma/files/foma-0.10.0-gcc-13-fixes.patch
@@ -0,0 +1,149 @@
+From 24fa34e5f3731e2e6995fba25e31a2dbb9df8bb4 Mon Sep 17 00:00:00 2001
+From: Tino Didriksen <m...@tinodidriksen.com>
+Date: Thu, 15 Jun 2023 08:44:54 +0000
+Subject: [PATCH] Fixes for GCC 13 (see https://bugs.debian.org/1037663) and
+ Visual Studio
+
+---
+ foma/cgflookup.c     | 2 +-
+ foma/constructions.c | 2 +-
+ foma/flookup.c       | 2 +-
+ foma/foma.h          | 2 +-
+ foma/fomalib.h       | 2 +-
+ foma/iface.c         | 4 ++--
+ foma/regex.l         | 2 +-
+ foma/regex.y         | 7 +++++--
+ foma/spelling.c      | 2 +-
+ 9 files changed, 14 insertions(+), 11 deletions(-)
+
+diff --git a/foma/cgflookup.c b/foma/cgflookup.c
+index 1cc11be..1bdfddb 100644
+--- a/foma/cgflookup.c
++++ b/foma/cgflookup.c
+@@ -71,7 +71,7 @@ static FILE *INFILE;
+ static struct lookup_chain *chain_head, *chain_tail, *chain_new, *chain_pos;
+ static fsm_read_binary_handle fsrh;
+ 
+-static char *(*applyer)() = &apply_up;  /* Default apply direction = up */
++static char *(*applyer)(struct apply_handle *h, char *word) = &apply_up;  /* 
Default apply direction = up */
+ static void handle_line(char *s);
+ static void app_print(char *result);
+ static char *get_next_line();
+diff --git a/foma/constructions.c b/foma/constructions.c
+index dec4087..ca66db4 100644
+--- a/foma/constructions.c
++++ b/foma/constructions.c
+@@ -41,7 +41,7 @@ int sort_cmp(const void *a, const void *b) {
+   return (((const struct fsm_state *)a)->state_no - ((const struct fsm_state 
*)b)->state_no);
+ }
+ 
+-INLINE int add_fsm_arc(struct fsm_state *fsm, int offset, int state_no, int 
in, int out, int target, int final_state, int start_state);
++int add_fsm_arc(struct fsm_state *fsm, int offset, int state_no, int in, int 
out, int target, int final_state, int start_state);
+ 
+ struct fsm *fsm_kleene_closure(struct fsm *net, int optionality);
+ 
+diff --git a/foma/flookup.c b/foma/flookup.c
+index 971549d..ecd3db3 100644
+--- a/foma/flookup.c
++++ b/foma/flookup.c
+@@ -77,7 +77,7 @@ static FILE *INFILE;
+ static struct lookup_chain *chain_head, *chain_tail, *chain_new, *chain_pos;
+ static fsm_read_binary_handle fsrh;
+ 
+-static char *(*applyer)() = &apply_up;  /* Default apply direction = up */
++static char *(*applyer)(struct apply_handle *h, char *word) = &apply_up;  /* 
Default apply direction = up */
+ static void handle_line(char *s);
+ static void app_print(char *result);
+ static char *get_next_line();
+diff --git a/foma/foma.h b/foma/foma.h
+index 06cb9f7..f5a5bfb 100644
+--- a/foma/foma.h
++++ b/foma/foma.h
+@@ -113,7 +113,7 @@ void iface_print_shortest_string();
+ void iface_print_shortest_string_size();
+ void iface_print_name(void);
+ void iface_quit(void);
+-void iface_apply_random(char *(*applyer)(), int limit);
++void iface_apply_random(char *(*applyer)(struct apply_handle *h), int limit);
+ void iface_random_lower(int limit);
+ void iface_random_upper(int limit);
+ void iface_random_words(int limit);
+diff --git a/foma/fomalib.h b/foma/fomalib.h
+index 6f0218a..d937d15 100644
+--- a/foma/fomalib.h
++++ b/foma/fomalib.h
+@@ -307,7 +307,7 @@ FEXPORT struct fsm *flag_eliminate(struct fsm *net, char 
*name);
+ FEXPORT struct fsm *flag_twosided(struct fsm *net);
+ 
+ /* Compile a rewrite rule */
+-FEXPORT struct fsm *fsm_rewrite();
++FEXPORT struct fsm *fsm_rewrite(struct rewrite_set *all_rules);
+ 
+ /* Boolean tests */
+ FEXPORT int fsm_isempty(struct fsm *net);
+diff --git a/foma/iface.c b/foma/iface.c
+index f41e3ce..7ebd569 100644
+--- a/foma/iface.c
++++ b/foma/iface.c
+@@ -790,7 +790,7 @@ void iface_random_words(int limit) {
+     iface_apply_random(&apply_random_words, limit);
+ }
+ 
+-void iface_apply_random(char *(*applyer)(), int limit) {
++void iface_apply_random(char *(*applyer)(struct apply_handle *h), int limit) {
+     char *result;
+     struct apply_handle *ah;
+     int i;
+@@ -1230,7 +1230,7 @@ void iface_words_file(char *filename, int type) {
+     /* type 0 (words), 1 (upper-words), 2 (lower-words) */
+     FILE *outfile;
+     char *result;
+-    static char *(*applyer)() = &apply_words;
++    static char *(*applyer)(struct apply_handle *h) = &apply_words;
+     struct apply_handle *ah;
+ 
+     if (type == 1) {
+diff --git a/foma/regex.l b/foma/regex.l
+index c303a40..8e3f1e5 100644
+--- a/foma/regex.l
++++ b/foma/regex.l
+@@ -49,7 +49,7 @@ struct parser_vars {
+ struct parser_vars parservarstack[MAX_PARSE_DEPTH];
+ int g_parse_depth = 0;
+ 
+-extern int yyparse();
++extern int yyparse(void *scanner, struct defined_networks *defined_nets, 
struct defined_functions *defined_funcs);
+ extern int get_iface_lineno(void);
+ extern int rewrite, rule_direction, substituting;
+ extern struct fsmcontexts *contexts;
+diff --git a/foma/regex.y b/foma/regex.y
+index eb00e5e..60ab2a4 100644
+--- a/foma/regex.y
++++ b/foma/regex.y
+@@ -21,8 +21,11 @@
+ #include <string.h>
+ #include "foma.h"
+ #define MAX_F_RECURSION 100
+-extern int yyerror();
+-extern int yylex();
++typedef void* yyscan_t;
++typedef struct YYLTYPE YYLTYPE;
++typedef union YYSTYPE YYSTYPE;
++extern int yyerror(YYLTYPE* yylloc, yyscan_t scanner, struct defined_networks 
*defined_nets, struct defined_functions *defined_funcs, char *msg);
++extern int yylex(YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t 
yyscanner);
+ extern int my_yyparse(char *my_string, int lineno, struct defined_networks 
*defined_nets, struct defined_functions *defined_funcs);
+ struct fsm *current_parse;
+ int rewrite, rule_direction;
+diff --git a/foma/spelling.c b/foma/spelling.c
+index ab11e98..ac92bd0 100644
+--- a/foma/spelling.c
++++ b/foma/spelling.c
+@@ -37,7 +37,7 @@
+ #define min_(X, Y)  ((X) < (Y) ? (X) : (Y))
+ 
+ static int calculate_h(struct apply_med_handle *medh, int *intword, int 
currpos, int state);
+-static struct astarnode *node_delete_min();
++static struct astarnode *node_delete_min(struct apply_med_handle *medh);
+ int node_insert(struct apply_med_handle *medh, int wordpos, int fsmstate, int 
g, int h, int in, int out, int parent);
+ 
+ char *print_sym(int sym, struct sigma *sigma) {

diff --git a/dev-libs/foma/foma-0.10.0_p20220612-r1.ebuild 
b/dev-libs/foma/foma-0.10.0_p20220612-r1.ebuild
new file mode 100644
index 000000000000..c6e37a343f7b
--- /dev/null
+++ b/dev-libs/foma/foma-0.10.0_p20220612-r1.ebuild
@@ -0,0 +1,37 @@
+# Copyright 2022-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake
+
+MY_COMMIT="9e8c3df573015a26c84e113ba710ef3d57c8e777"
+
+DESCRIPTION="Multi-purpose finite-state toolkit"
+HOMEPAGE="https://fomafst.github.io/ https://github.com/mhulden/foma";
+SRC_URI="https://github.com/mhulden/foma/archive/${MY_COMMIT}.tar.gz -> 
${P}.tar.gz"
+
+LICENSE="Apache-2.0"
+SLOT="0/0.10"
+KEYWORDS="~amd64 ~x86"
+
+BDEPEND="sys-devel/bison
+       sys-devel/flex"
+DEPEND="sys-libs/readline:=
+       sys-libs/zlib"
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}/foma-${MY_COMMIT}/foma"
+
+src_prepare() {
+       cmake_src_prepare
+
+       cd "${WORKDIR}/foma-${MY_COMMIT}" || die
+       eapply "${FILESDIR}"/foma-0.10.0-gcc-13-fixes.patch
+       eapply "${FILESDIR}"/foma-0.10-0-fix-BOM_codes-initializer.patch
+}
+
+src_install() {
+       cmake_src_install
+       find "${D}" -name '*.a' -delete || die
+}

Reply via email to