sim: m68hc11: fix unused function warnings with -O0

Message ID 20210620022616.21639-1-vapier@gentoo.org
State New
Headers show
Series
  • sim: m68hc11: fix unused function warnings with -O0
Related show

Commit Message

Eli Zaretskii via Gdb-patches June 20, 2021, 2:26 a.m.
Mark these functions as unused in case they don't get inlined when
building with -O0.
---
 sim/m68hc11/ChangeLog  |  4 ++++
 sim/m68hc11/sim-main.h | 44 +++++++++++++++++++++---------------------
 2 files changed, 26 insertions(+), 22 deletions(-)

-- 
2.31.1

Comments

Eli Zaretskii via Gdb-patches June 20, 2021, 2:58 a.m. | #1
On 2021-06-19 10:26 p.m., Mike Frysinger via Gdb-patches wrote:
> Mark these functions as unused in case they don't get inlined when

> building with -O0.


That fixes the problem reported in my other patch, thanks.

Simon

Patch

diff --git a/sim/m68hc11/ChangeLog b/sim/m68hc11/ChangeLog
index ee7d48cc0c6d..9a4618765d7e 100644
--- a/sim/m68hc11/ChangeLog
+++ b/sim/m68hc11/ChangeLog
@@ -1,3 +1,7 @@ 
+2021-06-19  Mike Frysinger  <vapier@gentoo.org>
+
+	* sim-main.h: Add UNUSED to all STATIC_INLINE functions.
+
 2021-06-19  Mike Frysinger  <vapier@gentoo.org>
 
 	* aclocal.m4: Regenerate.
diff --git a/sim/m68hc11/sim-main.h b/sim/m68hc11/sim-main.h
index a48d7f4c8f1d..108b82fc0c28 100644
--- a/sim/m68hc11/sim-main.h
+++ b/sim/m68hc11/sim-main.h
@@ -291,7 +291,7 @@  extern void cpu_memory_exception (sim_cpu *cpu,
                                   uint16 addr,
                                   const char *message);
 
-STATIC_INLINE address_word
+STATIC_INLINE UNUSED address_word
 phys_to_virt (sim_cpu *cpu, address_word addr)
 {
   if (addr >= cpu->bank_start && addr < cpu->bank_end)
@@ -302,7 +302,7 @@  phys_to_virt (sim_cpu *cpu, address_word addr)
     return (address_word) (addr);
 }
 
-STATIC_INLINE uint8
+STATIC_INLINE UNUSED uint8
 memory_read8 (sim_cpu *cpu, uint16 addr)
 {
   uint8 val;
@@ -315,7 +315,7 @@  memory_read8 (sim_cpu *cpu, uint16 addr)
   return val;
 }
 
-STATIC_INLINE void
+STATIC_INLINE UNUSED void
 memory_write8 (sim_cpu *cpu, uint16 addr, uint8 val)
 {
   if (sim_core_write_buffer (CPU_STATE (cpu), cpu, 0, &val, addr, 1) != 1)
@@ -325,7 +325,7 @@  memory_write8 (sim_cpu *cpu, uint16 addr, uint8 val)
     }
 }
 
-STATIC_INLINE uint16
+STATIC_INLINE UNUSED uint16
 memory_read16 (sim_cpu *cpu, uint16 addr)
 {
   uint8 b[2];
@@ -338,7 +338,7 @@  memory_read16 (sim_cpu *cpu, uint16 addr)
   return (((uint16) (b[0])) << 8) | ((uint16) b[1]);
 }
 
