2001-04-08 16:15 UTC-0800 Ron Pinkas <ron@profit-master.com>

* include/hberrors.h
     ! Corrected typo.

   * source/compiler/harbour.sly
   * source/compiler/harbour.y
     ! Corrected few incorrect "Unreachable code warnings".
     ! Corrected hb_compPushLine() in RECOVER and RECOVERUSING

   * source/compiler/harbour.c
   * source/compiler/hbpcode.c
     ! Improved StrongType logic.
This commit is contained in:
Ron Pinkas
2001-04-08 23:16:24 +00:00
parent bb7e6f1111
commit 274cba392f
6 changed files with 1027 additions and 342 deletions

View File

@@ -1,3 +1,16 @@
2001-04-08 16:15 UTC-0800 Ron Pinkas <ron@profit-master.com>
* include/hberrors.h
! Corrected typo.
* source/compiler/harbour.sly
* source/compiler/harbour.y
! Corrected few incorrect "Unreachable code warnings".
! Corrected hb_compPushLine() in RECOVER and RECOVERUSING
* source/compiler/harbour.c
* source/compiler/hbpcode.c
! Improved StrongType logic.
2001-04-07 13:25 UTC-0800 Ron Pinkas <ron@profit-master.com>
* source/compiler/hbpcode.c
! Fixed some StrongType logic.

View File

