From patchwork Thu Oct 20 09:25:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tsukasa OI X-Patchwork-Id: 6086 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp154626wrs; Thu, 20 Oct 2022 02:31:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM40R6YyNM8gh/BcHbtDHcTYL0banqfNYVvfkV7MDYL3uq/jGOUESVV86hULcWh31eZ/RCxO X-Received: by 2002:a50:a44c:0:b0:45c:6451:363d with SMTP id v12-20020a50a44c000000b0045c6451363dmr11306616edb.115.1666258307410; Thu, 20 Oct 2022 02:31:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666258307; cv=none; d=google.com; s=arc-20160816; b=ziR1dmPqcgSxmk0kYB3H/WtBjVhNURRYZ5pa+Yj0NkUgmtS55JUE91JyPyKxZo3lNd q4IYO/RqUHygQim0igMFwosafCl4Pa9kq1XmViqWPzm4NBDlO5hTUpcbmD9L9H2mEb89 QPQ0ij2VrdO5MwGt2SpaMsOg6bv3iVuQFrpi26JVADuBR4GmKglXKCVa5wVgWAsur0Gi m0nBbMRTZHMhdNFV2h7sEoyapUjZnTHsGEvYgRKlHjfkofJ924R8r38Dw02P5+Bq6jfR 19YPS49yCDgvTTMKD0juRDqNX/DBoSXKIEc9jpgvuOUEphMD0LOfdIjYJi8S3MPkTjdu eWRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=5elJjbQhbcPSYjFChLwoZplVAFvOG1mbeTzZbnT9G98=; b=yNbDPIa/SsHph5FmdPPj0tu+j81ZKBjJ4xtWnmVZtSnBZa7XH/yXUYMjsgetTDd/UE B9CYfgeow5c1S+rRyRy8UEoMdEBmpqlYOsR9lNMlcaFxWuxBtlx61oEL7vUQF+GNYMNF ed11LCxoiqbNeUPlQ6UI52gQ3f5gW1lQStIrLNqwomZO/GRu44u4PAwas0B24QvHafX2 ECLXqbrssfni3+Y3BdhqyY97v72VnYOZZF7WMRr7FsnUN5l6K1rBtGj/HZySJKc2IUKS rU1OW7H0tHujzXWlhC7QIV31pcL7isNWHA4ZgeXF+g7DwIOO8WTMPfLMA0G6RXCd54TH qjpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=khlNTtG5; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id sb32-20020a1709076da000b0078772382b35si18305783ejc.91.2022.10.20.02.31.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 02:31:47 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=khlNTtG5; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 73DB938A90B8 for ; Thu, 20 Oct 2022 09:29:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 73DB938A90B8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666258147; bh=5elJjbQhbcPSYjFChLwoZplVAFvOG1mbeTzZbnT9G98=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=khlNTtG5UkYhcHLQLQAtyx3kr2NBSpWOJsSmW3ujPr5O8uZaW4NPbPfCK7mx2upX6 TXZHt3pqzstjKRAcRFtE2hamhhoWVH4xA8HTjLlp7bf+lX27nRXWqGLh9qhAXuBSYz r8FhhUKe1UKp+gBM0tvsmvV9YIyTqqn1BGkxrDuA= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-sender-0.a4lg.com (mail-sender.a4lg.com [153.120.152.154]) by sourceware.org (Postfix) with ESMTPS id 5CC60384D141 for ; Thu, 20 Oct 2022 09:28:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5CC60384D141 Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id B00CD300089; Thu, 20 Oct 2022 09:28:11 +0000 (UTC) To: Tsukasa OI , Andrew Burgess , Mike Frysinger , Nick Clifton Subject: [PATCH 09/40] sim/erc32: Use int32_t as event callback argument Date: Thu, 20 Oct 2022 09:25:55 +0000 Message-Id: <057c2f8392410494c3bc5dc98052246508e6a73e.1666257885.git.research_trasio@irq.a4lg.com> In-Reply-To: References: Mime-Version: 1.0 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP 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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tsukasa OI via Binutils From: Tsukasa OI Reply-To: Tsukasa OI Cc: binutils@sourceware.org Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747198470709104693?= X-GMAIL-MSGID: =?utf-8?q?1747198470709104693?= Clang generates a warning if an argument is passed to a function without prototype (zero arguments, even without (void)). Such calls are deprecated forms of indefinite arguments passing ("-Wdeprecated-non-prototype"). On the default configuration, it causes a build failure (unless "--disable-werror" is specified). To fix that, this commit makes struct evcell to use int32_t as a callback (cfunc) argument of an event. --- sim/erc32/erc32.c | 28 ++++++++++++++-------------- sim/erc32/func.c | 8 ++++---- sim/erc32/sis.h | 4 ++-- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/sim/erc32/erc32.c b/sim/erc32/erc32.c index 0206c02e6f0..d7cc1f1cf3b 100644 --- a/sim/erc32/erc32.c +++ b/sim/erc32/erc32.c @@ -274,19 +274,19 @@ static void port_init (void); static uint32_t read_uart (uint32_t addr); static void write_uart (uint32_t addr, uint32_t data); static void flush_uart (void); -static void uarta_tx (void); -static void uartb_tx (void); -static void uart_rx (void *arg); -static void uart_intr (void *arg); +static void uarta_tx (int32_t); +static void uartb_tx (int32_t); +static void uart_rx (int32_t); +static void uart_intr (int32_t); static void uart_irq_start (void); -static void wdog_intr (void *arg); +static void wdog_intr (int32_t); static void wdog_start (void); -static void rtc_intr (void *arg); +static void rtc_intr (int32_t); static void rtc_start (void); static uint32_t rtc_counter_read (void); static void rtc_scaler_set (uint32_t val); static void rtc_reload_set (uint32_t val); -static void gpt_intr (void *arg); +static void gpt_intr (int32_t); static void gpt_start (void); static uint32_t gpt_counter_read (void); static void gpt_scaler_set (uint32_t val); @@ -1245,7 +1245,7 @@ flush_uart(void) ATTRIBUTE_UNUSED static void -uarta_tx(void) +uarta_tx(int32_t arg ATTRIBUTE_UNUSED) { while (f1open && fwrite(&uarta_sreg, 1, 1, f1out) != 1); @@ -1261,7 +1261,7 @@ uarta_tx(void) ATTRIBUTE_UNUSED static void -uartb_tx(void) +uartb_tx(int32_t arg ATTRIBUTE_UNUSED) { while (f2open && fwrite(&uartb_sreg, 1, 1, f2out) != 1); if (uart_stat_reg & UARTB_HRE) { @@ -1276,7 +1276,7 @@ uartb_tx(void) ATTRIBUTE_UNUSED static void -uart_rx(void *arg) +uart_rx(int32_t arg ATTRIBUTE_UNUSED) { int32_t rsize; char rxd; @@ -1318,7 +1318,7 @@ uart_rx(void *arg) } static void -uart_intr(void *arg) +uart_intr(int32_t arg ATTRIBUTE_UNUSED) { read_uart(0xE8); /* Check for UART interrupts every 1000 clk */ flush_uart(); /* Flush UART ports */ @@ -1341,7 +1341,7 @@ uart_irq_start(void) /* Watch-dog */ static void -wdog_intr(void *arg) +wdog_intr(int32_t arg ATTRIBUTE_UNUSED) { if (wdog_status == disabled) { wdog_status = stopped; @@ -1379,7 +1379,7 @@ wdog_start(void) static void -rtc_intr(void *arg) +rtc_intr(int32_t arg ATTRIBUTE_UNUSED) { if (rtc_counter == 0) { @@ -1430,7 +1430,7 @@ rtc_reload_set(uint32_t val) } static void -gpt_intr(void *arg) +gpt_intr(int32_t arg ATTRIBUTE_UNUSED) { if (gpt_counter == 0) { mec_irq(12); diff --git a/sim/erc32/func.c b/sim/erc32/func.c index af92c9f7d48..6971ae0129d 100644 --- a/sim/erc32/func.c +++ b/sim/erc32/func.c @@ -298,7 +298,7 @@ disp_reg(struct pstate *sregs, char *reg) #ifdef ERRINJ void -errinj (void) +errinj (int32_t arg ATTRIBUTE_UNUSED) { int err; @@ -887,8 +887,8 @@ advance_time(struct pstate *sregs) { struct evcell *evrem; - void (*cfunc) (); - uint32_t arg; + void (*cfunc) (int32_t); + int32_t arg; uint64_t endtime; #ifdef STAT @@ -926,7 +926,7 @@ int wait_for_irq(void) { struct evcell *evrem; - void (*cfunc) (); + void (*cfunc) (int32_t); int32_t arg; uint64_t endtime; diff --git a/sim/erc32/sis.h b/sim/erc32/sis.h index 71033137f2c..36346cae641 100644 --- a/sim/erc32/sis.h +++ b/sim/erc32/sis.h @@ -124,7 +124,7 @@ struct pstate { }; struct evcell { - void (*cfunc) (); + void (*cfunc) (int32_t); int32_t arg; uint64_t time; struct evcell *nxt; @@ -183,7 +183,7 @@ extern void init_signals (void); struct disassemble_info; extern void dis_mem (uint32_t addr, uint32_t len, struct disassemble_info *info); -extern void event (void (*cfunc) (), int32_t arg, uint64_t delta); +extern void event (void (*cfunc) (int32_t), int32_t arg, uint64_t delta); extern void set_int (int32_t level, void (*callback) (), int32_t arg); extern void advance_time (struct pstate *sregs); extern uint32_t now (void);