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>
This commit is contained in:
H.J. Lu
2025-01-12 15:14:38 +08:00
parent b5b9f92635
commit fd7728c8a4
6 changed files with 12 additions and 18 deletions

View File

@@ -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 ();

View File

@@ -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;
}

View File

@@ -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 ()

View File

@@ -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];
}

View File

@@ -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 ();

View File

@@ -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;
}