public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jeff Law <law@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin] Fix fr30 libgloss build
Date: Thu, 14 Dec 2023 17:32:53 +0000 (GMT)	[thread overview]
Message-ID: <20231214173253.64F783858D35@sourceware.org> (raw)

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

commit 17a6aff334a20f63cb7f428a36dad0c8ebbdab5d
Author: Jeff Law <jeffreyalaw@gmail.com>
Date:   Thu Dec 14 10:30:13 2023 -0700

    Fix fr30 libgloss build
    
    gcc-14 will default to c99 and as a result a fair amount of old code in newlib
    (particularly libgloss) is failing to build.  I don't offhand know how many
    patches will be necessary to fix the various failures. I'll just pick them off
    one by one from my tree.
    
    This particular patch works around the return-mismatch problem syscalls.c for
    fr30.
    
    That file is a bit odd in that most functions are declared as returning an
    integer, but the implementations look like:
    
    > int
    > _read (file, ptr, len)
    >      int    file;
    >      char * ptr;
    >      int    len;
    > {
    >   asm ("ldi:8 %0, r0" :: "i" (SYS_read) : "r0");
    >   asm ("int   #10");
    >
    >   return;
    > }
    
    Note the lack of a value on the "return" statement.  The assumption is that the
    interrupt handler implementing syscalls will put the return value into the
    proper register, so falling off the end of the C function or returning with no
    value works in the expected way.  It's not good code, but it probably works.
    
    Working from that assumption I decided to just use a pragma to disable the
    upgraded diagnostic from GCC -- essentially preserving existing behavior.
    
    This is the only fr30 specific issue that needs to be resolved and the only
    issue (so far) I've seen of this specific nature.

Diff:
---
 libgloss/fr30/syscalls.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libgloss/fr30/syscalls.c b/libgloss/fr30/syscalls.c
index 2558556b6..36702b03d 100644
--- a/libgloss/fr30/syscalls.c
+++ b/libgloss/fr30/syscalls.c
@@ -5,6 +5,8 @@
 #include <sys/stat.h>
 #include "../syscall.h"
 
+#pragma GCC diagnostic ignored "-Wreturn-mismatch"
+
 int
 _read (file, ptr, len)
      int    file;

                 reply	other threads:[~2023-12-14 17:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231214173253.64F783858D35@sourceware.org \
    --to=law@sourceware.org \
    --cc=newlib-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).