ld: Update function prototypes for compilers defaulting to -std=gnu23
Checks
Commit Message
Since GCC 15 defaults to -std=gnu23, update function prototypes in linker
tests for compilers defaulting to -std=gnu23.
PR ld/32546
* ld-shared/main.c (shlib_checkfunptr1): Update prototype for
compilers defaulting to -std=gnu23.
(shlib_checkfunptr2): Likewise.
* ld-shared/sh1.c (shlib_checkfunptr1): Likewise.
(shlib_checkfunptr2): Likewise.
* ld-srec/sr1.c (fn1): Likewise.
(fn2): Likewise.
* ld-srec/sr2.c (fn1): Likewise.
(fn2): Likewise.
* ld-vsb/main.c (shlib_checkfunptr1): Likewise.
(shlib_checkfunptr2): Likewise.
* ld-vsb/sh1.c (hlib_checkfunptr1): Likewise.
(shlib_checkfunptr2): Likewise.
Comments
"H.J. Lu" <hjl.tools@gmail.com> writes:
> Since GCC 15 defaults to -std=gnu23, update function prototypes in linker
> tests for compilers defaulting to -std=gnu23.
>
> PR ld/32546
> * ld-shared/main.c (shlib_checkfunptr1): Update prototype for
> compilers defaulting to -std=gnu23.
> (shlib_checkfunptr2): Likewise.
> * ld-shared/sh1.c (shlib_checkfunptr1): Likewise.
> (shlib_checkfunptr2): Likewise.
> * ld-srec/sr1.c (fn1): Likewise.
> (fn2): Likewise.
> * ld-srec/sr2.c (fn1): Likewise.
> (fn2): Likewise.
> * ld-vsb/main.c (shlib_checkfunptr1): Likewise.
> (shlib_checkfunptr2): Likewise.
> * ld-vsb/sh1.c (hlib_checkfunptr1): Likewise.
> (shlib_checkfunptr2): Likewise.
Thanks! LGTM.
=== ld Summary ===
-# of expected passes 3015
-# of expected failures 27
+# of expected passes 3040
+# of expected failures 60
# of untested testcases 1
-# of unsupported tests 74
+# of unsupported tests 28
./ld-new 2.43.50.20250112
On Sun, Jan 12, 2025 at 4:35 PM Sam James <sam@gentoo.org> wrote:
>
> "H.J. Lu" <hjl.tools@gmail.com> writes:
>
> > Since GCC 15 defaults to -std=gnu23, update function prototypes in linker
> > tests for compilers defaulting to -std=gnu23.
> >
> > PR ld/32546
> > * ld-shared/main.c (shlib_checkfunptr1): Update prototype for
> > compilers defaulting to -std=gnu23.
> > (shlib_checkfunptr2): Likewise.
> > * ld-shared/sh1.c (shlib_checkfunptr1): Likewise.
> > (shlib_checkfunptr2): Likewise.
> > * ld-srec/sr1.c (fn1): Likewise.
> > (fn2): Likewise.
> > * ld-srec/sr2.c (fn1): Likewise.
> > (fn2): Likewise.
> > * ld-vsb/main.c (shlib_checkfunptr1): Likewise.
> > (shlib_checkfunptr2): Likewise.
> > * ld-vsb/sh1.c (hlib_checkfunptr1): Likewise.
> > (shlib_checkfunptr2): Likewise.
>
> Thanks! LGTM.
>
> === ld Summary ===
>
> -# of expected passes 3015
> -# of expected failures 27
> +# of expected passes 3040
> +# of expected failures 60
> # of untested testcases 1
> -# of unsupported tests 74
> +# of unsupported tests 28
> ./ld-new 2.43.50.20250112
I am checking it in.
From fb6f02672061a2134b543a4e317288339bb179db Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Sun, 12 Jan 2025 15:14:38 +0800
Subject: [PATCH] ld: Update function prototypes for compilers defaulting to
-std=gnu23
Since GCC 15 defaults to -std=gnu23, update function prototypes in linker
tests for compilers defaulting to -std=gnu23.
PR ld/32546
* ld-shared/main.c (shlib_checkfunptr1): Update prototype for
compilers defaulting to -std=gnu23.
(shlib_checkfunptr2): Likewise.
* ld-shared/sh1.c (shlib_checkfunptr1): Likewise.
(shlib_checkfunptr2): Likewise.
* ld-srec/sr1.c (fn1): Likewise.
(fn2): Likewise.
* ld-srec/sr2.c (fn1): Likewise.
(fn2): Likewise.
* ld-vsb/main.c (shlib_checkfunptr1): Likewise.
(shlib_checkfunptr2): Likewise.
* ld-vsb/sh1.c (hlib_checkfunptr1): Likewise.
(shlib_checkfunptr2): Likewise.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
ld/testsuite/ld-shared/main.c | 4 ++--
ld/testsuite/ld-shared/sh1.c | 6 ++----
ld/testsuite/ld-srec/sr1.c | 4 ++--
ld/testsuite/ld-srec/sr2.c | 6 ++----
ld/testsuite/ld-vsb/main.c | 4 ++--
ld/testsuite/ld-vsb/sh1.c | 6 ++----
6 files changed, 12 insertions(+), 18 deletions(-)
@@ -12,8 +12,8 @@ extern int shlib_shlibvar1 ();
extern int shlib_shlibvar2 ();
extern int shlib_shlibcall ();
extern int shlib_maincall ();
-extern int shlib_checkfunptr1 ();
-extern int shlib_checkfunptr2 ();
+extern int shlib_checkfunptr1 (int (*) ());
+extern int shlib_checkfunptr2 (int (*) ());
extern int (*shlib_getfunptr1 ()) ();
extern int (*shlib_getfunptr2 ()) ();
extern int shlib_check ();
@@ -83,8 +83,7 @@ shlib_maincall ()
confirms that the pointer compares equally. */
int
-shlib_checkfunptr1 (p)
- int (*p) ();
+shlib_checkfunptr1 (int (*p) ())
{
return p == shlib_shlibvar1;
}
@@ -93,8 +92,7 @@ shlib_checkfunptr1 (p)
confirms that the pointer compares equally. */
int
-shlib_checkfunptr2 (p)
- int (*p) ();
+shlib_checkfunptr2 (int (*p) ())
{
return p == main_called;
}
@@ -8,8 +8,8 @@ static int k;
static int l = 1;
static char ab[] = "This is a string constant";
-extern int fn1 ();
-extern int fn2 ();
+extern int fn1 (char *);
+extern int fn2 (char *);
int
main ()
@@ -4,15 +4,13 @@ int e1;
int e2 = 1;
int
-fn1 (s)
- char *s;
+fn1 (char *s)
{
return s[e1];
}
int
-fn2 (s)
- char *s;
+fn2 (char *s)
{
return s[e2];
}
@@ -29,8 +29,8 @@ extern int shlib_shlibvar1 ();
extern int shlib_shlibvar2 ();
extern int shlib_shlibcall ();
extern int shlib_maincall ();
-extern int shlib_checkfunptr1 ();
-extern int shlib_checkfunptr2 ();
+extern int shlib_checkfunptr1 (int (*) ());
+extern int shlib_checkfunptr2 (int (*) ());
extern int (*shlib_getfunptr1 ()) ();
extern int (*shlib_getfunptr2 ()) ();
extern int shlib_check ();
@@ -103,8 +103,7 @@ shlib_maincall ()
confirms that the pointer compares equally. */
int
-shlib_checkfunptr1 (p)
- int (*p) ();
+shlib_checkfunptr1 (int (*p) ())
{
return p == shlib_shlibvar1;
}
@@ -113,8 +112,7 @@ shlib_checkfunptr1 (p)
confirms that the pointer compares equally. */
int
-shlib_checkfunptr2 (p)
- int (*p) ();
+shlib_checkfunptr2 (int (*p) ())
{
return p == main_called;
}
--
2.47.1