From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2119) id A1AEF3858439; Wed, 20 Dec 2023 03:56:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A1AEF3858439 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1703044576; bh=yPOyKXNV+9x2VA9z8mhPlDgHZ1M3io9uVlqsoQGvMFU=; h=From:To:Subject:Date:From; b=Wl6qy95H5YcRMxGAcDmnA+j1ea3zrxhq3jb1uIsFYo1wLwwoKuQy9xsZGxB78JgQ+ a0P3CtHeXlEpm9IgOUpaAY6fryYUjQIMqaPsQwhBMXAcUuIS+hRW/FYQoWl+OBH8ub hTLaFJNCkL9Tdyr6rbHUmrMSwihDIg7zcc1GBx3Y= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Jeff Law To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] Fix various v850 problems X-Act-Checkin: newlib-cygwin X-Git-Author: Jeff Law X-Git-Refname: refs/heads/master X-Git-Oldrev: 30c469f2e83023b9f77b1771f539006267c632a9 X-Git-Newrev: c1a61029fedbad16bfd6978be13d62412bdede49 Message-Id: <20231220035616.A1AEF3858439@sourceware.org> Date: Wed, 20 Dec 2023 03:56:16 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3Dc1a61029fed= bad16bfd6978be13d62412bdede49 commit c1a61029fedbad16bfd6978be13d62412bdede49 Author: Jeff Law Date: Tue Dec 19 20:54:37 2023 -0700 Fix various v850 problems =20 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 be= en 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 cha= nge c89 function definitions to c99 function definitions. Lastly include in sbrk.c to get the prototype for abort () which we call when we detec= t a heap/stack collision. Diff: --- newlib/libc/sys/sysnecv850/_exit.c | 2 +- newlib/libc/sys/sysnecv850/getpid.c | 3 ++- newlib/libc/sys/sysnecv850/isatty.c | 4 ++-- newlib/libc/sys/sysnecv850/kill.c | 5 ++--- newlib/libc/sys/sysnecv850/read.c | 1 + newlib/libc/sys/sysnecv850/sbrk.c | 2 ++ 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/newlib/libc/sys/sysnecv850/_exit.c b/newlib/libc/sys/sysnecv85= 0/_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() } =20 =20 -void _exit (n) +void _exit (int n) { /* Destructors should be done earlier because they need to be done befor= e 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/sysnecv8= 50/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); =20 #define TRAP0(f, p1, p2, p3) __trap0(f, (int)(p1), (int)(p2), (int)(p3)) =20 -_getpid (n) +int +_getpid (int n) { return 1; } diff --git a/newlib/libc/sys/sysnecv850/isatty.c b/newlib/libc/sys/sysnecv8= 50/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); =20 #define TRAP0(f, p1, p2, p3) __trap0(f, (int)(p1), (int)(p2), (int)(p3)) =20 -_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); =20 #define TRAP0(f, p1, p2, p3) __trap0(f, (int)(p1), (int)(p2), (int)(p3)) =20 -_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); =20 #define TRAP0(f, p1, p2, p3) __trap0(f, (int)(p1), (int)(p2), (int)(p3)) =20 +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 #include #include "sys/syscall.h" +#include =20 +extern int _write (int, char *, int); caddr_t _sbrk (int incr) {