[PATCH] acinclude.m4: fix -std=c23 build failure
Rudi Heitbaum
rudi at heitbaum.com
Wed Jan 22 02:34:05 CET 2025
Hi Vincent,
Thanks for the review and suggestion. I have updated the patch as V2.
Regards
Rudi
On Wed, 22 Jan 2025 at 01:38, Vincent Lefevre <vincent at vinc17.net> wrote:
> On 2025-01-21 10:33:34 +0000, Rudi Heitbaum wrote:
> > Add prototype to configure test function as c23 removes unprototyped
> > functions.
> >
> > gcc-15 switched to -std=c23 by default:
> >
> >
> https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=55e3bd376b2214e200fa76d12b67ff259b06c212
> >
> > As a result `configure` fails with:
> > conftest.c: In function 'f':
> > conftest.c:12:48: error: too many arguments to function 'g';
> expected 0, have 6
> > 12 |
> for(i=0;i<1;i++){if(e(got,got,9,d[i].n)==0)h();g(i,d[i].src,d[i].n,got,d[i].want,9);if(d[i].n)h();}}
> > | ^ ~
> > conftest.c:7:6: note: declared here
> > 7 | void g(){}
> > | ^
>
> Note that this was already reported.
>
> > Link:
> https://gmplib.org/list-archives/gmp-bugs/2024-November/005550.html
> > Signed-off-by: Rudi Heitbaum <rudi at heitbaum.com>
> > ---
> > acinclude.m4 | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/acinclude.m4 b/acinclude.m4
> > index fddb5fb07a..2d41de6328 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(...){}
>
> Please don't. The (...) form is dirty and new, and not supported by
> all compilers, e.g. even GCC 12:
>
> tst2.c:1:8: error: ISO C requires a named argument before ‘...’
> 1 | void g(...){}
> | ^~~
>
> The only good solution is to provide the prototype so that
> type checking can be done.
>
> --
> Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
>
More information about the gmp-devel
mailing list