public inbox for sid@sourceware.org
 help / color / mirror / Atom feed
* [patch]: RFA: Remove compile time warnings in cgen-cpu.h
@ 2005-04-13 10:46 Nick Clifton
  2005-04-13 11:03 ` Frank Ch. Eigler
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Clifton @ 2005-04-13 10:46 UTC (permalink / raw)
  To: sid

[-- Attachment #1: Type: text/plain, Size: 951 bytes --]

Hi Guys,

  I am seeking permission to apply the attached patch.  It fixes a
  couple of compile time warnings associated with the cgen-cpu.h file.
  
  The first is that it declares several void functions and then uses a
  "return <expression>" statement.  The second is that it uses the
  "reinterpret_cast<>" operator to convert between integer types and
  floating point types, which for some versions of GCC at least, does
  not work.

  The patch fixes these problems by first removing the "return"
  keyword, but leaving the expression, in the void functions and
  secondly by using a union to perform explicit conversions between
  floats and ints.

  Tested by building an xstormy16-elf sid.

  May I apply this patch ?

Cheers
  Nick

sid/components/cgen-cpu/ChangeLog
2005-04-13  Nick Clifton  <nickc@redhat.com>

	* cgen-cpu.h: Remove return operators from void	functions.
	Use unions to convert between integer and floating point types.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: cgen-cpu.h.patch --]
[-- Type: text/x-patch, Size: 9024 bytes --]

Index: sid/component/cgen-cpu/cgen-cpu.h
===================================================================
RCS file: /cvs/src/src/sid/component/cgen-cpu/cgen-cpu.h,v
retrieving revision 1.11
diff -c -3 -p -r1.11 cgen-cpu.h
*** sid/component/cgen-cpu/cgen-cpu.h	12 Feb 2005 16:25:45 -0000	1.11
--- sid/component/cgen-cpu/cgen-cpu.h	13 Apr 2005 10:26:37 -0000
*************** public:
*** 100,116 ****
    inline void
    SETMEMBI(PCADDR pc, ADDR addr, BI value) const
      {
!       return this->write_insn_memory_1 (pc, addr, value);
      }
    inline void
    SETMEMQI(PCADDR pc, ADDR addr, QI value) const
      {
!       return this->write_data_memory_1 (pc, addr, value);
      }
    inline void
    SETMEMUQI(PCADDR pc, ADDR addr, UQI value) const
      {
!       return this->write_data_memory_1 (pc, addr, value);
      }
    inline HI
    GETMEMHI(PCADDR pc, ADDR addr) const
--- 100,116 ----
    inline void
    SETMEMBI(PCADDR pc, ADDR addr, BI value) const
      {
!       this->write_insn_memory_1 (pc, addr, value);
      }
    inline void
    SETMEMQI(PCADDR pc, ADDR addr, QI value) const
      {
!       this->write_data_memory_1 (pc, addr, value);
      }
    inline void
    SETMEMUQI(PCADDR pc, ADDR addr, UQI value) const
      {
!       this->write_data_memory_1 (pc, addr, value);
      }
    inline HI
    GETMEMHI(PCADDR pc, ADDR addr) const
*************** public:
*** 125,136 ****
    inline void
    SETMEMHI(PCADDR pc, ADDR addr, HI value) const
      {
!       return this->write_data_memory_2 (pc, addr, value);
      }
    inline void
    SETMEMUHI(PCADDR pc, ADDR addr, UHI value) const
      {
!       return this->write_data_memory_2 (pc, addr, value);
      }
    inline SI
    GETMEMSI(PCADDR pc, ADDR addr) const
--- 125,136 ----
    inline void
    SETMEMHI(PCADDR pc, ADDR addr, HI value) const
      {
!       this->write_data_memory_2 (pc, addr, value);
      }
    inline void
    SETMEMUHI(PCADDR pc, ADDR addr, UHI value) const
      {
!       this->write_data_memory_2 (pc, addr, value);
      }
    inline SI
    GETMEMSI(PCADDR pc, ADDR addr) const
*************** public:
*** 140,146 ****
    inline void
    SETMEMSI(PCADDR pc, ADDR addr, SI value) const
      {
!       return this->write_data_memory_4 (pc, addr, value);
      }
    inline USI
    GETMEMUSI(PCADDR pc, ADDR addr) const
--- 140,146 ----
    inline void
    SETMEMSI(PCADDR pc, ADDR addr, SI value) const
      {
!       this->write_data_memory_4 (pc, addr, value);
      }
    inline USI
    GETMEMUSI(PCADDR pc, ADDR addr) const
*************** public:
*** 150,156 ****
    inline void
    SETMEMUSI(PCADDR pc, ADDR addr, USI value) const
      {
!       return this->write_data_memory_4 (pc, addr, value);
      }
    inline DI
    GETMEMDI(PCADDR pc, ADDR addr) const
--- 150,156 ----
    inline void
    SETMEMUSI(PCADDR pc, ADDR addr, USI value) const
      {
!       this->write_data_memory_4 (pc, addr, value);
      }
    inline DI
    GETMEMDI(PCADDR pc, ADDR addr) const
*************** public:
*** 160,194 ****
    inline void
    SETMEMDI(PCADDR pc, ADDR addr, DI value) const
      {
!       return this->write_data_memory_8 (pc, addr, value);
      }
    inline void
    SETMEMUDI(PCADDR pc, ADDR addr, UDI value) const
      {
!       return this->write_data_memory_8 (pc, addr, value);
      }
  
    // floats (can you think of a better way to do this?)
    inline SF
    GETMEMSF(PCADDR pc, IADDR addr) const
      {
!       return reinterpret_cast<SF>(this->read_insn_memory_4 (pc, addr));
      }
    inline void
    SETMEMSF(PCADDR pc, ADDR addr, SF value) const
      {
!       return this->write_insn_memory_4 (pc, addr, reinterpret_cast<USI>(value));
      }
- 
    inline DF
    GETMEMDF(PCADDR pc, IADDR addr) const
      {
!       return reinterpret_cast<DF>(this->read_insn_memory_8 (pc, addr));
      }
    inline void
    SETMEMDF(PCADDR pc, ADDR addr, DF value) const
      {
!       return this->write_insn_memory_8 (pc, addr, reinterpret_cast<UDI>(value));
      }
  
    // IMEM: instruction memory calls
--- 160,225 ----
    inline void
    SETMEMDI(PCADDR pc, ADDR addr, DI value) const
      {
!       this->write_data_memory_8 (pc, addr, value);
      }
    inline void
    SETMEMUDI(PCADDR pc, ADDR addr, UDI value) const
      {
!       this->write_data_memory_8 (pc, addr, value);
      }
  
    // floats (can you think of a better way to do this?)
    inline SF
    GETMEMSF(PCADDR pc, IADDR addr) const
      {
!       union
!       {
! 	SF sf;
! 	USI usi;
!       }
!       caster;
!       
!       caster.usi = this->read_insn_memory_4 (pc, addr);
!       return caster.sf;
      }
    inline void
    SETMEMSF(PCADDR pc, ADDR addr, SF value) const
      {
!       union
!       {
! 	SF sf;
! 	USI usi;
!       }
!       caster;
!       caster.sf = value;
! 	
!       this->write_insn_memory_4 (pc, addr, caster.usi);
      }
    inline DF
    GETMEMDF(PCADDR pc, IADDR addr) const
      {
!       union
!       {
! 	DF df;
! 	UDI udi;
!       }
!       caster;
!       
!       caster.udi = this->read_insn_memory_8 (pc, addr);
!       return caster.df;
      }
    inline void
    SETMEMDF(PCADDR pc, ADDR addr, DF value) const
      {
!       union
!       {
! 	DF df;
! 	UDI udi;
!       }
!       caster;
! 
!       caster.df = value;
!       this->write_insn_memory_8 (pc, addr, caster.udi);
      }
  
    // IMEM: instruction memory calls
*************** public:
*** 201,207 ****
    inline void
    SETIMEMQI(PCADDR pc, ADDR addr, QI value) const
      {
!       return this->write_insn_memory_1 (pc, addr, value);
      }
    inline UQI
    GETIMEMUQI(PCADDR pc, IADDR addr) const
--- 232,238 ----
    inline void
    SETIMEMQI(PCADDR pc, ADDR addr, QI value) const
      {
!       this->write_insn_memory_1 (pc, addr, value);
      }
    inline UQI
    GETIMEMUQI(PCADDR pc, IADDR addr) const
*************** public:
*** 211,217 ****
    inline void
    SETIMEMUQI(PCADDR pc, ADDR addr, UQI value) const
      {
!       return this->write_insn_memory_1 (pc, addr, value);
      }
    inline HI
    GETIMEMHI(PCADDR pc, IADDR addr) const
--- 242,248 ----
    inline void
    SETIMEMUQI(PCADDR pc, ADDR addr, UQI value) const
      {
!       this->write_insn_memory_1 (pc, addr, value);
      }
    inline HI
    GETIMEMHI(PCADDR pc, IADDR addr) const
*************** public:
*** 221,227 ****
    inline void
    SETIMEMHI(PCADDR pc, ADDR addr, HI value) const
      {
!       return this->write_insn_memory_2 (pc, addr, value);
      }
    inline UHI
    GETIMEMUHI(PCADDR pc, IADDR addr) const
--- 252,258 ----
    inline void
    SETIMEMHI(PCADDR pc, ADDR addr, HI value) const
      {
!       this->write_insn_memory_2 (pc, addr, value);
      }
    inline UHI
    GETIMEMUHI(PCADDR pc, IADDR addr) const
*************** public:
*** 231,237 ****
    inline void
    SETIMEMUHI(PCADDR pc, ADDR addr, UHI value) const
      {
!       return this->write_insn_memory_2 (pc, addr, value);
      }
    inline SI
    GETIMEMSI(PCADDR pc, IADDR addr) const
--- 262,268 ----
    inline void
    SETIMEMUHI(PCADDR pc, ADDR addr, UHI value) const
      {
!       this->write_insn_memory_2 (pc, addr, value);
      }
    inline SI
    GETIMEMSI(PCADDR pc, IADDR addr) const
*************** public:
*** 241,247 ****
    inline void
    SETIMEMSI(PCADDR pc, ADDR addr, SI value) const
      {
!       return this->write_insn_memory_4 (pc, addr, value);
      }
    inline USI
    GETIMEMUSI(PCADDR pc, IADDR addr) const
--- 272,278 ----
    inline void
    SETIMEMSI(PCADDR pc, ADDR addr, SI value) const
      {
!       this->write_insn_memory_4 (pc, addr, value);
      }
    inline USI
    GETIMEMUSI(PCADDR pc, IADDR addr) const
*************** public:
*** 251,257 ****
    inline void
    SETIMEMUSI(PCADDR pc, ADDR addr, USI value) const
      {
!       return this->write_insn_memory_4 (pc, addr, value);
      }
    inline DI
    GETIMEMDI(PCADDR pc, IADDR addr) const
--- 282,288 ----
    inline void
    SETIMEMUSI(PCADDR pc, ADDR addr, USI value) const
      {
!       this->write_insn_memory_4 (pc, addr, value);
      }
    inline DI
    GETIMEMDI(PCADDR pc, IADDR addr) const
*************** public:
*** 261,267 ****
    inline void
    SETIMEMDI(PCADDR pc, ADDR addr, DI value) const
      {
!       return this->write_insn_memory_8 (pc, addr, value);
      }
    inline UDI
    GETIMEMUDI(PCADDR pc, IADDR addr) const
--- 292,298 ----
    inline void
    SETIMEMDI(PCADDR pc, ADDR addr, DI value) const
      {
!       this->write_insn_memory_8 (pc, addr, value);
      }
    inline UDI
    GETIMEMUDI(PCADDR pc, IADDR addr) const
*************** public:
*** 271,281 ****
    inline void
    SETIMEMUDI(PCADDR pc, ADDR addr, UDI value) const
      {
!       return this->write_insn_memory_8 (pc, addr, value);
      }
- 
- 
- 
  };
  
  } // namespace cgen
--- 302,309 ----
    inline void
    SETIMEMUDI(PCADDR pc, ADDR addr, UDI value) const
      {
!       this->write_insn_memory_8 (pc, addr, value);
      }
  };
  
  } // namespace cgen

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-04-13 11:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-13 10:46 [patch]: RFA: Remove compile time warnings in cgen-cpu.h Nick Clifton
2005-04-13 11:03 ` Frank Ch. Eigler
2005-04-13 11:12   ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).