From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2119) id 64F783858D35; Thu, 14 Dec 2023 17:32:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 64F783858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1702575173; bh=YfdOtNY8xwkUtN0Ufzy+T7NhvOAZ5tdtVeWXO2YefXg=; h=From:To:Subject:Date:From; b=kcgCuiGr6TKPiXqLXyfco4A37CrbdYwdecwQkyG6+srvlkBD8mNq9rt3BV720XAKL kEilYu4dfrm8nanbZu/M3uNdclDlblq4PO5CVKzAag5jUfGgILX/NpkrybjHcxWatB 75/9veQvKXlN8E+jncKJm68hMDgbMBzcWCFOgcKU= 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 fr30 libgloss build X-Act-Checkin: newlib-cygwin X-Git-Author: Jeff Law X-Git-Refname: refs/heads/master X-Git-Oldrev: 3bafe2fae7a0878598a82777c623edb2faa70b74 X-Git-Newrev: 17a6aff334a20f63cb7f428a36dad0c8ebbdab5d Message-Id: <20231214173253.64F783858D35@sourceware.org> Date: Thu, 14 Dec 2023 17:32:53 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D17a6aff334a= 20f63cb7f428a36dad0c8ebbdab5d commit 17a6aff334a20f63cb7f428a36dad0c8ebbdab5d Author: Jeff Law Date: Thu Dec 14 10:30:13 2023 -0700 Fix fr30 libgloss build =20 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 t= hem off one by one from my tree. =20 This particular patch works around the return-mismatch problem syscalls= .c for fr30. =20 That file is a bit odd in that most functions are declared as returning= an integer, but the implementations look like: =20 > int > _read (file, ptr, len) > int file; > char * ptr; > int len; > { > asm ("ldi:8 %0, r0" :: "i" (SYS_read) : "r0"); > asm ("int #10"); > > return; > } =20 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 w= orks. =20 Working from that assumption I decided to just use a pragma to disable = the upgraded diagnostic from GCC -- essentially preserving existing behavio= r. =20 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 #include "../syscall.h" =20 +#pragma GCC diagnostic ignored "-Wreturn-mismatch" + int _read (file, ptr, len) int file;