From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id HuL4DrrdpGBiNAAAWB0awg (envelope-from ) for ; Wed, 19 May 2021 05:43:22 -0400 Received: by simark.ca (Postfix, from userid 112) id 326701F11C; Wed, 19 May 2021 05:43:22 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=MAILING_LIST_MULTI, RDNS_DYNAMIC,UPPERCASE_50_75 autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.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 642AA1E01F for ; Wed, 19 May 2021 05:43:21 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C02613896836; Wed, 19 May 2021 09:43:20 +0000 (GMT) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 8AC1738930D7 for ; Wed, 19 May 2021 09:43:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8AC1738930D7 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 9387BAEAB; Wed, 19 May 2021 09:43:15 +0000 (UTC) Date: Wed, 19 May 2021 11:43:13 +0200 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH] sim: ppc: fix some Wunused-function warnings Message-ID: <20210519094312.GA28264@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.10.1 (2018-07-13) 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: , Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" Hi, When compiling with --enable-werror and CFLAGS="-O0 -g -Wall", we run into: ... In file included from src/sim/ppc/cpu.h:251:0, from src/sim/ppc/emul_generic.h:24, from src/sim/ppc/emul_generic.c:24: src/sim/ppc/cpu.c:76:1: error: ‘cpu_create’ defined but not used \ [-Werror=unused-function] cpu_create(psim *system, ^~~~~~~~~~ ... The function is defined as: ... INLINE_CPU\ (cpu *) cpu_create(psim *system, ... which expands to: ... static cpu * __attribute__((__unused__)) cpu_create(psim *system, ... The problem is that gcc does not associate the attribute to the function. I've filed a PR about this ( PR gcc/100670 ), which may or may not be valid. Work around/fix this by modifying the INLINE_* definitions in inline.h to move UNUSED to the start such that we have: ... __attribute__((__unused__)) static cpu * cpu_create(psim *system, ... Any comments? Thanks, - Tom sim: ppc: fix some Wunused-function warnings --- sim/ppc/inline.h | 168 +++++++++++++++++++++++++++---------------------------- 1 file changed, 84 insertions(+), 84 deletions(-) diff --git a/sim/ppc/inline.h b/sim/ppc/inline.h index 55de0bbfbed..62c4d318e3f 100644 --- a/sim/ppc/inline.h +++ b/sim/ppc/inline.h @@ -29,11 +29,11 @@ #if !defined(_SIM_ENDIAN_C_) && (SIM_ENDIAN_INLINE & INCLUDE_MODULE) # if (SIM_ENDIAN_INLINE & INLINE_MODULE) -# define INLINE_PSIM_ENDIAN(TYPE) static INLINE TYPE UNUSED -# define EXTERN_PSIM_ENDIAN(TYPE) static TYPE UNUSED +# define INLINE_PSIM_ENDIAN(TYPE) UNUSED static INLINE TYPE +# define EXTERN_PSIM_ENDIAN(TYPE) UNUSED static TYPE # else -# define INLINE_PSIM_ENDIAN(TYPE) static TYPE UNUSED -# define EXTERN_PSIM_ENDIAN(TYPE) static TYPE UNUSED +# define INLINE_PSIM_ENDIAN(TYPE) UNUSED static TYPE +# define EXTERN_PSIM_ENDIAN(TYPE) UNUSED static TYPE # endif #else # define INLINE_PSIM_ENDIAN(TYPE) TYPE @@ -51,11 +51,11 @@ #if !defined(_BITS_C_) && (BITS_INLINE & INCLUDE_MODULE) # if (BITS_INLINE & INLINE_MODULE) -# define INLINE_BITS(TYPE) static INLINE TYPE UNUSED -# define EXTERN_BITS(TYPE) static TYPE UNUSED +# define INLINE_BITS(TYPE) UNUSED static INLINE TYPE +# define EXTERN_BITS(TYPE) UNUSED static TYPE # else -# define INLINE_BITS(TYPE) static TYPE UNUSED -# define EXTERN_BITS(TYPE) static TYPE UNUSED +# define INLINE_BITS(TYPE) UNUSED static TYPE +# define EXTERN_BITS(TYPE) UNUSED static TYPE # endif #else # define INLINE_BITS(TYPE) TYPE @@ -73,11 +73,11 @@ #if defined(_INLINE_C_) && !defined(_CORE_C_) && (CORE_INLINE & INCLUDE_MODULE) # if (CORE_INLINE & INLINE_MODULE) -# define INLINE_CORE(TYPE) static INLINE TYPE UNUSED -# define EXTERN_CORE(TYPE) static TYPE UNUSED +# define INLINE_CORE(TYPE) UNUSED static INLINE TYPE +# define EXTERN_CORE(TYPE) UNUSED static TYPE #else -# define INLINE_CORE(TYPE) static TYPE UNUSED -# define EXTERN_CORE(TYPE) static TYPE UNUSED +# define INLINE_CORE(TYPE) UNUSED static TYPE +# define EXTERN_CORE(TYPE) UNUSED static TYPE #endif #else # define INLINE_CORE(TYPE) TYPE @@ -95,11 +95,11 @@ #if defined(_INLINE_C_) && !defined(_VM_C_) && (VM_INLINE & INCLUDE_MODULE) # if (VM_INLINE & INLINE_MODULE) -# define INLINE_VM(TYPE) static INLINE TYPE UNUSED -# define EXTERN_VM(TYPE) static TYPE UNUSED +# define INLINE_VM(TYPE) UNUSED static INLINE TYPE +# define EXTERN_VM(TYPE) UNUSED static TYPE #else -# define INLINE_VM(TYPE) static TYPE UNUSED -# define EXTERN_VM(TYPE) static TYPE UNUSED +# define INLINE_VM(TYPE) UNUSED static TYPE +# define EXTERN_VM(TYPE) UNUSED static TYPE #endif #else # define INLINE_VM(TYPE) TYPE @@ -117,11 +117,11 @@ #if !defined(_CPU_C_) && (CPU_INLINE & INCLUDE_MODULE) # if (CPU_INLINE & INLINE_MODULE) -# define INLINE_CPU(TYPE) static INLINE TYPE UNUSED -# define EXTERN_CPU(TYPE) static TYPE UNUSED +# define INLINE_CPU(TYPE) UNUSED static INLINE TYPE +# define EXTERN_CPU(TYPE) UNUSED static TYPE #else -# define INLINE_CPU(TYPE) static TYPE UNUSED -# define EXTERN_CPU(TYPE) static TYPE UNUSED +# define INLINE_CPU(TYPE) UNUSED static TYPE +# define EXTERN_CPU(TYPE) UNUSED static TYPE #endif #else # define INLINE_CPU(TYPE) TYPE @@ -139,11 +139,11 @@ #if defined(_INLINE_C_) && !defined(_MODEL_C_) && (MODEL_INLINE & INCLUDE_MODULE) # if (MODEL_INLINE & INLINE_MODULE) -# define INLINE_MODEL(TYPE) static INLINE TYPE UNUSED -# define EXTERN_MODEL(TYPE) static TYPE UNUSED +# define INLINE_MODEL(TYPE) UNUSED static INLINE TYPE +# define EXTERN_MODEL(TYPE) UNUSED static TYPE #else -# define INLINE_MODEL(TYPE) static TYPE UNUSED -# define EXTERN_MODEL(TYPE) static TYPE UNUSED +# define INLINE_MODEL(TYPE) UNUSED static TYPE +# define EXTERN_MODEL(TYPE) UNUSED static TYPE #endif #else # define INLINE_MODEL(TYPE) TYPE @@ -161,11 +161,11 @@ #if defined(_INLINE_C_) && !defined(_EVENTS_C_) && (EVENTS_INLINE & INCLUDE_MODULE) # if (EVENTS_INLINE & INLINE_MODULE) -# define INLINE_EVENTS(TYPE) static INLINE TYPE UNUSED -# define EXTERN_EVENTS(TYPE) static TYPE UNUSED +# define INLINE_EVENTS(TYPE) UNUSED static INLINE TYPE +# define EXTERN_EVENTS(TYPE) UNUSED static TYPE #else -# define INLINE_EVENTS(TYPE) static TYPE UNUSED -# define EXTERN_EVENTS(TYPE) static TYPE UNUSED +# define INLINE_EVENTS(TYPE) UNUSED static TYPE +# define EXTERN_EVENTS(TYPE) UNUSED static TYPE #endif #else # define INLINE_EVENTS(TYPE) TYPE @@ -183,11 +183,11 @@ #if defined(_INLINE_C_) && !defined(_MON_C_) && (MON_INLINE & INCLUDE_MODULE) # if (MON_INLINE & INLINE_MODULE) -# define INLINE_MON(TYPE) static INLINE TYPE UNUSED -# define EXTERN_MON(TYPE) static TYPE UNUSED +# define INLINE_MON(TYPE) UNUSED static INLINE TYPE +# define EXTERN_MON(TYPE) UNUSED static TYPE #else -# define INLINE_MON(TYPE) static TYPE UNUSED -# define EXTERN_MON(TYPE) static TYPE UNUSED +# define INLINE_MON(TYPE) UNUSED static TYPE +# define EXTERN_MON(TYPE) UNUSED static TYPE #endif #else # define INLINE_MON(TYPE) TYPE @@ -205,11 +205,11 @@ #if defined(_INLINE_C_) && !defined(_REGISTERS_C_) && (REGISTERS_INLINE & INCLUDE_MODULE) # if (REGISTERS_INLINE & INLINE_MODULE) -# define INLINE_REGISTERS(TYPE) static INLINE TYPE UNUSED -# define EXTERN_REGISTERS(TYPE) static TYPE UNUSED +# define INLINE_REGISTERS(TYPE) UNUSED static INLINE TYPE +# define EXTERN_REGISTERS(TYPE) UNUSED static TYPE #else -# define INLINE_REGISTERS(TYPE) static TYPE UNUSED -# define EXTERN_REGISTERS(TYPE) static TYPE UNUSED +# define INLINE_REGISTERS(TYPE) UNUSED static TYPE +# define EXTERN_REGISTERS(TYPE) UNUSED static TYPE #endif #else # define INLINE_REGISTERS(TYPE) TYPE @@ -227,11 +227,11 @@ #if defined(_INLINE_C_) && !defined(_INTERRUPTS_C_) && (INTERRUPTS_INLINE & INCLUDE_MODULE) # if (INTERRUPTS_INLINE & INLINE_MODULE) -# define INLINE_INTERRUPTS(TYPE) static INLINE TYPE UNUSED -# define EXTERN_INTERRUPTS(TYPE) static TYPE UNUSED +# define INLINE_INTERRUPTS(TYPE) UNUSED static INLINE TYPE +# define EXTERN_INTERRUPTS(TYPE) UNUSED static TYPE #else -# define INLINE_INTERRUPTS(TYPE) static TYPE UNUSED -# define EXTERN_INTERRUPTS(TYPE) static TYPE UNUSED +# define INLINE_INTERRUPTS(TYPE) UNUSED static TYPE +# define EXTERN_INTERRUPTS(TYPE) UNUSED static TYPE #endif #else # define INLINE_INTERRUPTS(TYPE) TYPE @@ -249,11 +249,11 @@ #if defined(_INLINE_C_) && !defined(_DEVICE_C_) && (DEVICE_INLINE & INCLUDE_MODULE) # if (DEVICE_INLINE & INLINE_MODULE) -# define INLINE_DEVICE(TYPE) static INLINE TYPE UNUSED -# define EXTERN_DEVICE(TYPE) static TYPE UNUSED +# define INLINE_DEVICE(TYPE) UNUSED static INLINE TYPE +# define EXTERN_DEVICE(TYPE) UNUSED static TYPE #else -# define INLINE_DEVICE(TYPE) static TYPE UNUSED -# define EXTERN_DEVICE(TYPE) static TYPE UNUSED +# define INLINE_DEVICE(TYPE) UNUSED static TYPE +# define EXTERN_DEVICE(TYPE) UNUSED static TYPE #endif #else # define INLINE_DEVICE(TYPE) TYPE @@ -271,11 +271,11 @@ #if defined(_INLINE_C_) && !defined(_TREE_C_) && (TREE_INLINE & INCLUDE_MODULE) # if (TREE_INLINE & INLINE_MODULE) -# define INLINE_TREE(TYPE) static INLINE TYPE UNUSED -# define EXTERN_TREE(TYPE) static TYPE UNUSED +# define INLINE_TREE(TYPE) UNUSED static INLINE TYPE +# define EXTERN_TREE(TYPE) UNUSED static TYPE #else -# define INLINE_TREE(TYPE) static TYPE UNUSED -# define EXTERN_TREE(TYPE) static TYPE UNUSED +# define INLINE_TREE(TYPE) UNUSED static TYPE +# define EXTERN_TREE(TYPE) UNUSED static TYPE #endif #else # define INLINE_TREE(TYPE) TYPE @@ -293,11 +293,11 @@ #if defined(_INLINE_C_) && !defined(_SPREG_C_) && (SPREG_INLINE & INCLUDE_MODULE) # if (SPREG_INLINE & INLINE_MODULE) -# define INLINE_SPREG(TYPE) static INLINE TYPE UNUSED -# define EXTERN_SPREG(TYPE) static TYPE UNUSED +# define INLINE_SPREG(TYPE) UNUSED static INLINE TYPE +# define EXTERN_SPREG(TYPE) UNUSED static TYPE #else -# define INLINE_SPREG(TYPE) static TYPE UNUSED -# define EXTERN_SPREG(TYPE) static TYPE UNUSED +# define INLINE_SPREG(TYPE) UNUSED static TYPE +# define EXTERN_SPREG(TYPE) UNUSED static TYPE #endif #else # define INLINE_SPREG(TYPE) TYPE @@ -315,11 +315,11 @@ #if defined(_INLINE_C_) && !defined(_SEMANTICS_C_) && (SEMANTICS_INLINE & INCLUDE_MODULE) # if (SEMANTICS_INLINE & INLINE_MODULE) -# define PSIM_INLINE_SEMANTICS(TYPE) static INLINE TYPE UNUSED -# define PSIM_EXTERN_SEMANTICS(TYPE) static TYPE UNUSED +# define PSIM_INLINE_SEMANTICS(TYPE) UNUSED static INLINE TYPE +# define PSIM_EXTERN_SEMANTICS(TYPE) UNUSED static TYPE #else -# define PSIM_INLINE_SEMANTICS(TYPE) static TYPE UNUSED -# define PSIM_EXTERN_SEMANTICS(TYPE) static TYPE UNUSED +# define PSIM_INLINE_SEMANTICS(TYPE) UNUSED static TYPE +# define PSIM_EXTERN_SEMANTICS(TYPE) UNUSED static TYPE #endif #else # define PSIM_INLINE_SEMANTICS(TYPE) TYPE @@ -339,11 +339,11 @@ #if defined(_INLINE_C_) && !defined(_IDECODE_C_) && (IDECODE_INLINE & INCLUDE_MODULE) # if (IDECODE_INLINE & INLINE_MODULE) -# define PSIM_INLINE_IDECODE(TYPE) static INLINE TYPE UNUSED -# define EXTERN_IDECODE(TYPE) static TYPE UNUSED +# define PSIM_INLINE_IDECODE(TYPE) UNUSED static INLINE TYPE +# define EXTERN_IDECODE(TYPE) UNUSED static TYPE #else -# define PSIM_INLINE_IDECODE(TYPE) static TYPE UNUSED -# define EXTERN_IDECODE(TYPE) static TYPE UNUSED +# define PSIM_INLINE_IDECODE(TYPE) UNUSED static TYPE +# define EXTERN_IDECODE(TYPE) UNUSED static TYPE #endif #else # define PSIM_INLINE_IDECODE(TYPE) TYPE @@ -363,11 +363,11 @@ #if defined(_INLINE_C_) && !defined(_ICACHE_C_) && (ICACHE_INLINE & INCLUDE_MODULE) # if (ICACHE_INLINE & INLINE_MODULE) -# define PSIM_INLINE_ICACHE(TYPE) static INLINE TYPE UNUSED -# define EXTERN_ICACHE(TYPE) static TYPE UNUSED +# define PSIM_INLINE_ICACHE(TYPE) UNUSED static INLINE TYPE +# define EXTERN_ICACHE(TYPE) UNUSED static TYPE #else -# define PSIM_INLINE_ICACHE(TYPE) static TYPE UNUSED -# define EXTERN_ICACHE(TYPE) static TYPE UNUSED +# define PSIM_INLINE_ICACHE(TYPE) UNUSED static TYPE +# define EXTERN_ICACHE(TYPE) UNUSED static TYPE #endif #else # define PSIM_INLINE_ICACHE(TYPE) TYPE @@ -387,11 +387,11 @@ #if !defined(_SUPPORT_C_) && (SUPPORT_INLINE & INCLUDE_MODULE) # if (SUPPORT_INLINE & INLINE_MODULE) -# define PSIM_INLINE_SUPPORT(TYPE) static INLINE TYPE UNUSED -# define EXTERN_SUPPORT(TYPE) static TYPE UNUSED +# define PSIM_INLINE_SUPPORT(TYPE) UNUSED static INLINE TYPE +# define EXTERN_SUPPORT(TYPE) UNUSED static TYPE #else -# define PSIM_INLINE_SUPPORT(TYPE) static TYPE UNUSED -# define EXTERN_SUPPORT(TYPE) static TYPE UNUSED +# define PSIM_INLINE_SUPPORT(TYPE) UNUSED static TYPE +# define EXTERN_SUPPORT(TYPE) UNUSED static TYPE #endif #else # define PSIM_INLINE_SUPPORT(TYPE) TYPE @@ -411,11 +411,11 @@ #if defined(_INLINE_C_) && !defined(_OPTIONS_C_) && (OPTIONS_INLINE & INCLUDE_MODULE) # if (OPTIONS_INLINE & INLINE_MODULE) -# define INLINE_OPTIONS(TYPE) static INLINE TYPE UNUSED -# define EXTERN_OPTIONS(TYPE) static TYPE UNUSED +# define INLINE_OPTIONS(TYPE) UNUSED static INLINE TYPE +# define EXTERN_OPTIONS(TYPE) UNUSED static TYPE #else -# define INLINE_OPTIONS(TYPE) static TYPE UNUSED -# define EXTERN_OPTIONS(TYPE) static TYPE UNUSED +# define INLINE_OPTIONS(TYPE) UNUSED static TYPE +# define EXTERN_OPTIONS(TYPE) UNUSED static TYPE #endif #else # define INLINE_OPTIONS(TYPE) TYPE @@ -433,11 +433,11 @@ #if defined(_INLINE_C_) && !defined(_OS_EMUL_C_) && (OS_EMUL_INLINE & INCLUDE_MODULE) # if (OS_EMUL_INLINE & INLINE_MODULE) -# define INLINE_OS_EMUL(TYPE) static INLINE TYPE UNUSED -# define EXTERN_OS_EMUL(TYPE) static TYPE UNUSED +# define INLINE_OS_EMUL(TYPE) UNUSED static INLINE TYPE +# define EXTERN_OS_EMUL(TYPE) UNUSED static TYPE #else -# define INLINE_OS_EMUL(TYPE) static TYPE UNUSED -# define EXTERN_OS_EMUL(TYPE) static TYPE UNUSED +# define INLINE_OS_EMUL(TYPE) UNUSED static TYPE +# define EXTERN_OS_EMUL(TYPE) UNUSED static TYPE #endif #else # define INLINE_OS_EMUL(TYPE) TYPE @@ -455,11 +455,11 @@ #if defined(_INLINE_C_) && !defined(_PSIM_C_) && (PSIM_INLINE & INCLUDE_MODULE) # if (PSIM_INLINE & INLINE_MODULE) -# define INLINE_PSIM(TYPE) static INLINE TYPE UNUSED -# define EXTERN_PSIM(TYPE) static TYPE UNUSED +# define INLINE_PSIM(TYPE) UNUSED static INLINE TYPE +# define EXTERN_PSIM(TYPE) UNUSED static TYPE #else -# define INLINE_PSIM(TYPE) static TYPE UNUSED -# define EXTERN_PSIM(TYPE) static TYPE UNUSED +# define INLINE_PSIM(TYPE) UNUSED static TYPE +# define EXTERN_PSIM(TYPE) UNUSED static TYPE #endif #else # define INLINE_PSIM(TYPE) TYPE @@ -477,11 +477,11 @@ #if defined(_INLINE_C_) && !defined(_CAP_C_) && (CAP_INLINE & INCLUDE_MODULE) # if (CAP_INLINE & INLINE_MODULE) -# define INLINE_CAP(TYPE) static INLINE TYPE UNUSED -# define EXTERN_CAP(TYPE) static TYPE UNUSED +# define INLINE_CAP(TYPE) UNUSED static INLINE TYPE +# define EXTERN_CAP(TYPE) UNUSED static TYPE #else -# define INLINE_CAP(TYPE) static TYPE UNUSED -# define EXTERN_CAP(TYPE) static TYPE UNUSED +# define INLINE_CAP(TYPE) UNUSED static TYPE +# define EXTERN_CAP(TYPE) UNUSED static TYPE #endif #else # define INLINE_CAP(TYPE) TYPE