Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2] package/gmp: Fix for c23
@ 2025-04-24 19:17 Charlie Jenkins
  2025-04-24 21:48 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 2+ messages in thread
From: Charlie Jenkins @ 2025-04-24 19:17 UTC (permalink / raw)
  To: buildroot, Baruch Siach; +Cc: Charlie Jenkins

GMP will not build for a C compiler configured for c23 because its
autoconf scripts use deprecated function prototypes. Include an upstream
patch that fixes this issue.

Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
---
Changes in v2:
- Use autoreconf instead of patching configure
- Link to v1: https://lore.kernel.org/r/20250424-fix_gmp_c23-v1-1-b2474a9585b6@rivosinc.com
---
 ...m4-Add-parameter-names-in-prototype-for-g.patch | 56 ++++++++++++++++++++++
 package/gmp/gmp.mk                                 |  1 +
 2 files changed, 57 insertions(+)

diff --git a/package/gmp/0001-acinclude.m4-Add-parameter-names-in-prototype-for-g.patch b/package/gmp/0001-acinclude.m4-Add-parameter-names-in-prototype-for-g.patch
new file mode 100644
index 0000000000000000000000000000000000000000..339718888d0e1dd6bf0c3601632fceee4eff5f81
--- /dev/null
+++ b/package/gmp/0001-acinclude.m4-Add-parameter-names-in-prototype-for-g.patch
@@ -0,0 +1,56 @@
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 15 Mar 2025 17:58:40 +0100
+Subject: [PATCH] acinclude.m4: Add parameter names in prototype for g().
+
+This allows it to compile with older gcc e.g. gcc-10
+which does not have allow parameter name omission, it results
+in
+
+a.c: In function ‘g’:
+a.c:3:8: error: parameter name omitted
+    3 | void g(int,t1 const*,t1,t2,t1 const*,int){}
+      |        ^~~
+
+this was added to gcc via [1] thats why it is supported in
+newer gcc.
+
+Adding the parameter names make it compatible with
+old and new gcc
+
+[1] https://gcc.gnu.org/pipermail/gcc-cvs/2020-October/336068.html
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+Upstream: https://gmplib.org/list-archives/gmp-devel/2025-March/006294.html
+---
+ ChangeLog    | 4 ++++
+ acinclude.m4 | 2 +-
+ 2 files changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 2902cd2..df42076 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,7 @@
++2025-03-15  Khem Raj <raj.khem at gmail.com>
++
++	* acinclude.m4: Add parameter names to function prototype.
++
+ 2023-07-29  Torbjörn Granlund  <tg@gmplib.org>
+ 
+ 	* Version 6.3.0 released.
+diff --git a/acinclude.m4 b/acinclude.m4
+index 9cf9483..1fd0d4f 100644
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -609,7 +609,7 @@ GMP_PROG_CC_WORKS_PART([$1], [long long reliability test 1],
+ 
+ #if defined (__GNUC__) && ! defined (__cplusplus)
+ typedef unsigned long long t1;typedef t1*t2;
+-void g(){}
++void g(int a,t1 const* b,t1 c,t2 d,t1 const* e,int f){}
+ void h(){}
+ static __inline__ t1 e(t2 rp,t2 up,int n,t1 v0)
+ {t1 c,x,r;int i;if(v0){c=1;for(i=1;i<n;i++){x=up[i];r=x+1;rp[i]=r;}}return c;}
+-- 
+2.43.0
+
diff --git a/package/gmp/gmp.mk b/package/gmp/gmp.mk
index 7e8da9025c93b98b5820f297b6ea3549597395a5..fff211a4f61accce32760885bca2d32ce99c4701 100644
--- a/package/gmp/gmp.mk
+++ b/package/gmp/gmp.mk
@@ -7,6 +7,7 @@
 GMP_VERSION = 6.3.0
 GMP_SITE = $(BR2_GNU_MIRROR)/gmp
 GMP_SOURCE = gmp-$(GMP_VERSION).tar.xz
+GMP_AUTORECONF = YES
 GMP_INSTALL_STAGING = YES
 GMP_LICENSE = LGPL-3.0+ or GPL-2.0+
 GMP_LICENSE_FILES = COPYING.LESSERv3 COPYINGv2

---
base-commit: 1fc51abc27d37c2874823ab864db0f32ae774eb6
change-id: 20250424-fix_gmp_c23-c374e940b045
-- 
- Charlie

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Buildroot] [PATCH v2] package/gmp: Fix for c23
  2025-04-24 19:17 [Buildroot] [PATCH v2] package/gmp: Fix for c23 Charlie Jenkins
