From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2119) id 836B83858CDB; Sat, 30 Dec 2023 04:32:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 836B83858CDB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1703910720; bh=SuIDQp7C0E//8tmoFy7U0qtV9x3gM4Hu4t9fnyVYx6Y=; h=From:To:Subject:Date:From; b=Fk6D9Xe1YCzKO6cGSY2Blyn9CZCSZRkQLkZY6Oz0MDTruNdjLnFI2pamFEyJQjrcG GDkm6r/QEBoc6vvyseayuSqJj3CXqEC3K4WRWCfLn7tcJ9VaPdjVteqQn2rikdA7oM /3tDkAMcKiN9z7K8bcjl0QLfkv/woz8CdDGdsdD0= 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 c99/gcc-14 issues in generic libgloss code X-Act-Checkin: newlib-cygwin X-Git-Author: Jeff Law X-Git-Refname: refs/heads/master X-Git-Oldrev: 7ef32a98cdf74157ae734a7a833af5171585db0c X-Git-Newrev: 3d10b04f1ed9bf53c282081c88165951e8c32cec Message-Id: <20231230043200.836B83858CDB@sourceware.org> Date: Sat, 30 Dec 2023 04:32:00 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D3d10b04f1ed= 9bf53c282081c88165951e8c32cec commit 3d10b04f1ed9bf53c282081c88165951e8c32cec Author: Jeff Law Date: Fri Dec 29 21:31:27 2023 -0700 Fix various c99/gcc-14 issues in generic libgloss code =20 Similar to what's been done in the ports, but this time in generic code. =20 Add missing #includes to pick up prototypes. Add prototypes for various internal functions where needed. Fix signatures of various functions t= o match what's provided by the headers (read, sbrk, write, unlink). =20 Nearly done with this effort ;-) =20 Pushed to the trunk, Diff: --- libgloss/glue.h | 2 ++ libgloss/putnum.c | 2 ++ libgloss/read.c | 5 +++-- libgloss/sbrk.c | 5 ++--- libgloss/unlink.c | 2 +- libgloss/write.c | 5 +++-- 6 files changed, 13 insertions(+), 8 deletions(-) diff --git a/libgloss/glue.h b/libgloss/glue.h index 0a7e36db2..98c0a6ad2 100644 --- a/libgloss/glue.h +++ b/libgloss/glue.h @@ -13,6 +13,7 @@ * they apply. */ #include <_ansi.h> +#include =20 #ifndef NULL # define NULL 0 @@ -28,4 +29,5 @@ extern char _end[]; /* _end is set in the = linker command file */ /* only one prcess support, as this is OS dependant */ #define __MYPID 1 =20 +int outbyte (char); =20 diff --git a/libgloss/putnum.c b/libgloss/putnum.c index c368c4136..6e1051e24 100644 --- a/libgloss/putnum.c +++ b/libgloss/putnum.c @@ -14,6 +14,8 @@ */ #include "glue.h" =20 +extern void print (char *ptr); + /* * putnum -- print a 32 bit number in hex */ diff --git a/libgloss/read.c b/libgloss/read.c index 24108ce0d..83a3b549b 100644 --- a/libgloss/read.c +++ b/libgloss/read.c @@ -22,10 +22,11 @@ extern char inbyte (void); */ int read (int fd, - char *buf, - int nbytes) + void *buf_, + size_t nbytes) { int i =3D 0; + char *buf =3D buf_; =20 for (i =3D 0; i < nbytes; i++) { *(buf + i) =3D inbyte(); diff --git a/libgloss/sbrk.c b/libgloss/sbrk.c index c222b4bbf..d567a4a60 100644 --- a/libgloss/sbrk.c +++ b/libgloss/sbrk.c @@ -27,9 +27,8 @@ char *heap_ptr; * RAM. We just increment a pointer in what's * left of memory on the board. */ -char * -sbrk (nbytes) - int nbytes; +void * +sbrk (ptrdiff_t nbytes) { char *base; =20 diff --git a/libgloss/unlink.c b/libgloss/unlink.c index 76c1a4fef..af06c51d7 100644 --- a/libgloss/unlink.c +++ b/libgloss/unlink.c @@ -20,7 +20,7 @@ * we just return an error. */ int -unlink (char * path) +unlink (const char * path) { errno =3D EIO; return (-1); diff --git a/libgloss/write.c b/libgloss/write.c index 28b7ea37a..80bcd4a77 100644 --- a/libgloss/write.c +++ b/libgloss/write.c @@ -23,10 +23,11 @@ extern int outbyte (char x); */ int write (int fd, - char *buf, - int nbytes) + const void *buf_, + size_t nbytes) { int i; + const char *buf =3D buf_; =20 for (i =3D 0; i < nbytes; i++) { if (*(buf + i) =3D=3D '\n') {