Hi Julien
On 12/02/13 09:00, julien2412 wrote:
Hello,
Cppcheck reported this:
basic/source/comp/sbcomp.cxx
600 unassignedVariable style Variable 'TimeBuffer' is not assigned a value.
Here are the lines:
600 char TimeBuffer[200];
601 #ifdef DBG_TRACE_PROFILING
602 if( bPrintTimeStamp )
603 {
604 double dDiffTime = dCurTime - GdLastTime;
605 GdLastTime = dCurTime;
606 sprintf( TimeBuffer, "\t\t// Time = %f ms / += %f ms",
dCurTime*1000.0, dDiffTime*1000.0 );
607 }
608 #endif
609
610 if( bSTMT )
611 {
612 lcl_lineOut( rStr_STMNT.getStr(), lcl_getSpaces( nIndent ),
613 (bPrintTimeStamp && !GbIncludePCodes) ?
TimeBuffer : NULL );
614 }
See
http://opengrok.libreoffice.org/xref/core/basic/source/comp/sbcomp.cxx#600
By taking a look at the file, I notice there was 1 #ifdef DBG_TRACE_BASIC
and several blocks of #ifdef DBG_TRACE_PROFILING. Is it really useful to
keep both? What about removing DBG_TRACE_PROFILING and considering that
DBG_TRACE_BASIC should enable all debug (Basic + profiling) ?
I never used this snazy debug support but always wanted to check it out,
being able to dump out the pcode ( which at a quick glance seems to be
supported ) is *very* useful.
I am not convinced the timing information support offered when
DBG_TRACE_PROFILING is really useful ( cachegrind etc seem a better
choice for that ) But.. then again a cheap and nasty indicator doesn't
do any harm, personally I would not lump the 2 together I would guess
the timer related output if it were always on would introduce lots of
*noise* into the trace info. For me the choice would be either squash
the warning or remove (carefully) the DBG_TRACE_PROFILING related
functionality ( and the offending variable).
Now IMHO removing that stuff is probably more effort than it's worth and
squashing the warning would be the easiest thing to do.
would
TimerBuffer[0] = '\0' satisfy cppcheck or is the following statement legal
char TimeBuffer[200="";
( it works for me on gcc but would not bet its really valid c++ )
Noel
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.