@ 2025-04-24 21:48 ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2025-04-24 21:48 UTC (permalink / raw)
  To: Charlie Jenkins; +Cc: buildroot

Hello Charlie,

On Thu, 24 Apr 2025 12:17:26 -0700
Charlie Jenkins <charlie@rivosinc.com> wrote:

> GMP will not build for a C compiler configured for c23 because its
> autoconf scripts use deprecated function prototypes. Include an upstream
> patch that fixes this issue.
> 
> Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
> ---
> Changes in v2:
> - Use autoreconf instead of patching configure
> - Link to v1: https://lore.kernel.org/r/20250424-fix_gmp_c23-v1-1-b2474a9585b6@rivosinc.com

Thanks for this v2.

> diff --git a/package/gmp/0001-acinclude.m4-Add-parameter-names-in-prototype-for-g.patch b/package/gmp/0001-acinclude.m4-Add-parameter-names-in-prototype-for-g.patch
> new file mode 100644
> index 0000000000000000000000000000000000000000..339718888d0e1dd6bf0c3601632fceee4eff5f81
> --- /dev/null
> +++ b/package/gmp/0001-acinclude.m4-Add-parameter-names-in-prototype-for-g.patch
> @@ -0,0 +1,56 @@
> +From: Khem Raj <raj.khem@gmail.com>
> +Date: Sat, 15 Mar 2025 17:58:40 +0100
> +Subject: [PATCH] acinclude.m4: Add parameter names in prototype for g().
> +
> +This allows it to compile with older gcc e.g. gcc-10
> +which does not have allow parameter name omission, it results
> +in
> +
> +a.c: In function ‘g’:
> +a.c:3:8: error: parameter name omitted
> +    3 | void g(int,t1 const*,t1,t2,t1 const*,int){}
> +      |        ^~~
> +
> +this was added to gcc via [1] thats why it is supported in
> +newer gcc.
> +
> +Adding the parameter names make it compatible with
> +old and new gcc
> +
> +[1] https://gcc.gnu.org/pipermail/gcc-cvs/2020-October/336068.html
> +
> +Signed-off-by: Khem Raj <raj.khem at gmail.com>
> +Upstream: https://gmplib.org/list-archives/gmp-devel/2025-March/006294.html

Our policy requires that you add your Signed-off-by right here.


> diff --git a/package/gmp/gmp.mk b/package/gmp/gmp.mk
> index 7e8da9025c93b98b5820f297b6ea3549597395a5..fff211a4f61accce32760885bca2d32ce99c4701 100644
> --- a/package/gmp/gmp.mk
> +++ b/package/gmp/gmp.mk
> @@ -7,6 +7,7 @@
>  GMP_VERSION = 6.3.0
>  GMP_SITE = $(BR2_GNU_MIRROR)/gmp
>  GMP_SOURCE = gmp-$(GMP_VERSION).tar.xz

And here add:

# 0001-acinclude.m4-Add-parameter-names-in-prototype-for-g.patch

> +GMP_AUTORECONF = YES
>  GMP_INSTALL_STAGING = YES
>  GMP_LICENSE = LGPL-3.0+ or GPL-2.0+
>  GMP_LICENSE_FILES = COPYING.LESSERv3 COPYINGv2

Thanks!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-04-24 21:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-24 19:17 [Buildroot] [PATCH v2] package/gmp: Fix for c23 Charlie Jenkins
2025-04-24 21:48 ` Thomas Petazzoni via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox