20000501-14:15 GMT-8 Ron Pinkas <Ron@Profit-Master.com>
* source/compiler/harbour.c
* Minor correction to hb_compVariableAdd().
* source/compiler/hbpcode.c
* Enhancements to hb_compStrongType() to support new PUSH/POPALIASEDFIELDNEAR.
* tests/testwarn.prg
+ Added code to demonstrate more warnings.
This commit is contained in:
@@ -1,3 +1,14 @@
|
||||
20000501-14:15 GMT-8 Ron Pinkas <Ron@Profit-Master.com>
|
||||
|
||||
* source/compiler/harbour.c
|
||||
* Minor correction to hb_compVariableAdd().
|
||||
|
||||
* source/compiler/hbpcode.c
|
||||
* Enhancements to hb_compStrongType() to support new PUSH/POPALIASEDFIELDNEAR.
|
||||
|
||||
* tests/testwarn.prg
|
||||
+ Added code to demonstrate more warnings.
|
||||
|
||||
20000501-19:05 GMT+1 Ryszard Glab <rglab@imid.med.pl>
|
||||
|
||||
*source/vm/hvm.c
|
||||
@@ -7,7 +18,7 @@
|
||||
|
||||
*source/rtl/filesys.c
|
||||
* added support for hb_fsCommit() in Unix-like OS
|
||||
|
||||
|
||||
*source/compiler/harbour.c
|
||||
* fixed signed/unsigned warnings
|
||||
|
||||
@@ -20,7 +31,7 @@
|
||||
* source/compiler/harbour.c
|
||||
* source/vm/hvm.c
|
||||
+ Added new pcode: HB_P_PUSHBLOCKSHORT
|
||||
This is used for codeblocks which have no parameters, use no locals,
|
||||
This is used for codeblocks which have no parameters, use no locals,
|
||||
and the total size is smaller than 255 bytes. The majority of codeblocks
|
||||
falls into this category.
|
||||
HB_TEST is now 15K smaller.
|
||||
@@ -60,7 +71,7 @@
|
||||
|
||||
* makefile.bc
|
||||
- Removed duplicated and Borland only default language selection.
|
||||
This feature is already built in to HBSETUP.H, so there's no
|
||||
This feature is already built in to HBSETUP.H, so there's no
|
||||
point to duplicate it. Or I'm missing something obvious.
|
||||
|
||||
20000501-16:08 GMT+1 Victor Szakats <info@szelvesz.hu>
|
||||
@@ -88,16 +99,16 @@
|
||||
passing no arguments to a codeblock
|
||||
* added hb_vmEvalBlockV() for a codeblock evaluation - it is
|
||||
using a variable number of arguments
|
||||
|
||||
|
||||
*source/rdd/dbcmd.c
|
||||
* fixed bug in defEvalBlock
|
||||
* fixed to call hb_vmEvalBlock()
|
||||
* some common parts moved into separate functions
|
||||
|
||||
|
||||
*include/hbcomp.h
|
||||
* changed 'BYTE iJumps' into 'ULONG iJumps' to stop reallocation
|
||||
error mentioned by Victor
|
||||
|
||||
|
||||
20000501-15:37 GMT+1 Victor Szakats <info@szelvesz.hu>
|
||||
|
||||
* source/rtl/teditor.prg
|
||||
@@ -119,7 +130,7 @@
|
||||
+ Developer list updated.
|
||||
|
||||
* source/rtl/Makefile
|
||||
! Fixed back the indentation of the file list from three spaces to
|
||||
! Fixed back the indentation of the file list from three spaces to
|
||||
one tab.
|
||||
+ Added memoedit.prg
|
||||
|
||||
|
||||
@@ -452,22 +452,31 @@ void hb_compVariableAdd( char * szVarName, char cValueType )
|
||||
PVAR pVar, pLastVar;
|
||||
PFUNCTION pFunc = hb_comp_functions.pLast;
|
||||
|
||||
if ( hb_comp_iWarnings > 2 && hb_comp_szDeclaredFun )
|
||||
/* Dummy Var - Parameter Declaration of Declared Function. */
|
||||
if ( hb_comp_szDeclaredFun )
|
||||
{
|
||||
PCOMSYMBOL pSym = hb_compSymbolFind( hb_comp_szDeclaredFun, NULL );
|
||||
|
||||
if ( pSym )
|
||||
{
|
||||
pSym->iParamCount++;
|
||||
|
||||
if ( pSym->cParamTypes )
|
||||
pSym->cParamTypes = ( BYTE * ) hb_xrealloc( pSym->cParamTypes, pSym->iParamCount );
|
||||
else
|
||||
pSym->cParamTypes = ( BYTE * ) hb_xgrab( 1 );
|
||||
|
||||
pSym->cParamTypes[ pSym->iParamCount - 1 ] = hb_comp_cVarType;
|
||||
|
||||
/* Nothing to do since no warnings requested.*/
|
||||
if ( hb_comp_iWarnings < 3 )
|
||||
return;
|
||||
|
||||
{
|
||||
/* Find the Declared Function owner of this parameter. */
|
||||
PCOMSYMBOL pSym = hb_compSymbolFind( hb_comp_szDeclaredFun, NULL );
|
||||
|
||||
if ( pSym )
|
||||
{
|
||||
pSym->iParamCount++;
|
||||
|
||||
if ( pSym->cParamTypes )
|
||||
pSym->cParamTypes = ( BYTE * ) hb_xrealloc( pSym->cParamTypes, pSym->iParamCount );
|
||||
else
|
||||
pSym->cParamTypes = ( BYTE * ) hb_xgrab( 1 );
|
||||
|
||||
/* Store declared type of this parameter into the parameters type list. */
|
||||
pSym->cParamTypes[ pSym->iParamCount - 1 ] = hb_comp_cVarType;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2899,21 +2908,21 @@ void hb_compCodeBlockEnd( void )
|
||||
++wLocals;
|
||||
}
|
||||
|
||||
if( ( pCodeblock->lPCodePos + 3 ) <= 255 &&
|
||||
if( ( pCodeblock->lPCodePos + 3 ) <= 255 &&
|
||||
pCodeblock->wParamCount == 0 &&
|
||||
wLocals == 0 )
|
||||
{
|
||||
/* NOTE: 3 = HB_P_PUSHBLOCKSHORT + BYTE( size ) + _ENDBLOCK */
|
||||
wSize = ( USHORT ) pCodeblock->lPCodePos + 3;
|
||||
|
||||
hb_compGenPCode2( HB_P_PUSHBLOCKSHORT, ( BYTE ) wSize, ( BOOL ) 1 );
|
||||
|
||||
hb_compGenPCode2( HB_P_PUSHBLOCKSHORT, ( BYTE ) wSize, ( BOOL ) 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* NOTE: 8 = HB_P_PUSHBLOCK + USHORT( size ) + USHORT( wParams ) + USHORT( wLocals ) + _ENDBLOCK */
|
||||
wSize = ( USHORT ) pCodeblock->lPCodePos + 8 + wLocals * 2;
|
||||
|
||||
hb_compGenPCode3( HB_P_PUSHBLOCK, HB_LOBYTE( wSize ), HB_HIBYTE( wSize ), ( BOOL ) 1 );
|
||||
|
||||
hb_compGenPCode3( HB_P_PUSHBLOCK, HB_LOBYTE( wSize ), HB_HIBYTE( wSize ), ( BOOL ) 0 );
|
||||
hb_compGenPCode2( HB_LOBYTE( pCodeblock->wParamCount ), HB_HIBYTE( pCodeblock->wParamCount ), ( BOOL ) 0 );
|
||||
hb_compGenPCode2( HB_LOBYTE( wLocals ), HB_HIBYTE( wLocals ), ( BOOL ) 0 );
|
||||
}
|
||||
|
||||
@@ -533,7 +533,12 @@ void hb_compStrongType( int iSize )
|
||||
pFunc->pStack[ pFunc->iStackIndex++ ] = 'O';
|
||||
break;
|
||||
|
||||
/* Blcks */
|
||||
/* Blcoks */
|
||||
/* Nothing to do, handled by HB_P_ENDBLOCK.
|
||||
case HB_P_PUSHBLOCK :
|
||||
case HB_P_PUSHBLOCKSHORT :
|
||||
*/
|
||||
|
||||
case HB_P_ENDBLOCK :
|
||||
/* Override the last value of the block left on the stack. */
|
||||
pFunc->pStack[ pFunc->iStackIndex ] = 'B';
|
||||
@@ -696,18 +701,34 @@ void hb_compStrongType( int iSize )
|
||||
/* Question use type "REFERENCE" or the base type of the var */
|
||||
pFunc->pStack[ pFunc->iStackIndex++ ] = 'R';
|
||||
|
||||
/* MemVars */
|
||||
case HB_P_PUSHALIASEDFIELDNEAR :
|
||||
pSym = hb_compSymbolGetPos( pFunc->pCode[ ulPos + 1 ] );
|
||||
|
||||
case HB_P_PUSHVARIABLE :
|
||||
case HB_P_PUSHMEMVAR :
|
||||
pSym = hb_compSymbolGetPos( pFunc->pCode[ ulPos + 1 ] + pFunc->pCode[ ulPos + 2 ] * 256 );
|
||||
if ( pSym )
|
||||
pFunc->pStack[ pFunc->iStackIndex++ ] = pSym->cType;
|
||||
else
|
||||
pFunc->pStack[ pFunc->iStackIndex++ ] = ' ';
|
||||
|
||||
break;
|
||||
|
||||
case HB_P_PUSHFIELD :
|
||||
case HB_P_PUSHALIASEDFIELD :
|
||||
case HB_P_PUSHALIASEDVAR :
|
||||
case HB_P_PUSHVARIABLE :
|
||||
case HB_P_PUSHMEMVAR :
|
||||
pSym = hb_compSymbolGetPos( pFunc->pCode[ ulPos + 1 ] + pFunc->pCode[ ulPos + 2 ] * 256 );
|
||||
|
||||
if ( pSym )
|
||||
pFunc->pStack[ pFunc->iStackIndex++ ] = pSym->cType;
|
||||
else
|
||||
pFunc->pStack[ pFunc->iStackIndex++ ] = ' ';
|
||||
|
||||
break;
|
||||
|
||||
case HB_P_PUSHMEMVARREF :
|
||||
/* Question use type "REFERENCE" or the base type of the var */
|
||||
pFunc->pStack[ pFunc->iStackIndex++ ] = 'R';
|
||||
break;
|
||||
|
||||
/* Arrays. */
|
||||
|
||||
@@ -782,6 +803,28 @@ void hb_compStrongType( int iSize )
|
||||
pFunc->iStackIndex--;
|
||||
break;
|
||||
|
||||
case HB_P_POPALIASEDFIELDNEAR :
|
||||
pFunc->iStackIndex--;
|
||||
|
||||
if ( pFunc->iStackIndex < 0 )
|
||||
/* TODO Error Message after finalizing all possible pcodes. */
|
||||
break;
|
||||
|
||||
pSym = hb_compSymbolGetPos( pFunc->pCode[ ulPos + 1 ] );
|
||||
|
||||
if ( pSym->cType != ' ' )
|
||||
{
|
||||
char szType[2];
|
||||
sprintf( szType, "%c", pSym->cType );
|
||||
|
||||
if ( pFunc->pStack[ pFunc->iStackIndex ] == ' ' )
|
||||
hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_ASSIGN_SUSPECT, pSym->szName, szType );
|
||||
else if ( pSym->cType != pFunc->pStack[ pFunc->iStackIndex ] )
|
||||
hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_ASSIGN_TYPE, pSym->szName, szType );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case HB_P_POPFIELD :
|
||||
case HB_P_POPALIASEDFIELD :
|
||||
/* TODO: Add support for FIELD declarations. */
|
||||
|
||||
@@ -11,7 +11,21 @@ DECLARE FUNCTION nMyFunc( cVar AS CHARACTER, nVar AS NUMERIC ) AS NUMERIC
|
||||
|
||||
DECLARE FUNCTION cOtherFunc( ) AS CHARACTER
|
||||
|
||||
FUNCTION Main()
|
||||
DECLARE FUNCTION seconds() AS NUMERIC
|
||||
|
||||
DECLARE FUNCTION int( n AS NUMERIC ) AS NUMERIC
|
||||
|
||||
Function Main()
|
||||
Local n As Numeric
|
||||
|
||||
n := 2
|
||||
n := 'a'
|
||||
n := seconds() + 2
|
||||
n := int( seconds() + 2 )
|
||||
|
||||
Return( NIL )
|
||||
|
||||
FUNCTION Main1()
|
||||
|
||||
LOCAL n AS NUMERIC, cVar AS CHARACTER, a[5,5,5] AS ARRAY
|
||||
|
||||
|
||||
Reference in New Issue
Block a user