From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id yr2LIU2mzmD+dwAAWB0awg (envelope-from ) for ; Sat, 19 Jun 2021 22:22:05 -0400 Received: by simark.ca (Postfix, from userid 112) id 774E91F163; Sat, 19 Jun 2021 22:22:05 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 9E7241E813 for ; Sat, 19 Jun 2021 22:22:03 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5A2D5388881C for ; Sun, 20 Jun 2021 02:22:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5A2D5388881C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1624155723; bh=FYc1Mv15Uf43kudt20+NS0spAjdZ+DuotfyUG1KN1xo=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=pFCWPNv6lCsd3KU6GRXDPXBH2tJZ4lHK6OVOQ5nmmv/L08/IzmjCgHzeeHTIqfbR/ G78JXKYM8/tTPeyo4vjOyJkzuyLUplcN+IRqoGADVnWfXYr5o6YMdqHRdLHQPD814U +D9BWnZFgENswDX5s/P67DCUt1o2YduzicKB2bdI= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 436AF386FC08 for ; Sun, 20 Jun 2021 02:21:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 436AF386FC08 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 15K2LWWj022928 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 19 Jun 2021 22:21:37 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 15K2LWWj022928 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id D42E21E813 for ; Sat, 19 Jun 2021 22:21:32 -0400 (EDT) Subject: Re: [PATCH 1/2] sim: move UNUSED before TYPE in SIM_ENDIAN_INLINE's definition To: gdb-patches@sourceware.org References: <20210620013532.578626-1-simon.marchi@polymtl.ca> Message-ID: <3c289851-e9e9-9f67-04db-339ec97236e7@polymtl.ca> Date: Sat, 19 Jun 2021 22:21:32 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Sun, 20 Jun 2021 02:21:32 +0000 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 2021-06-19 10:07 p.m., Mike Frysinger wrote: > On 19 Jun 2021 21:35, Simon Marchi via Gdb-patches wrote: >> I get this when building with gcc 11: >> >> CC common/common_libcommon_a-sim-load.o >> In file included from /home/simark/src/binutils-gdb/sim/common/sim-n-bits.h:27, >> from /home/simark/src/binutils-gdb/sim/common/sim-bits.c:259, >> from /home/simark/src/binutils-gdb/sim/common/sim-bits.h:599, >> from /home/simark/src/binutils-gdb/sim/common/sim-basics.h:122, >> from /home/simark/src/binutils-gdb/sim/common/sim-load.c:30: >> /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:39:27: error: ‘offset_16’ defined but not used [-Werror=unused-function] >> 39 | #define offset_N XCONCAT2(offset_,N) >> | ^~~~~~~ >> /home/simark/src/binutils-gdb/sim/../include/symcat.h:23:26: note: in definition of macro ‘CONCAT2’ >> 23 | #define CONCAT2(a,b) a##b >> | ^ >> /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:39:18: note: in expansion of macro ‘XCONCAT2’ >> 39 | #define offset_N XCONCAT2(offset_,N) >> | ^~~~~~~~ >> /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:138:1: note: in expansion of macro ‘offset_N’ >> 138 | offset_N (unsigned_N *x, >> | ^~~~~~~~ >> >> offset_N uses INLINE_SIM_ENDIAN, which uses UNUSED to put the "unused" >> attribute. However, it appears after the function's return type, which >> seems to make it not apply to the function. Moving it to before the >> return type fixes the error. > > idea looks fine, but i'm pretty sure we want to s/TYPE UNUSED/UNUSED TYPE/ > on this whole file, not this one macro. > -mike > Hmm yeah good idea. Here's the updated patch: >From 1215077fa136c9cf44c2f933ba9d5de2465892d3 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Sat, 19 Jun 2021 21:35:31 -0400 Subject: [PATCH] sim: move UNUSED before TYPE in SIM_ENDIAN_INLINE's definition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I get this when building with gcc 11: CC common/common_libcommon_a-sim-load.o In file included from /home/simark/src/binutils-gdb/sim/common/sim-n-bits.h:27, from /home/simark/src/binutils-gdb/sim/common/sim-bits.c:259, from /home/simark/src/binutils-gdb/sim/common/sim-bits.h:599, from /home/simark/src/binutils-gdb/sim/common/sim-basics.h:122, from /home/simark/src/binutils-gdb/sim/common/sim-load.c:30: /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:39:27: error: ‘offset_16’ defined but not used [-Werror=unused-function] 39 | #define offset_N XCONCAT2(offset_,N) | ^~~~~~~ /home/simark/src/binutils-gdb/sim/../include/symcat.h:23:26: note: in definition of macro ‘CONCAT2’ 23 | #define CONCAT2(a,b) a##b | ^ /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:39:18: note: in expansion of macro ‘XCONCAT2’ 39 | #define offset_N XCONCAT2(offset_,N) | ^~~~~~~~ /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:138:1: note: in expansion of macro ‘offset_N’ 138 | offset_N (unsigned_N *x, | ^~~~~~~~ offset_N uses INLINE_SIM_ENDIAN, which uses UNUSED to put the "unused" attribute. However, it appears after the function's return type, which seems to make it not apply to the function. Moving it to before the return type fixes the error. Change all instances found in that file. sim/common/ChangeLog: * sim-inline.h (SIM_ENDIAN_INLINE): Move UNUSED before TYPE. Change-Id: Ide20106683ed7a9ebf35d484dabf70b309cb1ba6 --- sim/common/sim-inline.h | 54 ++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/sim/common/sim-inline.h b/sim/common/sim-inline.h index 2750fa93cbc7..a397e58e10f2 100644 --- a/sim/common/sim-inline.h +++ b/sim/common/sim-inline.h @@ -345,10 +345,10 @@ && !defined (SIM_ARANGE_C) \ && (REVEAL_MODULE_P (SIM_ARANGE_INLINE))) # if (SIM_ARANGE_INLINE & INLINE_GLOBALS) -# define INLINE_SIM_ARANGE(TYPE) static INLINE TYPE UNUSED +# define INLINE_SIM_ARANGE(TYPE) static INLINE UNUSED TYPE # define EXTERN_SIM_ARANGE_P 0 # else -# define INLINE_SIM_ARANGE(TYPE) static TYPE UNUSED +# define INLINE_SIM_ARANGE(TYPE) static UNUSED TYPE # define EXTERN_SIM_ARANGE_P 0 # endif #else @@ -383,10 +383,10 @@ && !defined (SIM_BITS_C) \ && (REVEAL_MODULE_P (SIM_BITS_INLINE))) # if (SIM_BITS_INLINE & INLINE_GLOBALS) -# define INLINE_SIM_BITS(TYPE) static INLINE TYPE UNUSED +# define INLINE_SIM_BITS(TYPE) static INLINE UNUSED TYPE # define EXTERN_SIM_BITS_P 0 # else -# define INLINE_SIM_BITS(TYPE) static TYPE UNUSED +# define INLINE_SIM_BITS(TYPE) static UNUSED TYPE # define EXTERN_SIM_BITS_P 0 # endif #else @@ -414,10 +414,10 @@ && !defined (SIM_CORE_C) \ && (REVEAL_MODULE_P (SIM_CORE_INLINE))) # if (SIM_CORE_INLINE & INLINE_GLOBALS) -# define INLINE_SIM_CORE(TYPE) static INLINE TYPE UNUSED +# define INLINE_SIM_CORE(TYPE) static INLINE UNUSED TYPE # define EXTERN_SIM_CORE_P 0 #else -# define INLINE_SIM_CORE(TYPE) static TYPE UNUSED +# define INLINE_SIM_CORE(TYPE) static UNUSED TYPE # define EXTERN_SIM_CORE_P 0 #endif #else @@ -445,10 +445,10 @@ && !defined (SIM_ENDIAN_C) \ && (REVEAL_MODULE_P (SIM_ENDIAN_INLINE))) # if (SIM_ENDIAN_INLINE & INLINE_GLOBALS) -# define INLINE_SIM_ENDIAN(TYPE) static INLINE TYPE UNUSED +# define INLINE_SIM_ENDIAN(TYPE) static INLINE UNUSED TYPE # define EXTERN_SIM_ENDIAN_P 0 # else -# define INLINE_SIM_ENDIAN(TYPE) static TYPE UNUSED +# define INLINE_SIM_ENDIAN(TYPE) static UNUSED TYPE # define EXTERN_SIM_ENDIAN_P 0 # endif #else @@ -476,10 +476,10 @@ && !defined (SIM_EVENTS_C) \ && (REVEAL_MODULE_P (SIM_EVENTS_INLINE))) # if (SIM_EVENTS_INLINE & INLINE_GLOBALS) -# define INLINE_SIM_EVENTS(TYPE) static INLINE TYPE UNUSED +# define INLINE_SIM_EVENTS(TYPE) static INLINE UNUSED TYPE # define EXTERN_SIM_EVENTS_P 0 # else -# define INLINE_SIM_EVENTS(TYPE) static TYPE UNUSED +# define INLINE_SIM_EVENTS(TYPE) static UNUSED TYPE # define EXTERN_SIM_EVENTS_P 0 # endif #else @@ -507,10 +507,10 @@ && !defined (SIM_FPU_C) \ && (REVEAL_MODULE_P (SIM_FPU_INLINE))) # if (SIM_FPU_INLINE & INLINE_GLOBALS) -# define INLINE_SIM_FPU(TYPE) static INLINE TYPE UNUSED +# define INLINE_SIM_FPU(TYPE) static INLINE UNUSED TYPE # define EXTERN_SIM_FPU_P 0 # else -# define INLINE_SIM_FPU(TYPE) static TYPE UNUSED +# define INLINE_SIM_FPU(TYPE) static UNUSED TYPE # define EXTERN_SIM_FPU_P 0 # endif #else @@ -534,10 +534,10 @@ && !defined (SIM_TYPES_C) \ && (REVEAL_MODULE_P (SIM_TYPES_INLINE))) # if (SIM_TYPES_INLINE & INLINE_GLOBALS) -# define INLINE_SIM_TYPES(TYPE) static INLINE TYPE UNUSED +# define INLINE_SIM_TYPES(TYPE) static INLINE UNUSED TYPE # define EXTERN_SIM_TYPES_P 0 # else -# define INLINE_SIM_TYPES(TYPE) static TYPE UNUSED +# define INLINE_SIM_TYPES(TYPE) static UNUSED TYPE # define EXTERN_SIM_TYPES_P 0 # endif #else @@ -565,10 +565,10 @@ && !defined (SIM_MAIN_C) \ && (REVEAL_MODULE_P (SIM_MAIN_INLINE))) # if (SIM_MAIN_INLINE & INLINE_GLOBALS) -# define INLINE_SIM_MAIN(TYPE) static INLINE TYPE UNUSED +# define INLINE_SIM_MAIN(TYPE) static INLINE UNUSED TYPE # define EXTERN_SIM_MAIN_P 0 # else -# define INLINE_SIM_MAIN(TYPE) static TYPE UNUSED +# define INLINE_SIM_MAIN(TYPE) static UNUSED TYPE # define EXTERN_SIM_MAIN_P 0 # endif #else @@ -590,10 +590,10 @@ && !defined (ENGINE_C) \ && (REVEAL_MODULE_P (ENGINE_INLINE))) # if (ENGINE_INLINE & INLINE_GLOBALS) -# define INLINE_ENGINE(TYPE) static INLINE TYPE UNUSED +# define INLINE_ENGINE(TYPE) static INLINE UNUSED TYPE # define EXTERN_ENGINE_P 0 # else -# define INLINE_ENGINE(TYPE) static TYPE UNUSED +# define INLINE_ENGINE(TYPE) static UNUSED TYPE # define EXTERN_ENGINE_P 0 # endif #else @@ -617,10 +617,10 @@ && !defined (ICACHE_C) \ && (REVEAL_MODULE_P (ICACHE_INLINE))) # if (ICACHE_INLINE & INLINE_GLOBALS) -# define INLINE_ICACHE(TYPE) static INLINE TYPE UNUSED +# define INLINE_ICACHE(TYPE) static INLINE UNUSED TYPE # define EXTERN_ICACHE_P 0 #else -# define INLINE_ICACHE(TYPE) static TYPE UNUSED +# define INLINE_ICACHE(TYPE) static UNUSED TYPE # define EXTERN_ICACHE_P 0 #endif #else @@ -644,10 +644,10 @@ && !defined (IDECODE_C) \ && (REVEAL_MODULE_P (IDECODE_INLINE))) # if (IDECODE_INLINE & INLINE_GLOBALS) -# define INLINE_IDECODE(TYPE) static INLINE TYPE UNUSED +# define INLINE_IDECODE(TYPE) static INLINE UNUSED TYPE # define EXTERN_IDECODE_P 0 #else -# define INLINE_IDECODE(TYPE) static TYPE UNUSED +# define INLINE_IDECODE(TYPE) static UNUSED TYPE # define EXTERN_IDECODE_P 0 #endif #else @@ -671,10 +671,10 @@ && !defined (SEMANTICS_C) \ && (REVEAL_MODULE_P (SEMANTICS_INLINE))) # if (SEMANTICS_INLINE & INLINE_GLOBALS) -# define INLINE_SEMANTICS(TYPE) static INLINE TYPE UNUSED +# define INLINE_SEMANTICS(TYPE) static INLINE UNUSED TYPE # define EXTERN_SEMANTICS_P 0 #else -# define INLINE_SEMANTICS(TYPE) static TYPE UNUSED +# define INLINE_SEMANTICS(TYPE) static UNUSED TYPE # define EXTERN_SEMANTICS_P 0 #endif #else @@ -685,7 +685,7 @@ #if EXTERN_SEMANTICS_P # define EXTERN_SEMANTICS(TYPE) TYPE #else -# define EXTERN_SEMANTICS(TYPE) static TYPE UNUSED +# define EXTERN_SEMANTICS(TYPE) static UNUSED TYPE #endif #if (SEMANTICS_INLINE & INLINE_LOCALS) @@ -708,10 +708,10 @@ && !defined (SUPPORT_C) \ && (REVEAL_MODULE_P (SUPPORT_INLINE))) # if (SUPPORT_INLINE & INLINE_GLOBALS) -# define INLINE_SUPPORT(TYPE) static INLINE TYPE UNUSED +# define INLINE_SUPPORT(TYPE) static INLINE UNUSED TYPE # define EXTERN_SUPPORT_P 0 #else -# define INLINE_SUPPORT(TYPE) static TYPE UNUSED +# define INLINE_SUPPORT(TYPE) static UNUSED TYPE # define EXTERN_SUPPORT_P 0 #endif #else -- 2.32.0