@@ -106,7 +106,7 @@ extern "C" {
#define HB_COMP_WARN_FUN_WITH_NO_RETURN 7
#define HB_COMP_WARN_ASSIGN_TYPE 8
#define HB_COMP_WARN_OPERAND_TYPE 9
#define HB_COMP_WARN_OPERANDS_INCOMPATBLE 10
#define HB_COMP_WARN_OPERANDS_INCOMPATIBLE 10
#define HB_COMP_WARN_ASSIGN_SUSPECT 11
#define HB_COMP_WARN_OPERAND_SUSPECT 12
#define HB_COMP_WARN_NOT_ARRAY 13

View File

@@ -1744,19 +1744,19 @@ ULONG hb_compGenJump( LONG lOffset )
/* Just a place holder, it might be a far jump...*/
if( lOffset == 0 )
{
hb_compGenPCode4( HB_P_JUMPFAR, 0, 0, 0, ( BOOL ) 0 );
hb_compGenPCode4( HB_P_JUMPFAR, 0, 0, 0, ( BOOL ) 1 );
}
else if( lOffset >= -128 && lOffset <= 127 )
{
hb_compGenPCode4( HB_P_JUMPNEAR, HB_LOBYTE( lOffset ), HB_P_NOOP, HB_P_NOOP, ( BOOL ) 0 );
hb_compGenPCode4( HB_P_JUMPNEAR, HB_LOBYTE( lOffset ), HB_P_NOOP, HB_P_NOOP, ( BOOL ) 1 );
}
else if( lOffset >= SHRT_MIN && lOffset <= SHRT_MAX )
{
hb_compGenPCode4( HB_P_JUMP, HB_LOBYTE( lOffset ), HB_HIBYTE( lOffset ), HB_P_NOOP, ( BOOL ) 0 );
hb_compGenPCode4( HB_P_JUMP, HB_LOBYTE( lOffset ), HB_HIBYTE( lOffset ), HB_P_NOOP, ( BOOL ) 1 );
}
else if( lOffset >= (-8388608L) && lOffset <= 8388607L )
{
hb_compGenPCode4( HB_P_JUMPFAR, HB_LOBYTE( lOffset ), HB_HIBYTE( lOffset ), ( BYTE ) ( ( ( USHORT ) ( lOffset ) >> 16 ) & 0xFF ), ( BOOL ) 0 );
hb_compGenPCode4( HB_P_JUMPFAR, HB_LOBYTE( lOffset ), HB_HIBYTE( lOffset ), ( BYTE ) ( ( ( USHORT ) ( lOffset ) >> 16 ) & 0xFF ), ( BOOL ) 1 );
}
else
{
@@ -3223,6 +3223,15 @@ void hb_compCodeBlockStart()
{
PFUNCTION pBlock;
#if 0
if( hb_comp_iWarnings >= 3 )
{
/* Not generating yet - will be generated in hb_compCodeBlockEnd() */
hb_compGenPCode1( HB_P_PUSHBLOCK );
pBlock->lPCodePos--;
}
#endif
pBlock = hb_compFunctionNew( NULL, HB_FS_STATIC );
pBlock->pOwner = hb_comp_functions.pLast;
pBlock->iStaticsBase = hb_comp_functions.pLast->iStaticsBase;
@@ -3273,9 +3282,7 @@ void hb_compCodeBlockEnd( void )
++wLocals;
}
if( ( pCodeblock->lPCodePos + 3 ) <= 255 &&
pCodeblock->wParamCount == 0 &&
wLocals == 0 )
if( ( pCodeblock->lPCodePos + 3 ) <= 255 && pCodeblock->wParamCount == 0 && wLocals == 0 )
{
/* NOTE: 3 = HB_P_PUSHBLOCKSHORT + BYTE( size ) + _ENDBLOCK */
wSize = ( USHORT ) pCodeblock->lPCodePos + 3;

View File

@@ -1538,7 +1538,7 @@ IfElse : ELSE Crlf { hb_comp_functions.pLast->bFlags &= ~ FUN_BREAK_CODE; }
EmptyStats
;
IfElseIf : ELSEIF { hb_compLinePush(); } Expression Crlf
IfElseIf : ELSEIF { hb_comp_functions.pLast->bFlags &= ~ FUN_BREAK_CODE; hb_compLinePush(); } Expression Crlf
{ hb_comp_functions.pLast->bFlags &= ~ FUN_BREAK_CODE;
hb_compExprDelete( hb_compExprGenPush( $3 ) );
$<iNumber>$ = hb_compGenJumpFalse( 0 );
@@ -1548,7 +1548,7 @@ IfElseIf : ELSEIF { hb_compLinePush(); } Expression Crlf
hb_compGenJumpHere( $<iNumber>5 );
}
| IfElseIf ELSEIF { hb_compLinePush(); } Expression Crlf
| IfElseIf ELSEIF { hb_comp_functions.pLast->bFlags &= ~ FUN_BREAK_CODE; hb_compLinePush(); } Expression Crlf
{ hb_comp_functions.pLast->bFlags &= ~ FUN_BREAK_CODE;
hb_compExprDelete( hb_compExprGenPush( $4 ) );
$<iNumber>$ = hb_compGenJumpFalse( 0 );
@@ -1654,8 +1654,8 @@ DoWhile : WhileBegin Expression Crlf
WhileBegin : WHILE { $$ = hb_comp_functions.pLast->lPCodePos; hb_compLinePushIfInside(); ++hb_comp_wWhileCounter; hb_compLoopStart(); }
;
EndWhile : END
| ENDDO
EndWhile : END { hb_comp_functions.pLast->bFlags &= ~ FUN_BREAK_CODE; }
| ENDDO { hb_comp_functions.pLast->bFlags &= ~ FUN_BREAK_CODE; }
;
ForNext : FOR LValue ForAssign Expression /* 1 2 3 4 */
@@ -1755,7 +1755,8 @@ RecoverEmpty : RECOVER
hb_comp_functions.pLast->bFlags &= ~ FUN_BREAK_CODE;
$<lNumber>$ = hb_comp_functions.pLast->lPCodePos;
--hb_comp_wSeqCounter;
hb_compGenPCode2( HB_P_SEQRECOVER, HB_P_POP, ( BOOL ) 1 );
hb_compLinePush();
hb_compGenPCode2( HB_P_SEQRECOVER, HB_P_POP, ( BOOL ) 0 );
}
;
@@ -1764,8 +1765,8 @@ RecoverUsing : RECOVERUSING IdentName
hb_comp_functions.pLast->bFlags &= ~ FUN_BREAK_CODE;
$<lNumber>$ = hb_comp_functions.pLast->lPCodePos;
--hb_comp_wSeqCounter;
hb_compGenPCode1( HB_P_SEQRECOVER );
hb_compLinePush();
hb_compGenPCode1( HB_P_SEQRECOVER );
hb_compGenPopVar( $2 );
}
;

View File

@@ -1464,8 +1464,8 @@ DoWhile : WhileBegin Expression Crlf
WhileBegin : WHILE { $$ = hb_comp_functions.pLast->lPCodePos; hb_compLinePushIfInside(); ++hb_comp_wWhileCounter; hb_compLoopStart(); }
;
EndWhile : END
| ENDDO
EndWhile : END { hb_comp_functions.pLast->bFlags &= ~ FUN_BREAK_CODE; }
| ENDDO { hb_comp_functions.pLast->bFlags &= ~ FUN_BREAK_CODE; }
;
ForNext : FOR LValue ForAssign Expression /* 1 2 3 4 */
@@ -1565,7 +1565,8 @@ RecoverEmpty : RECOVER
hb_comp_functions.pLast->bFlags &= ~ FUN_BREAK_CODE;
$<lNumber>$ = hb_comp_functions.pLast->lPCodePos;
--hb_comp_wSeqCounter;
hb_compGenPCode2( HB_P_SEQRECOVER, HB_P_POP, ( BOOL ) 1 );
hb_compLinePush();
hb_compGenPCode2( HB_P_SEQRECOVER, HB_P_POP, ( BOOL ) 0 );
}
;
@@ -1574,8 +1575,8 @@ RecoverUsing : RECOVERUSING IdentName
hb_comp_functions.pLast->bFlags &= ~ FUN_BREAK_CODE;
$<lNumber>$ = hb_comp_functions.pLast->lPCodePos;
--hb_comp_wSeqCounter;
hb_compGenPCode1( HB_P_SEQRECOVER );
hb_compLinePush();
hb_compGenPCode1( HB_P_SEQRECOVER );
hb_compGenPopVar( $2 );
}
;

File diff suppressed because it is too large Load Diff