commit:     0be8f27429a4a8aaa19d8401b8786ec74ab9e82f
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Nov  8 04:42:42 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Nov  8 04:42:42 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0be8f274

dev-libs/libtompoly: switch to upstream variant of patch

As I noted in upstream PR, should be equivalent given the actual
uses and inputs to these, but let's be safe and match what
was actually merged.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...y-0.04-Fix-Wimplicit-function-declaration.patch | 64 +++++++++++++---------
 ...ly-0.04-r1.ebuild => libtompoly-0.04-r2.ebuild} |  2 +-
 2 files changed, 38 insertions(+), 28 deletions(-)

diff --git 
a/dev-libs/libtompoly/files/libtompoly-0.04-Fix-Wimplicit-function-declaration.patch
 
b/dev-libs/libtompoly/files/libtompoly-0.04-Fix-Wimplicit-function-declaration.patch
index 49a005d44b1e..f02cc99df63c 100644
--- 
a/dev-libs/libtompoly/files/libtompoly-0.04-Fix-Wimplicit-function-declaration.patch
+++ 
b/dev-libs/libtompoly/files/libtompoly-0.04-Fix-Wimplicit-function-declaration.patch
@@ -1,38 +1,39 @@
-https://github.com/libtom/libtompoly/pull/4
+https://github.com/libtom/libtompoly/commit/2803e69dcc7cac9b470360c984b62198a3774882
 
-From 62f0b57e577cb3ec371042e60eb82ffcd0ae6bd0 Mon Sep 17 00:00:00 2001
+From 2803e69dcc7cac9b470360c984b62198a3774882 Mon Sep 17 00:00:00 2001
 From: Sam James <s...@gentoo.org>
 Date: Wed, 19 Oct 2022 02:21:00 +0100
 Subject: [PATCH] Fix -Wimplicit-function-declaration
 
-Causes build failures with Clang 16.
+Clang 16 will make -Wimplicit-function-declaration error by default.
+
+For more information, see LWN.net [0] or LLVM's Discourse [1], gentoo-dev@ [2],
+or the (new) c-std-porting mailing list [3].
+
+[0] https://lwn.net/Articles/913505/
+[1] 
https://discourse.llvm.org/t/configure-script-breakage-with-the-new-werror-implicit-function-declaration/65213
+[2] 
https://archives.gentoo.org/gentoo-dev/message/dd9f2d3082b8b6f8dfbccb0639e6e240
+[3] hosted at lists.linux.dev.
 
 Bug: https://bugs.gentoo.org/875527
+Signed-off-by: Sam James <s...@gentoo.org>
 --- a/pb_add.c
 +++ b/pb_add.c
-@@ -10,6 +10,7 @@
-  * Tom St Denis, tomstde...@iahu.ca, http://poly.libtomcrypt.org
-  */
- #include <tompoly.h>
-+#include <math.h>
- 
- int pb_add(pb_poly *a, pb_poly *b, pb_poly *c)
- {
-@@ -17,7 +18,7 @@ int pb_add(pb_poly *a, pb_poly *b, pb_poly *c)
+@@ -17,7 +17,7 @@ int pb_add(pb_poly *a, pb_poly *b, pb_poly *c)
     pb_poly *tmp;
  
     /* grow c to be the max size */
 -   y = MAX(a->used, b->used);
-+   y = fmax(a->used, b->used);
++   y = PB_MAX(a->used, b->used);
     if (c->alloc < y) {
        if ((err = pb_grow(c, y)) != MP_OKAY) {
           return err;
-@@ -28,7 +29,7 @@ int pb_add(pb_poly *a, pb_poly *b, pb_poly *c)
+@@ -28,7 +28,7 @@ int pb_add(pb_poly *a, pb_poly *b, pb_poly *c)
     characteristic = mp_iszero(&(c->characteristic));
  
     /* add the terms */
 -   z = MIN(a->used, b->used);
-+   z = fmin(a->used, b->used);
++   z = PB_MIN(a->used, b->used);
     for (x = 0; x < z; x++) {
         if ((err = mp_add(&(a->terms[x]), &(b->terms[x]), &(c->terms[x]))) != 
MP_OKAY) {
            return err;
@@ -89,29 +90,38 @@ Bug: https://bugs.gentoo.org/875527
  {
 --- a/pb_sub.c
 +++ b/pb_sub.c
-@@ -10,6 +10,7 @@
-  * Tom St Denis, tomstde...@iahu.ca, http://poly.libtomcrypt.org
-  */
- #include <tompoly.h>
-+#include <math.h>
- 
- int pb_sub(pb_poly *a, pb_poly *b, pb_poly *c)
- {
-@@ -17,7 +18,7 @@ int pb_sub(pb_poly *a, pb_poly *b, pb_poly *c)
+@@ -17,7 +17,7 @@ int pb_sub(pb_poly *a, pb_poly *b, pb_poly *c)
     pb_poly *tmp;
  
     /* grow c to be the max size */
 -   y = MAX(a->used, b->used);
-+   y = fmax(a->used, b->used);
++   y = PB_MAX(a->used, b->used);
     if (c->alloc < y) {
        if ((err = pb_grow(c, y)) != MP_OKAY) {
           return err;
-@@ -28,7 +29,7 @@ int pb_sub(pb_poly *a, pb_poly *b, pb_poly *c)
+@@ -28,7 +28,7 @@ int pb_sub(pb_poly *a, pb_poly *b, pb_poly *c)
     characteristic = mp_iszero(&(c->characteristic));
  
     /* sub the terms */
 -   z = MIN(a->used, b->used);
-+   z = fmin(a->used, b->used);
++   z = PB_MIN(a->used, b->used);
     for (x = 0; x < z; x++) {
         if ((err = mp_sub(&(a->terms[x]), &(b->terms[x]), &(c->terms[x]))) != 
MP_OKAY) {
            return err;
+--- a/tompoly.h
++++ b/tompoly.h
+@@ -112,4 +112,13 @@ int pb_rawsize(pb_poly *a);
+ int pb_toraw(pb_poly *a, unsigned char *dst);
+ int pb_readraw(pb_poly *a, unsigned char *buf, int len);
+ 
++/* What follows should be in a private header, but it's fine for now like 
that. */
++
++#ifndef PB_MIN
++#define PB_MIN(x, y) (((x) < (y)) ? (x) : (y))
++#endif
++#ifndef PB_MAX
++#define PB_MAX(x, y) (((x) > (y)) ? (x) : (y))
++#endif
++
+ #endif
+

diff --git a/dev-libs/libtompoly/libtompoly-0.04-r1.ebuild 
b/dev-libs/libtompoly/libtompoly-0.04-r2.ebuild
similarity index 91%
rename from dev-libs/libtompoly/libtompoly-0.04-r1.ebuild
rename to dev-libs/libtompoly/libtompoly-0.04-r2.ebuild
index b8fd20681358..8199bd6ce0cd 100644
--- a/dev-libs/libtompoly/libtompoly-0.04-r1.ebuild
+++ b/dev-libs/libtompoly/libtompoly-0.04-r2.ebuild
@@ -5,7 +5,7 @@ EAPI=7
 
 inherit toolchain-funcs
 
-DESCRIPTION="portable ISO C library for polynomial basis arithmetic"
+DESCRIPTION="Portable ISO C library for polynomial basis arithmetic"
 HOMEPAGE="https://www.libtom.net/";
 
SRC_URI="https://github.com/libtom/libtompoly/releases/download/${PV}/ltp-${PV}.tar.bz2";
 

Reply via email to