From f6428ce423802d55d218519f4f79a5dd9b4375dc Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 15 Jun 2021 20:38:45 -0400 Subject: [PATCH] sim: ppc: replace local UNUSED macros with common one Drop local UNUSED macro with the common ansidecl.h ATTRIBUTE_UNUSED define. --- sim/ppc/ChangeLog | 8 ++ sim/ppc/basics.h | 10 --- sim/ppc/gen-icache.c | 2 +- sim/ppc/idecode_expression.h | 4 +- sim/ppc/inline.h | 169 ++++++++++++++++++----------------- 5 files changed, 97 insertions(+), 96 deletions(-) diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog index 3f4fd91a865..4f54f77273b 100644 --- a/sim/ppc/ChangeLog +++ b/sim/ppc/ChangeLog @@ -1,3 +1,11 @@ +2021-06-16 Mike Frysinger + + * basics.h (UNUSED): Delete. + * gen-icache.c (print_icache_extraction): Change UNUSED to + ATTRIBUTE_UNUSED. + * idecode_expression.h: Likewise. Include ansidecl.h. + * inline.h: Likewise. + 2021-06-16 Mike Frysinger * basics.h: Delete CONCAT* and XCONCAT* macros. diff --git a/sim/ppc/basics.h b/sim/ppc/basics.h index d88bcef7a75..a6a35ca688a 100644 --- a/sim/ppc/basics.h +++ b/sim/ppc/basics.h @@ -95,16 +95,6 @@ typedef enum { #endif #endif -#if !defined (UNUSED) -#if (!defined(__GNUC__) \ - || (__GNUC__ < 2) \ - || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)) -#define UNUSED -#else -#define UNUSED __attribute__((__unused__)) -#endif -#endif - /* Basic definitions - ordered so that nothing calls what comes after it */ diff --git a/sim/ppc/gen-icache.c b/sim/ppc/gen-icache.c index eb35e94949d..aa7ea6c9d31 100644 --- a/sim/ppc/gen-icache.c +++ b/sim/ppc/gen-icache.c @@ -112,7 +112,7 @@ print_icache_extraction(lf *file, else { if (file_name != NULL) lf_print__external_reference(file, line_nr, file_name); - lf_printf(file, "%s const %s UNUSED = ", + lf_printf(file, "%s const %s ATTRIBUTE_UNUSED = ", entry_type == NULL ? "unsigned" : entry_type, entry_name); } diff --git a/sim/ppc/idecode_expression.h b/sim/ppc/idecode_expression.h index 13f6020daad..28d39a75ce6 100644 --- a/sim/ppc/idecode_expression.h +++ b/sim/ppc/idecode_expression.h @@ -17,6 +17,8 @@ */ +#include "ansidecl.h" + /* Additional, and optional expressions. */ #ifdef WITH_ALTIVEC #include "altivec_expression.h" @@ -314,7 +316,7 @@ do { \ #define FPSCR_BEGIN \ { \ - fpscreg old_fpscr UNUSED = FPSCR + fpscreg old_fpscr ATTRIBUTE_UNUSED = FPSCR #define FPSCR_END(Rc) { \ /* always update VX */ \ diff --git a/sim/ppc/inline.h b/sim/ppc/inline.h index 62c4d318e3f..5fb108f09bb 100644 --- a/sim/ppc/inline.h +++ b/sim/ppc/inline.h @@ -21,6 +21,7 @@ #ifndef _INLINE_H_ #define _INLINE_H_ +#include "ansidecl.h" #define STATIC(TYPE) static TYPE @@ -29,11 +30,11 @@ #if !defined(_SIM_ENDIAN_C_) && (SIM_ENDIAN_INLINE & INCLUDE_MODULE) # if (SIM_ENDIAN_INLINE & INLINE_MODULE) -# define INLINE_PSIM_ENDIAN(TYPE) UNUSED static INLINE TYPE -# define EXTERN_PSIM_ENDIAN(TYPE) UNUSED static TYPE +# define INLINE_PSIM_ENDIAN(TYPE) ATTRIBUTE_UNUSED static INLINE TYPE +# define EXTERN_PSIM_ENDIAN(TYPE) ATTRIBUTE_UNUSED static TYPE # else -# define INLINE_PSIM_ENDIAN(TYPE) UNUSED static TYPE -# define EXTERN_PSIM_ENDIAN(TYPE) UNUSED static TYPE +# define INLINE_PSIM_ENDIAN(TYPE) ATTRIBUTE_UNUSED static TYPE +# define EXTERN_PSIM_ENDIAN(TYPE) ATTRIBUTE_UNUSED static TYPE # endif #else # define INLINE_PSIM_ENDIAN(TYPE) TYPE @@ -51,11 +52,11 @@ #if !defined(_BITS_C_) && (BITS_INLINE & INCLUDE_MODULE) # if (BITS_INLINE & INLINE_MODULE) -# define INLINE_BITS(TYPE) UNUSED static INLINE TYPE -# define EXTERN_BITS(TYPE) UNUSED static TYPE +# define INLINE_BITS(TYPE) ATTRIBUTE_UNUSED static INLINE TYPE +# define EXTERN_BITS(TYPE) ATTRIBUTE_UNUSED static TYPE # else -# define INLINE_BITS(TYPE) UNUSED static TYPE -# define EXTERN_BITS(TYPE) UNUSED static TYPE +# define INLINE_BITS(TYPE) ATTRIBUTE_UNUSED static TYPE +# define EXTERN_BITS(TYPE) ATTRIBUTE_UNUSED static TYPE # endif #else # define INLINE_BITS(TYPE) TYPE @@ -73,11 +74,11 @@ #if defined(_INLINE_C_) && !defined(_CORE_C_) && (CORE_INLINE & INCLUDE_MODULE) # if (CORE_INLINE & INLINE_MODULE) -# define INLINE_CORE(TYPE) UNUSED static INLINE TYPE -# define EXTERN_CORE(TYPE) UNUSED static TYPE +# define INLINE_CORE(TYPE) ATTRIBUTE_UNUSED static INLINE TYPE +# define EXTERN_CORE(TYPE) ATTRIBUTE_UNUSED static TYPE #else -# define INLINE_CORE(TYPE) UNUSED static TYPE -# define EXTERN_CORE(TYPE) UNUSED static TYPE +# define INLINE_CORE(TYPE) ATTRIBUTE_UNUSED static TYPE +# define EXTERN_CORE(TYPE) ATTRIBUTE_UNUSED static TYPE #endif #else # define INLINE_CORE(TYPE) TYPE @@ -95,11 +96,11 @@ #if defined(_INLINE_C_) && !defined(_VM_C_) && (VM_INLINE & INCLUDE_MODULE) # if (VM_INLINE & INLINE_MODULE) -# define INLINE_VM(TYPE) UNUSED static INLINE TYPE -# define EXTERN_VM(TYPE) UNUSED static TYPE +# define INLINE_VM(TYPE) ATTRIBUTE_UNUSED static INLINE TYPE +# define EXTERN_VM(TYPE) ATTRIBUTE_UNUSED static TYPE #else -# define INLINE_VM(TYPE) UNUSED static TYPE -# define EXTERN_VM(TYPE) UNUSED static TYPE +# define INLINE_VM(TYPE) ATTRIBUTE_UNUSED static TYPE +# define EXTERN_VM(TYPE) ATTRIBUTE_UNUSED static TYPE #endif #else # define INLINE_VM(TYPE) TYPE @@ -117,11 +118,11 @@ #if !defined(_CPU_C_) && (CPU_INLINE & INCLUDE_MODULE) # if (CPU_INLINE & INLINE_MODULE) -# define INLINE_CPU(TYPE) UNUSED static INLINE TYPE -# define EXTERN_CPU(TYPE) UNUSED static TYPE +# define INLINE_CPU(TYPE) ATTRIBUTE_UNUSED static INLINE TYPE +# define EXTERN_CPU(TYPE) ATTRIBUTE_UNUSED static TYPE #else -# define INLINE_CPU(TYPE) UNUSED static TYPE -# define EXTERN_CPU(TYPE) UNUSED static TYPE +# define INLINE_CPU(TYPE) ATTRIBUTE_UNUSED static TYPE +# define EXTERN_CPU(TYPE) ATTRIBUTE_UNUSED static TYPE #endif #else # define INLINE_CPU(TYPE) TYPE @@ -139,11 +140,11 @@ #if defined(_INLINE_C_) && !defined(_MODEL_C_) && (MODEL_INLINE & INCLUDE_MODULE) # if (MODEL_INLINE & INLINE_MODULE) -# define INLINE_MODEL(TYPE) UNUSED static INLINE TYPE -# define EXTERN_MODEL(TYPE) UNUSED static TYPE +# define INLINE_MODEL(TYPE) ATTRIBUTE_UNUSED static INLINE TYPE +# define EXTERN_MODEL(TYPE) ATTRIBUTE_UNUSED static TYPE #else -# define INLINE_MODEL(TYPE) UNUSED static TYPE -# define EXTERN_MODEL(TYPE) UNUSED static TYPE +# define INLINE_MODEL(TYPE) ATTRIBUTE_UNUSED static TYPE +# define EXTERN_MODEL(TYPE) ATTRIBUTE_UNUSED static TYPE #endif #else # define INLINE_MODEL(TYPE) TYPE @@ -161,11 +162,11 @@ #if defined(_INLINE_C_) && !defined(_EVENTS_C_) && (EVENTS_INLINE & INCLUDE_MODULE) # if (EVENTS_INLINE & INLINE_MODULE) -# define INLINE_EVENTS(TYPE) UNUSED static INLINE TYPE -# define EXTERN_EVENTS(TYPE) UNUSED static TYPE +# define INLINE_EVENTS(TYPE) ATTRIBUTE_UNUSED static INLINE TYPE +# define EXTERN_EVENTS(TYPE) ATTRIBUTE_UNUSED static TYPE #else -# define INLINE_EVENTS(TYPE) UNUSED static TYPE -# define EXTERN_EVENTS(TYPE) UNUSED static TYPE +# define INLINE_EVENTS(TYPE) ATTRIBUTE_UNUSED static TYPE +# define EXTERN_EVENTS(TYPE) ATTRIBUTE_UNUSED static TYPE #endif #else # define INLINE_EVENTS(TYPE) TYPE @@ -183,11 +184,11 @@ #if defined(_INLINE_C_) && !defined(_MON_C_) && (MON_INLINE & INCLUDE_MODULE) # if (MON_INLINE & INLINE_MODULE) -# define INLINE_MON(TYPE) UNUSED static INLINE TYPE -# define EXTERN_MON(TYPE) UNUSED static TYPE +# define INLINE_MON(TYPE) ATTRIBUTE_UNUSED static INLINE TYPE +# define EXTERN_MON(TYPE) ATTRIBUTE_UNUSED static TYPE #else -# define INLINE_MON(TYPE) UNUSED static TYPE -# define EXTERN_MON(TYPE) UNUSED static TYPE +# define INLINE_MON(TYPE) ATTRIBUTE_UNUSED static TYPE +# define EXTERN_MON(TYPE) ATTRIBUTE_UNUSED static TYPE #endif #else # define INLINE_MON(TYPE) TYPE @@ -205,11 +206,11 @@ #if defined(_INLINE_C_) && !defined(_REGISTERS_C_) && (REGISTERS_INLINE & INCLUDE_MODULE) # if (REGISTERS_INLINE & INLINE_MODULE) -# define INLINE_REGISTERS(TYPE) UNUSED static INLINE TYPE -# define EXTERN_REGISTERS(TYPE) UNUSED static TYPE +# define INLINE_REGISTERS(TYPE) ATTRIBUTE_UNUSED static INLINE TYPE +# define EXTERN_REGISTERS(TYPE) ATTRIBUTE_UNUSED static TYPE #else -# define INLINE_REGISTERS(TYPE) UNUSED static TYPE -# define EXTERN_REGISTERS(TYPE) UNUSED static TYPE +# define INLINE_REGISTERS(TYPE) ATTRIBUTE_UNUSED static TYPE +# define EXTERN_REGISTERS(TYPE) ATTRIBUTE_UNUSED static TYPE #endif #else # define INLINE_REGISTERS(TYPE) TYPE @@ -227,11 +228,11 @@ #if defined(_INLINE_C_) && !defined(_INTERRUPTS_C_) && (INTERRUPTS_INLINE & INCLUDE_MODULE) # if (INTERRUPTS_INLINE & INLINE_MODULE) -# define INLINE_INTERRUPTS(TYPE) UNUSED static INLINE TYPE -# define EXTERN_INTERRUPTS(TYPE) UNUSED static TYPE +# define INLINE_INTERRUPTS(TYPE) ATTRIBUTE_UNUSED static INLINE TYPE +# define EXTERN_INTERRUPTS(TYPE) ATTRIBUTE_UNUSED static TYPE #else -# define INLINE_INTERRUPTS(TYPE) UNUSED static TYPE -# define EXTERN_INTERRUPTS(TYPE) UNUSED static TYPE +# define INLINE_INTERRUPTS(TYPE) ATTRIBUTE_UNUSED static TYPE +# define EXTERN_INTERRUPTS(TYPE) ATTRIBUTE_UNUSED static TYPE #endif #else # define INLINE_INTERRUPTS(TYPE) TYPE @@ -249,11 +250,11 @@ #if defined(_INLINE_C_) && !defined(_DEVICE_C_) && (DEVICE_INLINE & INCLUDE_MODULE) # if (DEVICE_INLINE & INLINE_MODULE) -# define INLINE_DEVICE(TYPE) UNUSED static INLINE TYPE -# define EXTERN_DEVICE(TYPE) UNUSED static TYPE +# define INLINE_DEVICE(TYPE) ATTRIBUTE_UNUSED static INLINE TYPE +# define EXTERN_DEVICE(TYPE) ATTRIBUTE_UNUSED static TYPE #else -# define INLINE_DEVICE(TYPE) UNUSED static TYPE -# define EXTERN_DEVICE(TYPE) UNUSED static TYPE +# define INLINE_DEVICE(TYPE) ATTRIBUTE_UNUSED static TYPE +# define EXTERN_DEVICE(TYPE) ATTRIBUTE_UNUSED static TYPE #endif #else # define INLINE_DEVICE(TYPE) TYPE @@ -271,11 +272,11 @@ #if defined(_INLINE_C_) && !defined(_TREE_C_) && (TREE_INLINE & INCLUDE_MODULE) # if (TREE_INLINE & INLINE_MODULE) -# define INLINE_TREE(TYPE) UNUSED static INLINE TYPE -# define EXTERN_TREE(TYPE) UNUSED static TYPE +# define INLINE_TREE(TYPE) ATTRIBUTE_UNUSED static INLINE TYPE +# define EXTERN_TREE(TYPE) ATTRIBUTE_UNUSED static TYPE #else -# define INLINE_TREE(TYPE) UNUSED static TYPE -# define EXTERN_TREE(TYPE) UNUSED static TYPE +# define INLINE_TREE(TYPE) ATTRIBUTE_UNUSED static TYPE +# define EXTERN_TREE(TYPE) ATTRIBUTE_UNUSED static TYPE #endif #else # define INLINE_TREE(TYPE) TYPE @@ -293,11 +294,11 @@ #if defined(_INLINE_C_) && !defined(_SPREG_C_) && (SPREG_INLINE & INCLUDE_MODULE) # if (SPREG_INLINE & INLINE_MODULE) -# define INLINE_SPREG(TYPE) UNUSED static INLINE TYPE -# define EXTERN_SPREG(TYPE) UNUSED static TYPE +# define INLINE_SPREG(TYPE) ATTRIBUTE_UNUSED static INLINE TYPE +# define EXTERN_SPREG(TYPE) ATTRIBUTE_UNUSED static TYPE #else -# define INLINE_SPREG(TYPE) UNUSED static TYPE -# define EXTERN_SPREG(TYPE) UNUSED static TYPE +# define INLINE_SPREG(TYPE) ATTRIBUTE_UNUSED static TYPE +# define EXTERN_SPREG(TYPE) ATTRIBUTE_UNUSED static TYPE #endif #else # define INLINE_SPREG(TYPE) TYPE @@ -315,11 +316,11 @@ #if defined(_INLINE_C_) && !defined(_SEMANTICS_C_) && (SEMANTICS_INLINE & INCLUDE_MODULE) # if (SEMANTICS_INLINE & INLINE_MODULE) -# define PSIM_INLINE_SEMANTICS(TYPE) UNUSED static INLINE TYPE -# define PSIM_EXTERN_SEMANTICS(TYPE) UNUSED static TYPE +# define PSIM_INLINE_SEMANTICS(TYPE) ATTRIBUTE_UNUSED static INLINE TYPE +# define PSIM_EXTERN_SEMANTICS(TYPE) ATTRIBUTE_UNUSED static TYPE #else -# define PSIM_INLINE_SEMANTICS(TYPE) UNUSED static TYPE -# define PSIM_EXTERN_SEMANTICS(TYPE) UNUSED static TYPE +# define PSIM_INLINE_SEMANTICS(TYPE) ATTRIBUTE_UNUSED static TYPE +# define PSIM_EXTERN_SEMANTICS(TYPE) ATTRIBUTE_UNUSED static TYPE #endif #else # define PSIM_INLINE_SEMANTICS(TYPE) TYPE @@ -339,11 +340,11 @@ #if defined(_INLINE_C_) && !defined(_IDECODE_C_) && (IDECODE_INLINE & INCLUDE_MODULE) # if (IDECODE_INLINE & INLINE_MODULE) -# define PSIM_INLINE_IDECODE(TYPE) UNUSED static INLINE TYPE -# define EXTERN_IDECODE(TYPE) UNUSED static TYPE +# define PSIM_INLINE_IDECODE(TYPE) ATTRIBUTE_UNUSED static INLINE TYPE +# define EXTERN_IDECODE(TYPE) ATTRIBUTE_UNUSED static TYPE #else -# define PSIM_INLINE_IDECODE(TYPE) UNUSED static TYPE -# define EXTERN_IDECODE(TYPE) UNUSED static TYPE +# define PSIM_INLINE_IDECODE(TYPE) ATTRIBUTE_UNUSED static TYPE +# define EXTERN_IDECODE(TYPE) ATTRIBUTE_UNUSED static TYPE #endif #else # define PSIM_INLINE_IDECODE(TYPE) TYPE @@ -363,11 +364,11 @@ #if defined(_INLINE_C_) && !defined(_ICACHE_C_) && (ICACHE_INLINE & INCLUDE_MODULE) # if (ICACHE_INLINE & INLINE_MODULE) -# define PSIM_INLINE_ICACHE(TYPE) UNUSED static INLINE TYPE -# define EXTERN_ICACHE(TYPE) UNUSED static TYPE +# define PSIM_INLINE_ICACHE(TYPE) ATTRIBUTE_UNUSED static INLINE TYPE +# define EXTERN_ICACHE(TYPE) ATTRIBUTE_UNUSED static TYPE #else -# define PSIM_INLINE_ICACHE(TYPE) UNUSED static TYPE -# define EXTERN_ICACHE(TYPE) UNUSED static TYPE +# define PSIM_INLINE_ICACHE(TYPE) ATTRIBUTE_UNUSED static TYPE +# define EXTERN_ICACHE(TYPE) ATTRIBUTE_UNUSED static TYPE #endif #else # define PSIM_INLINE_ICACHE(TYPE) TYPE @@ -387,11 +388,11 @@ #if !defined(_SUPPORT_C_) && (SUPPORT_INLINE & INCLUDE_MODULE) # if (SUPPORT_INLINE & INLINE_MODULE) -# define PSIM_INLINE_SUPPORT(TYPE) UNUSED static INLINE TYPE -# define EXTERN_SUPPORT(TYPE) UNUSED static TYPE +# define PSIM_INLINE_SUPPORT(TYPE) ATTRIBUTE_UNUSED static INLINE TYPE +# define EXTERN_SUPPORT(TYPE) ATTRIBUTE_UNUSED static TYPE #else -# define PSIM_INLINE_SUPPORT(TYPE) UNUSED static TYPE -# define EXTERN_SUPPORT(TYPE) UNUSED static TYPE +# define PSIM_INLINE_SUPPORT(TYPE) ATTRIBUTE_UNUSED static TYPE +# define EXTERN_SUPPORT(TYPE) ATTRIBUTE_UNUSED static TYPE #endif #else # define PSIM_INLINE_SUPPORT(TYPE) TYPE @@ -411,11 +412,11 @@ #if defined(_INLINE_C_) && !defined(_OPTIONS_C_) && (OPTIONS_INLINE & INCLUDE_MODULE) # if (OPTIONS_INLINE & INLINE_MODULE) -# define INLINE_OPTIONS(TYPE) UNUSED static INLINE TYPE -# define EXTERN_OPTIONS(TYPE) UNUSED static TYPE +# define INLINE_OPTIONS(TYPE) ATTRIBUTE_UNUSED static INLINE TYPE +# define EXTERN_OPTIONS(TYPE) ATTRIBUTE_UNUSED static TYPE #else -# define INLINE_OPTIONS(TYPE) UNUSED static TYPE -# define EXTERN_OPTIONS(TYPE) UNUSED static TYPE +# define INLINE_OPTIONS(TYPE) ATTRIBUTE_UNUSED static TYPE +# define EXTERN_OPTIONS(TYPE) ATTRIBUTE_UNUSED static TYPE #endif #else # define INLINE_OPTIONS(TYPE) TYPE @@ -433,11 +434,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) UNUSED static INLINE TYPE -# define EXTERN_OS_EMUL(TYPE) UNUSED static TYPE +# define INLINE_OS_EMUL(TYPE) ATTRIBUTE_UNUSED static INLINE TYPE +# define EXTERN_OS_EMUL(TYPE) ATTRIBUTE_UNUSED static TYPE #else -# define INLINE_OS_EMUL(TYPE) UNUSED static TYPE -# define EXTERN_OS_EMUL(TYPE) UNUSED static TYPE +# define INLINE_OS_EMUL(TYPE) ATTRIBUTE_UNUSED static TYPE +# define EXTERN_OS_EMUL(TYPE) ATTRIBUTE_UNUSED static TYPE #endif #else # define INLINE_OS_EMUL(TYPE) TYPE @@ -455,11 +456,11 @@ #if defined(_INLINE_C_) && !defined(_PSIM_C_) && (PSIM_INLINE & INCLUDE_MODULE) # if (PSIM_INLINE & INLINE_MODULE) -# define INLINE_PSIM(TYPE) UNUSED static INLINE TYPE -# define EXTERN_PSIM(TYPE) UNUSED static TYPE +# define INLINE_PSIM(TYPE) ATTRIBUTE_UNUSED static INLINE TYPE +# define EXTERN_PSIM(TYPE) ATTRIBUTE_UNUSED static TYPE #else -# define INLINE_PSIM(TYPE) UNUSED static TYPE -# define EXTERN_PSIM(TYPE) UNUSED static TYPE +# define INLINE_PSIM(TYPE) ATTRIBUTE_UNUSED static TYPE +# define EXTERN_PSIM(TYPE) ATTRIBUTE_UNUSED static TYPE #endif #else # define INLINE_PSIM(TYPE) TYPE @@ -477,11 +478,11 @@ #if defined(_INLINE_C_) && !defined(_CAP_C_) && (CAP_INLINE & INCLUDE_MODULE) # if (CAP_INLINE & INLINE_MODULE) -# define INLINE_CAP(TYPE) UNUSED static INLINE TYPE -# define EXTERN_CAP(TYPE) UNUSED static TYPE +# define INLINE_CAP(TYPE) ATTRIBUTE_UNUSED static INLINE TYPE +# define EXTERN_CAP(TYPE) ATTRIBUTE_UNUSED static TYPE #else -# define INLINE_CAP(TYPE) UNUSED static TYPE -# define EXTERN_CAP(TYPE) UNUSED static TYPE +# define INLINE_CAP(TYPE) ATTRIBUTE_UNUSED static TYPE +# define EXTERN_CAP(TYPE) ATTRIBUTE_UNUSED static TYPE #endif #else # define INLINE_CAP(TYPE) TYPE -- 2.30.2