[COMMITTED] libgloss: cris: Correct lcrt0.c for C23

Hans-Peter Nilsson <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
With this, a combined build (gcc+newlib) for --target=cris-elf gets no
new regressions at r15-5326-gf242f79b8afe.  FWIW, there are lots of
warnings (156 for cris-elf with its three multilibs) for "old-style
function definition [-Wold-style-definition]" in the generic parts of
newlib.

Committed.

-- >8 --
GCC commit r15-5326-gf242f79b8afe defaults to -std=gnu23, and in C23
void foo() means void foo(void), so old-style prototypes now get a
compilation error:

/x/libgloss/cris/lcrt0.c:107:1: error: conflicting types for 'start1';\
 have 'void(int,  char **, char **)'
  107 | start1 (int argc, char **argv, char **env)
      | ^~~~~~
/x/libgloss/cris/lcrt0.c:105:13: note: previous declaration of 'start1\
' with type 'void(void)'
  105 | static void start1 () __asm__ ("__start1") __attribute ((__use\
d__));

Fix by providing a full prototype.
---
 libgloss/cris/lcrt0.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libgloss/cris/lcrt0.c b/libgloss/cris/lcrt0.c
index 0aae3c279719..c1406155aee5 100644
--- a/libgloss/cris/lcrt0.c
+++ b/libgloss/cris/lcrt0.c
@@ -1,5 +1,5 @@
 /* Support for cris*-axis-linux-gnu and src/sim/cris simulator.
-   Copyright (C) 2000-2005, 2017, 2023 Axis Communications.
+   Copyright (C) 2000-2005, 2017, 2023, 2024 Axis Communications.
    All rights reserved.
 
    Redistribution and use in source and binary forms, with or without
@@ -102,7 +102,7 @@ extern void __init__start (void) __attribute ((weak));
 extern void __aout__ctors (void) __attribute ((weak));
 extern int main (int argc, char **argv, char **env);
 
-static void start1 () __asm__ ("__start1") __attribute ((__used__));
+static void start1 (int, char **, char **) __asm__ ("__start1") __attribute ((__used__));
 static void
 start1 (int argc, char **argv, char **env)
 {
-- 
2.30.2

brgds, H-P
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.