Re: Fix fr30 libgloss build

Jeff Johnston <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <CAOox84vE4Nre_o5rGad3-i3PGAE4m0sKrKDZSnLuXvEsGSuB+Q@mail.gmail.com>
Looks fine.  Feel free to push.

-- Jeff J.

On Thu, Dec 14, 2023 at 9:47 AM Jeff Law <[email protected]> wrote:

>
> 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.
>
> OK for the trunk?
>
> jeff
>
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.