[newlib-cygwin/main] Fix missing declarations in libgloss m68k

Corinna Vinschen corinna@sourceware.org
Mon Aug 4 09:44:20 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=22580ced9ac9af2a1e3068863bebecf738e33458

commit 22580ced9ac9af2a1e3068863bebecf738e33458
Author:     Jean-Paul Mari <djipi.mari@gmail.com>
AuthorDate: Fri Jun 27 06:57:15 2025 -0400
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Mon Aug 4 11:39:58 2025 +0200

    Fix missing declarations in libgloss m68k
    
    This patch adds missing function declarations in several m68k-specific
    libgloss source files.  This helps avoid implicit declaration compiler
    warnings / errors and ensures better portability.
    
    Tested by building newlib for m68k-elf with GCC.

Diff:
---
 libgloss/m68k/leds.c       | 2 ++
 libgloss/m68k/mc68ec.c     | 2 +-
 libgloss/m68k/sim-abort.c  | 3 +++
 libgloss/m68k/sim-funcs.c  | 1 +
 libgloss/m68k/sim-inbyte.c | 2 ++
 libgloss/m68k/sim-print.c  | 2 ++
 libgloss/m68k/sim-sbrk.c   | 2 ++
 7 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/libgloss/m68k/leds.c b/libgloss/m68k/leds.c
index b9112376ddce..96904762b93f 100644
--- a/libgloss/m68k/leds.c
+++ b/libgloss/m68k/leds.c
@@ -15,6 +15,8 @@
  */
 #include "leds.h"
 
+extern void delay(int);
+
 /*
  * led_putnum -- print a hex number on the LED. the value of num must be a char with
  *              the ascii value. ie... number 0 is '0', a is 'a', ' ' (null) clears
diff --git a/libgloss/m68k/mc68ec.c b/libgloss/m68k/mc68ec.c
index 76e737fe7320..5543defb3af6 100644
--- a/libgloss/m68k/mc68ec.c
+++ b/libgloss/m68k/mc68ec.c
@@ -25,7 +25,7 @@
  *          prompt. It can be restarted from there.
  */
 void
-_exit (int_status)
+_exit (int status)
 {
   /* Use `i' constraint to get proper immediate-operand syntax for
      target assembler configuration.  */
diff --git a/libgloss/m68k/sim-abort.c b/libgloss/m68k/sim-abort.c
index 4960de8f8cae..affc2c672452 100644
--- a/libgloss/m68k/sim-abort.c
+++ b/libgloss/m68k/sim-abort.c
@@ -14,6 +14,9 @@
  * they apply.
  */
 
+#include <stdlib.h>
+#include <unistd.h>
+
 void abort(void)
 {
   write (2, "Abort called.\n", sizeof("Abort called.\n")-1);
diff --git a/libgloss/m68k/sim-funcs.c b/libgloss/m68k/sim-funcs.c
index 712c566b260e..865e752f4e9b 100644
--- a/libgloss/m68k/sim-funcs.c
+++ b/libgloss/m68k/sim-funcs.c
@@ -15,6 +15,7 @@
 
 #define _XOPEN_SOURCE
 #include <unistd.h>
+#include <stdlib.h>
 
 int
 kill(int pid, int sig)
diff --git a/libgloss/m68k/sim-inbyte.c b/libgloss/m68k/sim-inbyte.c
index 3fa3f24740f7..7d2c9725402c 100644
--- a/libgloss/m68k/sim-inbyte.c
+++ b/libgloss/m68k/sim-inbyte.c
@@ -14,6 +14,8 @@
  * they apply.
  */
 
+#include <unistd.h>
+
 int
 inbyte ()
 {
diff --git a/libgloss/m68k/sim-print.c b/libgloss/m68k/sim-print.c
index 18ca02261afd..907c5414469e 100644
--- a/libgloss/m68k/sim-print.c
+++ b/libgloss/m68k/sim-print.c
@@ -13,6 +13,8 @@
  * they apply.
  */
 
+#include <unistd.h>
+
 /*
  * print -- do a raw print of a string
  */ 
diff --git a/libgloss/m68k/sim-sbrk.c b/libgloss/m68k/sim-sbrk.c
index 83e5287eb5a6..771eecf068b2 100644
--- a/libgloss/m68k/sim-sbrk.c
+++ b/libgloss/m68k/sim-sbrk.c
@@ -14,6 +14,8 @@
  * they apply.
  */
 
+extern int brk(void *addr);
+
 extern char _end[];
 static char *curbrk = _end;


More information about the Newlib-cvs mailing list