public inbox for sid@sourceware.org
 help / color / mirror / Atom feed
* cgen_bi_endian_cpu::end_trace
@ 2003-08-21 21:28 Dave Brolley
  0 siblings, 0 replies; only message in thread
From: Dave Brolley @ 2003-08-21 21:28 UTC (permalink / raw)
  To: sid

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

I've comitted the attached patch (approved by fche)  which addresses a 
problem when building sid with recent gcc compilers. The problem is that

    this->trace_stream << endl;

does not call

   template <typename T>
    basic_cpu::cpu_trace_stream& operator<< 
(basic_cpu::cpu_trace_stream& s, T t)

as expected. As a result, sid's tracing output comes out all on one line 
when tracing is to cout. The patch defines a new method of 
basic_cpu::cpu_trace_stream which can be explicitely called to avoid the 
ambiguity.

The patch also changes an unnecessary dynamic_cast to a static_cast. 
Something we noticed while investigating.

Dave


[-- Attachment #2: sidtrace.patch.txt --]
[-- Type: text/plain, Size: 1642 bytes --]

Index: sid/component/cgen-cpu/compCGEN.cxx
===================================================================
RCS file: /cvs/src/src/sid/component/cgen-cpu/compCGEN.cxx,v
retrieving revision 1.11
diff -c -p -r1.11 compCGEN.cxx
*** sid/component/cgen-cpu/compCGEN.cxx	15 Jan 2003 20:04:57 -0000	1.11
--- sid/component/cgen-cpu/compCGEN.cxx	21 Aug 2003 21:20:25 -0000
*************** cgen_bi_endian_cpu::begin_trace (PCADDR 
*** 250,256 ****
  void
  cgen_bi_endian_cpu::end_trace ()
  {
!   this->trace_stream << endl;
  }
  
  // Counter support
--- 250,256 ----
  void
  cgen_bi_endian_cpu::end_trace ()
  {
!   trace_stream.end_line ();
  }
  
  // Counter support
Index: sid/include/sidcpuutil.h
===================================================================
RCS file: /cvs/src/src/sid/include/sidcpuutil.h,v
retrieving revision 1.25
diff -c -p -r1.25 sidcpuutil.h
*** sid/include/sidcpuutil.h	16 Apr 2003 18:15:16 -0000	1.25
--- sid/include/sidcpuutil.h	21 Aug 2003 21:20:27 -0000
*************** namespace sidutil
*** 227,232 ****
--- 227,239 ----
  	std::ofstream::open (filename.c_str (), std::ios::app);
  	cout_p = false;
        }
+       void end_line ()
+       {
+ 	if (LIKELY (cout_p))
+ 	  std::cout << std::endl;
+ 	else
+ 	  *this << std::endl;
+       }
        bool cout_p;
      };
  
*************** public:
*** 611,617 ****
        if (LIKELY (s.cout_p))
  	std::cout << t;
        else
! 	dynamic_cast <std::ofstream&> (s) << t;
        return s;
      }
    
--- 618,624 ----
        if (LIKELY (s.cout_p))
  	std::cout << t;
        else
! 	static_cast <std::ofstream&> (s) << t;
        return s;
      }
    

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-08-21 21:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-21 21:28 cgen_bi_endian_cpu::end_trace Dave Brolley

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).