2017-03-24 20:02 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* include/hbcomp.h
  * src/compiler/hbmain.c
    * changed hb_compVariableScope() to static function

  * src/compiler/harbour.y
    ! added protection against GPF when nested function/procedure is
      declared inside extended block code

  * src/compiler/harbour.yyc
  * src/macro/macro.yyc
  * src/macro/macro.yyh
    * regenerated

  * include/hbexprb.c
    * minor simplification

  * include/hbexpra.c
    * use HB_SIZEOFARRAY() macro
This commit is contained in:
Przemysław Czerpak
2017-03-24 20:02:03 +01:00
parent 7bcf8e85db
commit 5f1da37fd2
9 changed files with 698 additions and 676 deletions

View File

@@ -10,6 +10,26 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2017-03-24 20:02 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* include/hbcomp.h
* src/compiler/hbmain.c
* changed hb_compVariableScope() to static function
* src/compiler/harbour.y
! added protection against GPF when nested function/procedure is
declared inside extended block code
* src/compiler/harbour.yyc
* src/macro/macro.yyc
* src/macro/macro.yyh
* regenerated
* include/hbexprb.c
* minor simplification
* include/hbexpra.c
* use HB_SIZEOFARRAY() macro
2017-03-23 12:15 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* src/compiler/harbour.y
* create real function in internal memory instead of dummy flow control

View File

@@ -84,7 +84,6 @@ extern void hb_compParserRun( HB_COMP_DECL );
#define HB_VSCOMP_TH_STATIC ( HB_VSCOMP_STATIC | HB_VSCOMP_THREAD )
/* return detailed information about a class of variable */
extern int hb_compVariableScope( HB_COMP_DECL, const char * );
#define HB_VS_UNDECLARED 0
/* variables declared in a current codeblock/function/procedure */
#define HB_VS_CBLOCAL_VAR 1 /* func/proc local variables and parameters used in codeblock (detached) */

View File

@@ -569,13 +569,11 @@ static const char * s_szStaticFun[] = {
"__BREAKBLOCK"
};
#define STATIC_FUNCTIONS ( sizeof( s_szStaticFun ) / sizeof( char * ) )
static HB_BOOL hb_compStaticFunction( const char * szName )
{
unsigned int ui;
for( ui = 0; ui < STATIC_FUNCTIONS; ++ui )
for( ui = 0; ui < HB_SIZEOFARRAY( s_szStaticFun ); ++ui )
{
if( strcmp( szName, s_szStaticFun[ ui ] ) == 0 )
return HB_TRUE;

View File

@@ -1137,16 +1137,11 @@ static HB_EXPR_FUNC( hb_compExprUseList )
break;
case HB_EA_DELETE:
if( pSelf->value.asList.pExprList )
while( pSelf->value.asList.pExprList )
{
PHB_EXPR pNext, pExpr = pSelf->value.asList.pExprList;
while( pExpr )
{
pNext = pExpr->pNext; /* store next expression */
HB_COMP_EXPR_FREE( pExpr );
pExpr = pNext;
}
pSelf->value.asList.pExprList = NULL;
PHB_EXPR pExpr = pSelf->value.asList.pExprList;
pSelf->value.asList.pExprList = pExpr->pNext;
HB_COMP_EXPR_FREE( pExpr );
}
break;
}

View File

@@ -1058,12 +1058,17 @@ CodeBlock : BlockHead
}
EmptyStats '}'
{ /* 6 */
hb_compCodeBlockEnd( HB_COMP_PARAM );
$$ = hb_compExprSetCodeblockBody( $1,
HB_COMP_PARAM->functions.pLast->pCode + $<sNumber>3,
HB_COMP_PARAM->functions.pLast->nPCodePos - $<sNumber>3 );
HB_COMP_PARAM->functions.pLast->nPCodePos = $<sNumber>3;
HB_COMP_PARAM->lastLine = $<sNumber>2;
/* protection against nested function/procedure inside extended block */
if( HB_COMP_PARAM->iErrorCount == 0 ||
HB_COMP_PARAM->functions.pLast->funFlags & HB_FUNF_EXTBLOCK )
{
hb_compCodeBlockEnd( HB_COMP_PARAM );
$$ = hb_compExprSetCodeblockBody( $1,
HB_COMP_PARAM->functions.pLast->pCode + $<sNumber>3,
HB_COMP_PARAM->functions.pLast->nPCodePos - $<sNumber>3 );
HB_COMP_PARAM->functions.pLast->nPCodePos = $<sNumber>3;
HB_COMP_PARAM->lastLine = $<sNumber>2;
}
}
;

File diff suppressed because it is too large Load Diff

View File

@@ -895,7 +895,7 @@ const char * hb_compStaticVariableName( HB_COMP_DECL, HB_USHORT wVar )
return pVar ? pVar->szName : NULL;
}
int hb_compVariableScope( HB_COMP_DECL, const char * szVarName )
static int hb_compVariableScope( HB_COMP_DECL, const char * szVarName )
{
int iScope;

File diff suppressed because it is too large Load Diff

View File

@@ -91,7 +91,7 @@ extern int hb_macro_yydebug;
typedef union YYSTYPE YYSTYPE;
union YYSTYPE
{
#line 142 "macro.y" /* yacc.c:1909 */
#line 140 "macro.y" /* yacc.c:1909 */
const char * string; /* to hold a string returned by lex */
int iNumber; /* to hold a temporary integer number */