Re: [PATCH] libgloss: fix read and write prototype

Jeff Johnston <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <CAOox84tY-Pv2X8TEXK76CW5fTLZKJ12iwAEfbp+8U-T2bBiHdA@mail.gmail.com>
Thanks Marc,

Patch applied.

-- Jeff J.

On Sun, May 5, 2024 at 3:16 PM Marc <[email protected]> wrote:

> Use _READ_WRITE_RETURN_TYPE for read/write in libgloss/{read,write}.c to
> avoid mismatching types.
>
> Signed-off-by: Marc Poulhiès <[email protected]>
> ---
> Hello,
>
> building with gcc14-rc for m68k fails with (see my mail earlier this week):
>
>  src/newlib/libgloss/m68k/../read.c:24:1: error: conflicting types for
> 'read'; have 'int(int,  void *, size_t)' {aka 'int(int,  void *, long
> unsigned int)'}
>
> This simple fix makes use of _READ_WRITE_RETURN_TYPE macro to avoid
> mismatching types.
>
> Marc
>
>  libgloss/read.c  | 2 +-
>  libgloss/write.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libgloss/read.c b/libgloss/read.c
> index 83a3b549b..867648278 100644
> --- a/libgloss/read.c
> +++ b/libgloss/read.c
> @@ -20,7 +20,7 @@ extern char inbyte (void);
>   * read  -- read bytes from the serial port. Ignore fd, since
>   *          we only have stdin.
>   */
> -int
> +_READ_WRITE_RETURN_TYPE
>  read (int fd,
>         void *buf_,
>         size_t nbytes)
> diff --git a/libgloss/write.c b/libgloss/write.c
> index 80bcd4a77..757141291 100644
> --- a/libgloss/write.c
> +++ b/libgloss/write.c
> @@ -21,7 +21,7 @@ extern int  outbyte (char x);
>   *          stdout and stderr are the same. Since we have no filesystem,
>   *          open will only return an error.
>   */
> -int
> +_READ_WRITE_RETURN_TYPE
>  write (int fd,
>         const void *buf_,
>         size_t nbytes)
> --
> 2.42.0
>
>
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.