ChangeLog 20000513-14:50 GMT+1
This commit is contained in:
@@ -1,3 +1,15 @@
|
||||
20000513-14:50 GMT+1 Ryszard Glab <rglab@imid.med.pl>
|
||||
|
||||
*include/hbcomp.h
|
||||
* added 'int iDeclLine' to VAR structure to hold the line number
|
||||
where a variable was declared
|
||||
|
||||
*source/compiler/harbour.c
|
||||
*source/compiler/harbour.y
|
||||
* fixed generation of 'unreachable code' warnings
|
||||
* warnings for declared but not used variable reports the line
|
||||
number where this variable was declared
|
||||
|
||||
20000513-13:51 GMT+2 Maurilio Longo <maurilio.longo@libero.it>
|
||||
|
||||
- source/rtl/stringsx.c
|
||||
|
||||
@@ -108,6 +108,7 @@ typedef struct _VAR
|
||||
char * szName; /* variable name */
|
||||
char * szAlias; /* variable alias namespace */
|
||||
int iUsed; /* number of times used */
|
||||
int iDeclLine; /* declaration line number */
|
||||
BYTE cType; /* optional strong typing */
|
||||
PCOMCLASS pClass;
|
||||
struct _VAR * pNext; /* pointer to next defined variable */
|
||||
|
||||
@@ -548,6 +548,7 @@ void hb_compVariableAdd( char * szVarName, BYTE cValueType )
|
||||
pVar->cType = cValueType;
|
||||
pVar->iUsed = VU_NOT_USED;
|
||||
pVar->pNext = NULL;
|
||||
pVar->iDeclLine = hb_comp_iLine;
|
||||
|
||||
if ( cValueType == '+' )
|
||||
{
|
||||
@@ -1440,6 +1441,7 @@ static int hb_compLocalGetPos( char * szVarName ) /* returns the order + 1 of a
|
||||
pVar->cType = ' ';
|
||||
pVar->iUsed = VU_NOT_USED;
|
||||
pVar->pNext = NULL;
|
||||
pVar->iDeclLine = hb_comp_iLine;
|
||||
|
||||
/* Use negative order to signal that we are accessing a local
|
||||
* variable from a codeblock
|
||||
@@ -2724,7 +2726,11 @@ void hb_compFinalizeFunction( void ) /* fixes all last defined function returns
|
||||
while( pVar )
|
||||
{
|
||||
if( pVar->szName && pFunc->szName && pFunc->szName[0] && ! ( pVar->iUsed & VU_USED ) )
|
||||
hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_VAR_NOT_USED, pVar->szName, pFunc->szName );
|
||||
{
|
||||
char szFun[ 256 ];
|
||||
sprintf( szFun, "%s(%i)", pFunc->szName, pVar->iDeclLine );
|
||||
hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_VAR_NOT_USED, pVar->szName, szFun );
|
||||
}
|
||||
|
||||
pVar = pVar->pNext;
|
||||
}
|
||||
@@ -2733,7 +2739,11 @@ void hb_compFinalizeFunction( void ) /* fixes all last defined function returns
|
||||
while( pVar )
|
||||
{
|
||||
if( pVar->szName && pFunc->szName && pFunc->szName[0] && ! ( pVar->iUsed & VU_USED ) )
|
||||
hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_VAR_NOT_USED, pVar->szName, pFunc->szName );
|
||||
{
|
||||
char szFun[ 256 ];
|
||||
sprintf( szFun, "%s(%i)", pFunc->szName, pVar->iDeclLine );
|
||||
hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_VAR_NOT_USED, pVar->szName, szFun );
|
||||
}
|
||||
|
||||
pVar = pVar->pNext;
|
||||
}
|
||||
|
||||
@@ -410,8 +410,8 @@ Statement : ExecFlow CrlfStmnt { }
|
||||
ExtVarList
|
||||
{ hb_compRTVariableGen( "__MVPRIVATE" ); hb_comp_cVarType = ' '; hb_comp_iVarScope = VS_NONE; } CrlfStmnt
|
||||
|
||||
| EXITLOOP CrlfStmnt { hb_compLoopExit(); hb_comp_functions.pLast->bFlags |= FUN_BREAK_CODE; }
|
||||
| LOOP CrlfStmnt { hb_compLoopLoop(); hb_comp_functions.pLast->bFlags |= FUN_BREAK_CODE; }
|
||||
| EXITLOOP { hb_comp_bDontGenLineNum = TRUE; hb_compLoopExit(); } CrlfStmnt { hb_comp_functions.pLast->bFlags |= FUN_BREAK_CODE; }
|
||||
| LOOP { hb_comp_bDontGenLineNum = TRUE; hb_compLoopLoop(); } CrlfStmnt { hb_comp_functions.pLast->bFlags |= FUN_BREAK_CODE; }
|
||||
| EXTERN ExtList Crlf
|
||||
| ANNOUNCE IdentName {
|
||||
if( hb_comp_szAnnounce == NULL )
|
||||
@@ -438,7 +438,7 @@ LineStat : Crlf { $<lNumber>$ = 0; hb_comp_bDontGenLineNum = TRUE; }
|
||||
;
|
||||
|
||||
Statements : LineStat { $<lNumber>$ = $<lNumber>1; hb_compLinePush(); }
|
||||
| Statements LineStat { $<lNumber>$ += $<lNumber>2; hb_compLinePush(); }
|
||||
| Statements LineStat { $<lNumber>$ += $<lNumber>2; hb_compLinePush(); }
|
||||
;
|
||||
|
||||
ExtList : IdentName { hb_compExternAdd( $1 ); }
|
||||
@@ -1191,8 +1191,12 @@ IfEndif : IfBegin EndIf { hb_compGenJumpHere( $1 ); }
|
||||
| IfBegin IfElseIf IfElse EndIf { hb_compGenJumpHere( $1 ); hb_compElseIfFix( $2 ); }
|
||||
;
|
||||
|
||||
EmptyStats : /* empty */ { hb_comp_bDontGenLineNum = TRUE; hb_comp_EOL = FALSE; }
|
||||
| Statements { hb_comp_EOL = FALSE; }
|
||||
EmptyStatements : LineStat { }
|
||||
| EmptyStatements { hb_compLinePush(); } LineStat { }
|
||||
;
|
||||
|
||||
EmptyStats : /* empty */ { hb_comp_bDontGenLineNum = TRUE; hb_comp_EOL = FALSE; }
|
||||
| EmptyStatements { hb_comp_EOL = FALSE; }
|
||||
;
|
||||
|
||||
IfBegin : IF SimpleExpression { ++hb_comp_wIfCounter; hb_compLinePush(); } Crlf { hb_compExprDelete( hb_compExprGenPush( $2 ) ); $$ = hb_compGenJumpFalse( 0 ); hb_compLinePush(); }
|
||||
|
||||
Reference in New Issue
Block a user