From 57a922a59801a9e7684f9661a65fa2ed5833d65d Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Sat, 19 Jun 2021 22:49:21 -0400 Subject: [PATCH] sim: move UNUSED before TYPE in SIM_ENDIAN_INLINE's definition 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: Move UNUSED before TYPE. Change-Id: Ide20106683ed7a9ebf35d484dabf70b309cb1ba6 --- sim/common/ChangeLog | 4 +++ sim/common/sim-inline.h | 54 ++++++++++++++++++++--------------------- 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 455fe492d77..cda7b953540 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,7 @@ +2021-06-19 Simon Marchi + + * sim-inline.h: Move UNUSED before TYPE. + 2021-06-19 Mike Frysinger * Make-common.in (clean): Delete BUILT_SRC_FROM_COMMON usage. diff --git a/sim/common/sim-inline.h b/sim/common/sim-inline.h index 2750fa93cbc..a397e58e10f 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.30.2