2008-12-24 03:23 UTC+0200 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt)
* include/hberrors.h
* source/compiler/hbgenerr.c
* source/compiler/hbopt.c
+ implemented warning: Variable '%s' is never assigned in function %s(%d).
This variable can be replaced by value NIL
* source/rtl/treport.prg
% removed never assigned variable
This commit is contained in:
@@ -8,6 +8,16 @@
|
||||
2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
|
||||
*/
|
||||
|
||||
2008-12-24 03:23 UTC+0200 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt)
|
||||
* include/hberrors.h
|
||||
* source/compiler/hbgenerr.c
|
||||
* source/compiler/hbopt.c
|
||||
+ implemented warning: Variable '%s' is never assigned in function %s(%d).
|
||||
This variable can be replaced by value NIL
|
||||
|
||||
* source/rtl/treport.prg
|
||||
% removed never assigned variable
|
||||
|
||||
2008-12-24 00:04 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/source/common/expropt1.c
|
||||
* harbour/source/common/expropt2.c
|
||||
|
||||
@@ -165,6 +165,7 @@ HB_EXTERN_BEGIN
|
||||
#define HB_COMP_WARN_FORVAR_DUPL 30
|
||||
#define HB_COMP_WARN_ENUM_INVALID 31
|
||||
#define HB_COMP_WARN_ASSIGNED_UNUSED 32
|
||||
#define HB_COMP_WARN_NEVER_ASSIGNED 33
|
||||
|
||||
HB_EXTERN_END
|
||||
|
||||
|
||||
@@ -144,7 +144,8 @@ const char * hb_comp_szWarnings[] =
|
||||
"1Redundant 'ANNOUNCE %s' statement ignored",
|
||||
"0Duplicate variable '%s' in nested FOR loop",
|
||||
"0Invalid variable '%s' for enumerator message",
|
||||
"3Variable '%s' assigned but not used in function '%s'"
|
||||
"3Variable '%s' is assigned but not used in function '%s'",
|
||||
"3Variable '%s' is never assigned in function '%s'"
|
||||
};
|
||||
|
||||
static void hb_compDispMessage( HB_COMP_DECL, char cPrefix, int iValue,
|
||||
|
||||
@@ -1467,12 +1467,18 @@ void hb_compPCodeTraceOptimizer( HB_COMP_DECL )
|
||||
pVar = pFunc->pLocals;
|
||||
while( pVar )
|
||||
{
|
||||
/* TOFIX: PARAMETERS sentence
|
||||
The temporary solution is to disable optmisation if PARAMETERS is used.
|
||||
*/
|
||||
/* Compiler and optimizer should have the same opinion about variable usage */
|
||||
assert( ( ! ( pVar->iUsed & VU_USED ) && pLocals[ usIndex ].bFlags == 0 ) ||
|
||||
( ( pVar->iUsed & VU_USED ) && pLocals[ usIndex ].bFlags != 0 ) );
|
||||
|
||||
if( usIndex >= pFunc->wParamCount && pLocals[ usIndex ].bFlags == OPT_LOCAL_FLAG_PUSH )
|
||||
{
|
||||
char szFun[ 256 ];
|
||||
|
||||
hb_snprintf( szFun, sizeof( szFun ), "%s(%i)", pFunc->szName, pVar->iDeclLine );
|
||||
hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_NEVER_ASSIGNED, pVar->szName, szFun );
|
||||
}
|
||||
|
||||
pVar = pVar->pNext;
|
||||
usIndex++;
|
||||
}
|
||||
|
||||
@@ -463,7 +463,6 @@ METHOD ReportHeader() CLASS HBReportForm
|
||||
LOCAL nHeadline
|
||||
LOCAL nRPageSize
|
||||
LOCAL aTempPgHeader
|
||||
LOCAL nHeadSize
|
||||
|
||||
nRPageSize := ::aReportData[RPT_WIDTH] - ::aReportData[RPT_RMARGIN]
|
||||
|
||||
@@ -495,12 +494,12 @@ METHOD ReportHeader() CLASS HBReportForm
|
||||
ENDIF
|
||||
FOR nLine := 1 TO Len( ::aReportData[ RPT_HEADER])
|
||||
nLinesInHeader := Max( XMLCOUNT(LTrim( ::aReportData[RPT_HEADER,;
|
||||
nLine ] ), nHeadSize),1 )
|
||||
nLine ] )),1 )
|
||||
|
||||
FOR nHeadLine := 1 to nLinesInHeader
|
||||
|
||||
cHeader := RTrim( XMEMOLINE( LTrim( ::aReportData[RPT_HEADER, nLine ]),;
|
||||
nHeadSize,nHeadLine))
|
||||
cHeader := RTrim( XMEMOLINE( LTrim( ::aReportData[RPT_HEADER, nLine ]),,;
|
||||
nHeadLine))
|
||||
AAdd( aPageHeader, Space((nRPageSize - ::aReportData[ RPT_LMARGIN ] -;
|
||||
Len( cHeader ) ) / 2 ) + cHeader )
|
||||
|
||||
|
||||
Reference in New Issue
Block a user