commit:     e654b5e511fa528838ce055239a7a6f9f704b339
Author:     David Seifert <soap <AT> gentoo <DOT> org>
AuthorDate: Sun May  7 18:35:20 2023 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Sun May  7 18:35:20 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e654b5e5

dev-libs/link-grammar: add upstreamed patch

Closes: https://bugs.gentoo.org/903749
Signed-off-by: David Seifert <soap <AT> gentoo.org>

 ...mar-5.12.3-Wimplicit-function-declaration.patch | 35 ++++++++++++++++++++++
 dev-libs/link-grammar/link-grammar-5.12.3.ebuild   |  5 ++++
 2 files changed, 40 insertions(+)

diff --git 
a/dev-libs/link-grammar/files/link-grammar-5.12.3-Wimplicit-function-declaration.patch
 
b/dev-libs/link-grammar/files/link-grammar-5.12.3-Wimplicit-function-declaration.patch
new file mode 100644
index 000000000000..55ca89c09b94
--- /dev/null
+++ 
b/dev-libs/link-grammar/files/link-grammar-5.12.3-Wimplicit-function-declaration.patch
@@ -0,0 +1,35 @@
+From 3cbc9ddfd4c3a3e407338619fa383d24da05b23d Mon Sep 17 00:00:00 2001
+From: David Seifert <[email protected]>
+Date: Sun, 7 May 2023 16:02:23 +0200
+Subject: [PATCH] Use correct guard macro for glibc heap functions
+
+* `__GNUC__` == Compiling with `-std=gnu*`
+* `__GLIBC__` == Compiling against glibc
+
+Bug: https://bugs.gentoo.org/903749
+---
+ link-grammar/parse/extract-links.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/link-grammar/parse/extract-links.c 
b/link-grammar/parse/extract-links.c
+index a6129ac7a..e2ce266bc 100644
+--- a/link-grammar/parse/extract-links.c
++++ b/link-grammar/parse/extract-links.c
+@@ -278,7 +278,7 @@ void free_extractor(extractor_t * pex)
+       pex->x_table_size = 0;
+       pex->x_table = NULL;
+ 
+-#if defined __GNUC__
++#if defined __GLIBC__
+       // MST parsing can result in pathological cases, with almost a
+       // billion elts in the Parse_choice_pool. This blows up the
+       // resident-set size (RSS) over time. Avoid this issue by trimming.
+@@ -294,7 +294,7 @@ void free_extractor(extractor_t * pex)
+ 
+       xfree((void *) pex, sizeof(extractor_t));
+ 
+-#if defined __GNUC__
++#if defined __GLIBC__
+       // malloc_trim() is a gnu extension.  An alternative would be
+       // to call madvise(MADV_DONTNEED) but this is more complicated.
+       if (trim) malloc_trim(0);

diff --git a/dev-libs/link-grammar/link-grammar-5.12.3.ebuild 
b/dev-libs/link-grammar/link-grammar-5.12.3.ebuild
index 8aa2ad28347d..ad2d6ce3d75f 100644
--- a/dev-libs/link-grammar/link-grammar-5.12.3.ebuild
+++ b/dev-libs/link-grammar/link-grammar-5.12.3.ebuild
@@ -31,6 +31,11 @@ BDEPEND="
        sys-devel/autoconf-archive
        virtual/pkgconfig"
 
+PATCHES=(
+       # upstreamed (https://github.com/opencog/link-grammar/pull/1471)
+       "${FILESDIR}"/${P}-Wimplicit-function-declaration.patch
+)
+
 pkg_setup() {
        if use aspell && use hunspell; then
                ewarn "You have enabled 'aspell' and 'hunspell' support, but 
both cannot coexist,"

Reply via email to