public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* Fix various v850 problems
@ 2023-12-17  5:20 Jeff Law
  2023-12-19 18:27 ` Jeff Johnston
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Law @ 2023-12-17  5:20 UTC (permalink / raw)
  To: newlib

[-- Attachment #1: Type: text/plain, Size: 523 bytes --]


These fixes fall into a few different buckets.  First c99 doesn't allow 
a parameter without a type.  So in cases where the type had previously 
been an implicit int, make it an explicit int.  Second, for return 
values, don't allow them to be implicit ints either, make them explicit. 
In a few cases change c89 function definitions to c99 function 
definitions.   Lastly include <stdlib.h> in sbrk.c to get the prototype 
for abort () which we call when we detect a heap/stack collision.

OK for the trunk?

Thanks,
Jeff

[-- Attachment #2: P --]
[-- Type: text/plain, Size: 2541 bytes --]

diff --git a/newlib/libc/sys/sysnecv850/_exit.c b/newlib/libc/sys/sysnecv850/_exit.c
index 44d4132bd..7e1b09262 100644
--- a/newlib/libc/sys/sysnecv850/_exit.c
+++ b/newlib/libc/sys/sysnecv850/_exit.c
@@ -23,7 +23,7 @@ static void _do_dtors()
 }
 
 
-void _exit (n)
+void _exit (int n)
 {
   /* Destructors should be done earlier because they need to be done before the
      files are closed, but here is better than nowhere (and this balances the
diff --git a/newlib/libc/sys/sysnecv850/getpid.c b/newlib/libc/sys/sysnecv850/getpid.c
index 32ac7fbfb..f0fc4d895 100644
--- a/newlib/libc/sys/sysnecv850/getpid.c
+++ b/newlib/libc/sys/sysnecv850/getpid.c
@@ -9,7 +9,8 @@ int __trap0 (int function, int p1, int p2, int p3);
 
 #define TRAP0(f, p1, p2, p3) __trap0(f, (int)(p1), (int)(p2), (int)(p3))
 
-_getpid (n)
+int
+_getpid (int n)
 {
   return 1;
 }
diff --git a/newlib/libc/sys/sysnecv850/isatty.c b/newlib/libc/sys/sysnecv850/isatty.c
index 248ab5248..6e4f205f0 100644
--- a/newlib/libc/sys/sysnecv850/isatty.c
+++ b/newlib/libc/sys/sysnecv850/isatty.c
@@ -9,8 +9,8 @@ int __trap0 (int function, int p1, int p2, int p3);
 
 #define TRAP0(f, p1, p2, p3) __trap0(f, (int)(p1), (int)(p2), (int)(p3))
 
-_isatty (fd)
-     int fd;
+int
+_isatty (int fd)
 {
   return 1;
 }
diff --git a/newlib/libc/sys/sysnecv850/kill.c b/newlib/libc/sys/sysnecv850/kill.c
index 34e5db793..562eaf6c7 100644
--- a/newlib/libc/sys/sysnecv850/kill.c
+++ b/newlib/libc/sys/sysnecv850/kill.c
@@ -10,9 +10,8 @@ int __trap0 (int function, int p1, int p2, int p3);
 
 #define TRAP0(f, p1, p2, p3) __trap0(f, (int)(p1), (int)(p2), (int)(p3))
 
-_kill (pid, sig)
-     pid_t pid;
-     int sig;
+int
+_kill (pid_t pid, int sig)
 {
   return TRAP0 (SYS_exit, 0xdead0000 | sig, 0, 0);
 }
diff --git a/newlib/libc/sys/sysnecv850/read.c b/newlib/libc/sys/sysnecv850/read.c
index b55d1cb9e..5ae2c9799 100644
--- a/newlib/libc/sys/sysnecv850/read.c
+++ b/newlib/libc/sys/sysnecv850/read.c
@@ -9,6 +9,7 @@ int __trap0 (int function, int p1, int p2, int p3);
 
 #define TRAP0(f, p1, p2, p3) __trap0(f, (int)(p1), (int)(p2), (int)(p3))
 
+int
 _read (int file,
        char *ptr,
        int len)
diff --git a/newlib/libc/sys/sysnecv850/sbrk.c b/newlib/libc/sys/sysnecv850/sbrk.c
index 2893c322f..b5673d467 100644
--- a/newlib/libc/sys/sysnecv850/sbrk.c
+++ b/newlib/libc/sys/sysnecv850/sbrk.c
@@ -2,7 +2,9 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include "sys/syscall.h"
+#include <stdlib.h>
 
+extern int _write (int, char *, int);
 caddr_t
 _sbrk (int incr)
 {

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Fix various v850 problems
  2023-12-17  5:20 Fix various v850 problems Jeff Law
@ 2023-12-19 18:27 ` Jeff Johnston
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Johnston @ 2023-12-19 18:27 UTC (permalink / raw)
  To: Jeff Law; +Cc: newlib

[-- Attachment #1: Type: text/plain, Size: 666 bytes --]

Please go ahead.

-- Jeff J.

On Sun, Dec 17, 2023 at 12:20 AM Jeff Law <jeffreyalaw@gmail.com> wrote:

>
> These fixes fall into a few different buckets.  First c99 doesn't allow
> a parameter without a type.  So in cases where the type had previously
> been an implicit int, make it an explicit int.  Second, for return
> values, don't allow them to be implicit ints either, make them explicit.
> In a few cases change c89 function definitions to c99 function
> definitions.   Lastly include <stdlib.h> in sbrk.c to get the prototype
> for abort () which we call when we detect a heap/stack collision.
>
> OK for the trunk?
>
> Thanks,
> Jeff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-12-19 18:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-17  5:20 Fix various v850 problems Jeff Law
2023-12-19 18:27 ` Jeff Johnston

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).