From patchwork Mon Jun 3 01:24:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pietro Monteiro X-Patchwork-Id: 91323 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DA059394742F for ; Mon, 3 Jun 2024 01:24:47 +0000 (GMT) X-Original-To: newlib@sourceware.org Delivered-To: newlib@sourceware.org Received: from fhigh1-smtp.messagingengine.com (fhigh1-smtp.messagingengine.com [103.168.172.152]) by sourceware.org (Postfix) with ESMTPS id 6221A3945C34 for ; Mon, 3 Jun 2024 01:24:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6221A3945C34 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=sociotechnical.xyz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sociotechnical.xyz ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6221A3945C34 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=103.168.172.152 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717377874; cv=none; b=g+UZrLgJP3vUYhlaIqSexZXcVqBJHR0YvIt+pPXjTvXAcKNk4FeQrcVzBt/HIrntZ57D5LiJk/gHmXt4JT+h4HxHdY5fkMvws20d34vlTx2CIuZphkAt9gxi91hSPZeQuvZx2JB2y+88SgECC/fXjh/1poun8CTe9nw4dq0mZPs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717377874; c=relaxed/simple; bh=lWk6F1dYiEhFNULEsQHN3CL76e3mLVwyI/DarY6SQlo=; h=DKIM-Signature:DKIM-Signature:MIME-Version:Message-Id:Date:From: To:Subject; b=jKrwqKQvOe96MW4aAHz6+mbYXRmK4WFi4CodjSowr09oagGZEopdYWnnpTuncNaanpSQptoyv+oA4K/FovgOX4ktPWaxkm75SG30zhp+1BpeTXlVQQDM2Qfug/GeSbHGBr/FcV5Q01sNm51T/eAZGPh5Gpa20g26+4wxVlMa8H8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 1080B11400AD for ; Sun, 2 Jun 2024 21:24:32 -0400 (EDT) Received: from imap44 ([10.202.2.94]) by compute2.internal (MEProxy); Sun, 02 Jun 2024 21:24:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sociotechnical.xyz; h=cc:content-type:content-type:date:date :from:from:in-reply-to:message-id:mime-version:reply-to:subject :subject:to:to; s=fm2; t=1717377872; x=1717464272; bh=Ffj3wHayVs qZPnOKghmsI7eGEikSiK5u7aZFitPfUAg=; b=Yw55R/hVGzprvrXmjH/DbWEYFe /bC7eq4hMMRQLOGSzNdinu4jVh/uVMKggUf4SYhM6hN3RmDoehG2kpyXX/hrt/pn jbT7bkLdSNtCr3hbXgGO7w6xdcU532rKvw8korhrBid6Vh2zYgBqxImWYesJ49Yq n75gqc2DcX2BkLE0oqL2P1p2eLO7miYKdW81yc8s7PjZIZ1TyVXV3OdLGE1wRn1c acCLQXaT/6+NFt1dYVnsUljiyd01kC8woRFjixxBQ1DoA1D+AvCZRgR6uo0o6PR9 MhowjrsKI56o1CXRqJBBCEYsqVWTEWSqxRTdK75H+90mV6zIOW3nZT92cn6g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1717377872; x=1717464272; bh=Ffj3wHayVsqZPnOKghmsI7eGEikSiK5u7aZ FitPfUAg=; b=CE9+kFc5bJxzmib8CWwYqVn/oC2bIy4xU0nS4s5gYjY8QojaUSm YTdxzajHoADiw/qECDeku+MjroSkkZXOEpvwuCatQ3qTR1hejSv5hk2+ktdJ69Ln a3YvdH5nW1fNtQ4GXk9LZZF9cL7TICX013grl3b9cqDw8KJS+uEsnzrgNqlTOX0X K6O+h4NG8Vs6jdePSNJTALtuwzMnajSeRbiDWFkIW31k7uqyOhd2ajKuwFPJJK2G IU1x1MYwOluTDRu1dmcsmsG+dGtsQDuZFxCxmIAq67z+Rviemi7uwK2UVOP4Hlxs yCuGRUF0RpSAYIuTNlXe7U8mQU3DNZ0+r9A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdeluddggeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdlfeehmdenucfjughrpefofg ggkfffhffvufgtsehttdertderredtnecuhfhrohhmpedfrfhivghtrhhoucfoohhnthgv ihhrohdfuceophhivghtrhhosehsohgtihhothgvtghhnhhitggrlhdrgiihiieqnecugg ftrfgrthhtvghrnhepjefgtdekfeevgfelgeefffejveevteeiffeiuddujedvheffkeef kefhudehlefhnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepphhivghtrhhosehsohgtihhothgvtghhnhhitggrlhdrgiihii X-ME-Proxy: Feedback-ID: i7f494689:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id AD1E736A0074; Sun, 2 Jun 2024 21:24:31 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-491-g033e30d24-fm-20240520.001-g033e30d2 MIME-Version: 1.0 Message-Id: <5ec2d7e0-4810-42c1-933b-3063d2e1ecbc@app.fastmail.com> Date: Sun, 02 Jun 2024 21:24:10 -0400 From: "Pietro Monteiro" To: newlib@sourceware.org Subject: libc: sh: add missing prototypes and change functions from K&R to ANSI X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_INFOUSMEBIZ, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: newlib-bounces+patchwork=sourceware.org@sourceware.org The SuperH target doesn't build on GCC 14.1 because of missing function prototypes or because some function declarations use the deprecated K&R style. This patch adds missing prototypes on the files the functions are used and convert K&R declarations to ANSI-style. Signed-off-by: Pietro Monteiro --- newlib/libc/sys/sh/creat.c | 7 +++--- newlib/libc/sys/sh/ftruncate.c | 2 ++ newlib/libc/sys/sh/syscalls.c | 40 +++++++++++++++++++++------------- newlib/libc/sys/sh/truncate.c | 2 ++ 4 files changed, 33 insertions(+), 18 deletions(-) diff --git a/newlib/libc/sys/sh/creat.c b/newlib/libc/sys/sh/creat.c index 62ec5ead8..5cce6d065 100644 --- a/newlib/libc/sys/sh/creat.c +++ b/newlib/libc/sys/sh/creat.c @@ -1,7 +1,8 @@ +extern int +_creat (const char *path, int mode); + int -creat(path, mode) - const char *path; - int mode; +creat (const char *path, int mode) { return _creat (path, mode); } diff --git a/newlib/libc/sys/sh/ftruncate.c b/newlib/libc/sys/sh/ftruncate.c index 660377bf3..c358eb173 100644 --- a/newlib/libc/sys/sh/ftruncate.c +++ b/newlib/libc/sys/sh/ftruncate.c @@ -2,6 +2,8 @@ #include #include "sys/syscall.h" +extern int __trap34 (int function, ...); + int ftruncate (int file, off_t length) { diff --git a/newlib/libc/sys/sh/syscalls.c b/newlib/libc/sys/sh/syscalls.c index 614b67e9e..3c41ecee9 100644 --- a/newlib/libc/sys/sh/syscalls.c +++ b/newlib/libc/sys/sh/syscalls.c @@ -3,11 +3,19 @@ #include #include #include "sys/syscall.h" -int errno; +#include +#undef errno +extern int errno; + +void abort (void) __attribute__((__noreturn__)); + +extern int __trap34 (int function, ...); /* This is used by _sbrk. */ register char *stack_ptr asm ("r15"); +extern int main (int, char**); + int _read (int file, char *ptr, @@ -93,34 +101,38 @@ _unlink () return -1; } -isatty (fd) - int fd; +int +isatty (int fd) { return 1; } -_isatty (fd) - int fd; +int +_isatty (int fd) { return 1; } - -_exit (n) +_ATTRIBUTE ((__noreturn__)) void +_exit (int n) { - return __trap34 (SYS_exit, n, 0, 0); + __trap34 (SYS_exit, n, 0, 0); } -_kill (n, m) +int +_kill (int pid, + int sig) { return __trap34 (SYS_exit, 0xdead, 0, 0); } -_getpid (n) +int +_getpid () { return 1; } +void _raise () { } @@ -145,9 +157,8 @@ _chown (const char *path, short owner, short group) } int -_utime (path, times) - const char *path; - char *times; +_utime (const char *path, + char *times) { return __trap34 (SYS_utime, path, times); } @@ -159,8 +170,7 @@ _fork () } int -_wait (statusp) - int *statusp; +_wait (int *statusp) { return __trap34 (SYS_wait); } diff --git a/newlib/libc/sys/sh/truncate.c b/newlib/libc/sys/sh/truncate.c index 5ca48d3c6..47a4c0675 100644 --- a/newlib/libc/sys/sh/truncate.c +++ b/newlib/libc/sys/sh/truncate.c @@ -2,6 +2,8 @@ #include #include "sys/syscall.h" +extern int __trap34 (int function, ...); + int truncate (const char *path, off_t length) {