Debug mode output broken

Paolo Carlini pcarlini@suse.de
Fri Aug 6 15:46:00 GMT 2004


Kaspar Fischer wrote:

>>Index: src/debug.cc
>>===================================================================
>>RCS file: /cvs/gcc/gcc/libstdc++-v3/src/debug.cc,v
>>retrieving revision 1.3.10.2
>>diff -u -p -b -B -r1.3.10.2 debug.cc
>>--- src/debug.cc	15 May 2004 21:17:59 -0000
>>  	1.3.10.2
>>+++ src/debug.cc	6 Aug 2004 10:54:15 -0000
>>@@ -506,6 +506,7 @@ namespace __gnu_debug
>>       std::snprintf(__buf, __n, __fmt, __s);
>> #else
>>       std::sprintf(__buf, __fmt, __s);
>>+      __buf[__n-1] = '\0';
>> #endif
>>    
>>
>This works for me, on both PowerPC and SPARC
>
Ok.

Jonathan, everything considered (simplicity, affecting only 
!_GLIBCXX_USE_C99,
code not performance critical since we are in debug mode, ...) I think 
that, after all,
your very first solution is the best one. If you don't hear other 
comments during
the next hours please apply it after due testing. Remember, however, to 
add a comment,
mentioning the special case of _M_print_string, and remove the 
__attribute__((__unused__)),
not needed anymore.

Thanks,
Paolo.



More information about the Libstdc++ mailing list