diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 2a40a60857..6f779fe998 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,15 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-04-03 13:00 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/compiler/harbour.y + * harbour/source/compiler/harbour.yyc + ! fixed false warning about unreachable code in + switch ...; case ...; exit; case ... + statement + * disabled some error messages about illegal pass by reference + now HVM should not allow to create cyclic reference chain + 2007-04-02 19:25 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/ole/oleauto.prg * removed unused local variable diff --git a/harbour/source/compiler/harbour.y b/harbour/source/compiler/harbour.y index 639c0fbc1b..83020db2e6 100644 --- a/harbour/source/compiler/harbour.y +++ b/harbour/source/compiler/harbour.y @@ -2379,7 +2379,9 @@ static void hb_compSwitchStart( HB_COMP_DECL ) static void hb_compSwitchAdd( HB_COMP_DECL, HB_EXPR_PTR pExpr ) { HB_SWITCHCASE_PTR pCase; - + + HB_COMP_PARAM->functions.pLast->bFlags &= ~FUN_BREAK_CODE; + if( pExpr ) { /* normal CASE */ @@ -2511,8 +2513,6 @@ void hb_compSwitchKill( HB_COMP_DECL ) static HB_EXPR_PTR hb_compCheckPassByRef( HB_COMP_DECL, HB_EXPR_PTR pExpr ) { - const char * szDesc; - if( pExpr->ExprType == HB_ET_FUNCALL ) { if( hb_compExprParamListLen( pExpr->value.asFunCall.pParms ) == 0 ) @@ -2531,21 +2531,25 @@ static HB_EXPR_PTR hb_compCheckPassByRef( HB_COMP_DECL, HB_EXPR_PTR pExpr ) return pExpr; } } - else if( HB_COMP_PARAM->iPassByRef & ( HB_PASSBYREF_FUNCALL | HB_PASSBYREF_ARRAY ) ) - return pExpr; - - if( pExpr->ExprType == HB_ET_REFERENCE ) +#if 0 + else if( !( HB_COMP_PARAM->iPassByRef & ( HB_PASSBYREF_FUNCALL | HB_PASSBYREF_ARRAY ) ) ) { - HB_EXPR_PTR pDelExpr = pExpr; - pExpr = pExpr->value.asReference; - HB_COMP_EXPR_CLEAR( pDelExpr ); + const char * szDesc; + if( pExpr->ExprType == HB_ET_REFERENCE ) + { + HB_EXPR_PTR pDelExpr = pExpr; + pExpr = pExpr->value.asReference; + HB_COMP_EXPR_CLEAR( pDelExpr ); + } + + szDesc = hb_compExprAsSymbol( pExpr ); + if( ! szDesc ) + szDesc = hb_compExprDescription( pExpr ); + + return hb_compErrorRefer( HB_COMP_PARAM, pExpr, szDesc ); } - - szDesc = hb_compExprAsSymbol( pExpr ); - if( ! szDesc ) - szDesc = hb_compExprDescription( pExpr ); - - return hb_compErrorRefer( HB_COMP_PARAM, pExpr, szDesc ); +#endif + return pExpr; } /* ************************************************************************* */ diff --git a/harbour/source/compiler/harbour.yyc b/harbour/source/compiler/harbour.yyc index 39e3734c1a..fe6a8c8013 100644 --- a/harbour/source/compiler/harbour.yyc +++ b/harbour/source/compiler/harbour.yyc @@ -7615,7 +7615,9 @@ static void hb_compSwitchStart( HB_COMP_DECL ) static void hb_compSwitchAdd( HB_COMP_DECL, HB_EXPR_PTR pExpr ) { HB_SWITCHCASE_PTR pCase; - + + HB_COMP_PARAM->functions.pLast->bFlags &= ~FUN_BREAK_CODE; + if( pExpr ) { /* normal CASE */ @@ -7747,8 +7749,6 @@ void hb_compSwitchKill( HB_COMP_DECL ) static HB_EXPR_PTR hb_compCheckPassByRef( HB_COMP_DECL, HB_EXPR_PTR pExpr ) { - const char * szDesc; - if( pExpr->ExprType == HB_ET_FUNCALL ) { if( hb_compExprParamListLen( pExpr->value.asFunCall.pParms ) == 0 ) @@ -7767,21 +7767,25 @@ static HB_EXPR_PTR hb_compCheckPassByRef( HB_COMP_DECL, HB_EXPR_PTR pExpr ) return pExpr; } } - else if( HB_COMP_PARAM->iPassByRef & ( HB_PASSBYREF_FUNCALL | HB_PASSBYREF_ARRAY ) ) - return pExpr; - - if( pExpr->ExprType == HB_ET_REFERENCE ) +#if 0 + else if( !( HB_COMP_PARAM->iPassByRef & ( HB_PASSBYREF_FUNCALL | HB_PASSBYREF_ARRAY ) ) ) { - HB_EXPR_PTR pDelExpr = pExpr; - pExpr = pExpr->value.asReference; - HB_COMP_EXPR_CLEAR( pDelExpr ); + const char * szDesc; + if( pExpr->ExprType == HB_ET_REFERENCE ) + { + HB_EXPR_PTR pDelExpr = pExpr; + pExpr = pExpr->value.asReference; + HB_COMP_EXPR_CLEAR( pDelExpr ); + } + + szDesc = hb_compExprAsSymbol( pExpr ); + if( ! szDesc ) + szDesc = hb_compExprDescription( pExpr ); + + return hb_compErrorRefer( HB_COMP_PARAM, pExpr, szDesc ); } - - szDesc = hb_compExprAsSymbol( pExpr ); - if( ! szDesc ) - szDesc = hb_compExprDescription( pExpr ); - - return hb_compErrorRefer( HB_COMP_PARAM, pExpr, szDesc ); +#endif + return pExpr; } /* ************************************************************************* */