-STATIC_INLINE void
+STATIC_INLINE UNUSED void
 memory_write16 (sim_cpu *cpu, uint16 addr, uint16 val)
 {
   uint8 b[2];
@@ -354,7 +354,7 @@  memory_write16 (sim_cpu *cpu, uint16 addr, uint16 val)
 extern void
 cpu_ccr_update_tst8 (sim_cpu *cpu, uint8 val);
 
-STATIC_INLINE void
+STATIC_INLINE UNUSED void
 cpu_ccr_update_tst16 (sim_cpu *cpu, uint16 val)
 {
   cpu_set_ccr_V (cpu, 0);
@@ -362,7 +362,7 @@  cpu_ccr_update_tst16 (sim_cpu *cpu, uint16 val)
   cpu_set_ccr_Z (cpu, val == 0 ? 1 : 0);
 }
 
-STATIC_INLINE void
+STATIC_INLINE UNUSED void
 cpu_ccr_update_shift8 (sim_cpu *cpu, uint8 val)
 {
   cpu_set_ccr_N (cpu, val & 0x80 ? 1 : 0);
@@ -370,7 +370,7 @@  cpu_ccr_update_shift8 (sim_cpu *cpu, uint8 val)
   cpu_set_ccr_V (cpu, cpu_get_ccr_N (cpu) ^ cpu_get_ccr_C (cpu));
 }
 
-STATIC_INLINE void
+STATIC_INLINE UNUSED void
 cpu_ccr_update_shift16 (sim_cpu *cpu, uint16 val)
 {
   cpu_set_ccr_N (cpu, val & 0x8000 ? 1 : 0);
@@ -378,7 +378,7 @@  cpu_ccr_update_shift16 (sim_cpu *cpu, uint16 val)
   cpu_set_ccr_V (cpu, cpu_get_ccr_N (cpu) ^ cpu_get_ccr_C (cpu));
 }
 
-STATIC_INLINE void
+STATIC_INLINE UNUSED void
 cpu_ccr_update_add8 (sim_cpu *cpu, uint8 r, uint8 a, uint8 b)
 {
   cpu_set_ccr_C (cpu, ((a & b) | (b & ~r) | (a & ~r)) & 0x80 ? 1 : 0);
@@ -388,7 +388,7 @@  cpu_ccr_update_add8 (sim_cpu *cpu, uint8 r, uint8 a, uint8 b)
 }
 
 
-STATIC_INLINE void
+STATIC_INLINE UNUSED void
 cpu_ccr_update_sub8 (sim_cpu *cpu, uint8 r, uint8 a, uint8 b)
 {
   cpu_set_ccr_C (cpu, ((~a & b) | (b & r) | (~a & r)) & 0x80 ? 1 : 0);
@@ -397,7 +397,7 @@  cpu_ccr_update_sub8 (sim_cpu *cpu, uint8 r, uint8 a, uint8 b)
   cpu_set_ccr_N (cpu, r & 0x80 ? 1 : 0);
 }
 
-STATIC_INLINE void
+STATIC_INLINE UNUSED void
 cpu_ccr_update_add16 (sim_cpu *cpu, uint16 r, uint16 a, uint16 b)
 {
   cpu_set_ccr_C (cpu, ((a & b) | (b & ~r) | (a & ~r)) & 0x8000 ? 1 : 0);
@@ -406,7 +406,7 @@  cpu_ccr_update_add16 (sim_cpu *cpu, uint16 r, uint16 a, uint16 b)
   cpu_set_ccr_N (cpu, r & 0x8000 ? 1 : 0);
 }
 
-STATIC_INLINE void
+STATIC_INLINE UNUSED void
 cpu_ccr_update_sub16 (sim_cpu *cpu, uint16 r, uint16 a, uint16 b)
 {
   cpu_set_ccr_C (cpu, ((~a & b) | (b & r) | (~a & r)) & 0x8000 ? 1 : 0);
@@ -416,7 +416,7 @@  cpu_ccr_update_sub16 (sim_cpu *cpu, uint16 r, uint16 a, uint16 b)
 }
 
 /* Push and pop instructions for 68HC11 (next-available stack mode).  */
-STATIC_INLINE void
+STATIC_INLINE UNUSED void
 cpu_m68hc11_push_uint8 (sim_cpu *cpu, uint8 val)
 {
   uint16 addr = cpu->cpu_regs.sp;
@@ -425,7 +425,7 @@  cpu_m68hc11_push_uint8 (sim_cpu *cpu, uint8 val)
   cpu->cpu_regs.sp = addr - 1;
 }
 
-STATIC_INLINE void
+STATIC_INLINE UNUSED void
 cpu_m68hc11_push_uint16 (sim_cpu *cpu, uint16 val)
 {
   uint16 addr = cpu->cpu_regs.sp - 1;
@@ -434,7 +434,7 @@  cpu_m68hc11_push_uint16 (sim_cpu *cpu, uint16 val)
   cpu->cpu_regs.sp = addr - 1;
 }
 
-STATIC_INLINE uint8
+STATIC_INLINE UNUSED uint8
 cpu_m68hc11_pop_uint8 (sim_cpu *cpu)
 {
   uint16 addr = cpu->cpu_regs.sp;
@@ -445,7 +445,7 @@  cpu_m68hc11_pop_uint8 (sim_cpu *cpu)
   return val;
 }
 
-STATIC_INLINE uint16
+STATIC_INLINE UNUSED uint16
 cpu_m68hc11_pop_uint16 (sim_cpu *cpu)
 {
   uint16 addr = cpu->cpu_regs.sp;
@@ -457,7 +457,7 @@  cpu_m68hc11_pop_uint16 (sim_cpu *cpu)
 }
 
 /* Push and pop instructions for 68HC12 (last-used stack mode).  */
-STATIC_INLINE void
+STATIC_INLINE UNUSED void
 cpu_m68hc12_push_uint8 (sim_cpu *cpu, uint8 val)
 {
   uint16 addr = cpu->cpu_regs.sp;
@@ -467,7 +467,7 @@  cpu_m68hc12_push_uint8 (sim_cpu *cpu, uint8 val)
   cpu->cpu_regs.sp = addr;
 }
 
-STATIC_INLINE void
+STATIC_INLINE UNUSED void
 cpu_m68hc12_push_uint16 (sim_cpu *cpu, uint16 val)
 {
   uint16 addr = cpu->cpu_regs.sp;
@@ -477,7 +477,7 @@  cpu_m68hc12_push_uint16 (sim_cpu *cpu, uint16 val)
   cpu->cpu_regs.sp = addr;
 }
 
-STATIC_INLINE uint8
+STATIC_INLINE UNUSED uint8
 cpu_m68hc12_pop_uint8 (sim_cpu *cpu)
 {
   uint16 addr = cpu->cpu_regs.sp;
@@ -488,7 +488,7 @@  cpu_m68hc12_pop_uint8 (sim_cpu *cpu)
   return val;
 }
 
-STATIC_INLINE uint16
+STATIC_INLINE UNUSED uint16
 cpu_m68hc12_pop_uint16 (sim_cpu *cpu)
 {
   uint16 addr = cpu->cpu_regs.sp;
@@ -500,7 +500,7 @@  cpu_m68hc12_pop_uint16 (sim_cpu *cpu)
 }
 
 /* Fetch a 8/16 bit value and update the PC.  */
-STATIC_INLINE uint8
+STATIC_INLINE UNUSED uint8
 cpu_fetch8 (sim_cpu *cpu)
 {
   uint16 addr = cpu->cpu_regs.pc;
@@ -511,7 +511,7 @@  cpu_fetch8 (sim_cpu *cpu)
   return val;
 }
 
-STATIC_INLINE uint16
+STATIC_INLINE UNUSED uint16
 cpu_fetch16 (sim_cpu *cpu)
 {
   uint16 addr = cpu->cpu_regs.pc;