diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 535c6e5025..41fee1e98e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,17 +1,13 @@ -19990618-04:35 PST Ron Pinkas - * hberrors.h - +added define WARN_ASSIGN_TYPE and WARN_ASSIGN_SUSPECTED - - * compiler.h - +added struct STACK_VAL_TYPE *PSTAC_VAL_TYPE - - * harbour.l - +added support for tokens AS NUMERIC, AS CHARACTER, AS LOGICAL, AS DATE, AS ARRAY, AS OBJECT - *modified iLine to initialize to 0 rather than 1 - - * harbour.y - +added support for extended variable declaration with strong typing - +added logic to support warnings on incompatible and suspecious variable assignments +19990618-17:00 CET Victor Szel + * Fixed some GCC warnings in: + source/compiler/harbour.y + * Some left _parc()/_parni()/_parnl() prefixed with hb_ + source/rtl/dir.c + source/rtl/files.c + * Fixed PADR(), PADL(), PADC() when called with a width + less than the length of the string. + Submitted by Matthew Hamilton + source/rtl/strings.c 19990618-13:40 Alexander Kresin updated: diff --git a/harbour/builddos.bat b/harbour/builddos.bat index de893561da..6575100a61 100644 --- a/harbour/builddos.bat +++ b/harbour/builddos.bat @@ -1,4 +1,5 @@ rem build for djgpp for dos enviroment -make -fmakefile.dos %1 %2 %3 %4 %5 %6 %7 %8 %9 >a.a +make -fmakefile.dos %1 %2 %3 %4 %5 %6 %7 %8 %9 +rem >a.a diff --git a/harbour/source/compiler/harbour.y b/harbour/source/compiler/harbour.y index d15eecd783..44acea4fc4 100644 --- a/harbour/source/compiler/harbour.y +++ b/harbour/source/compiler/harbour.y @@ -2627,7 +2627,9 @@ PFUNCTION KillFunction( PFUNCTION pFunc ) OurFree( pVar->szName ); if( pVar->szAlias ) + { OurFree( pVar->szAlias ); + } OurFree( pVar ); } @@ -3099,15 +3101,23 @@ void PopId( char * szVarName ) /* generates the pcode to pop a value from the vi pFree = pStackValType; if( pVarType && pStackValType && pVarType->cType != ' ' && pStackValType->cType == ' ' ) + { GenWarning( WARN_ASSIGN_SUSPECTED, szVarName, NULL ); + } else if( pVarType && pStackValType && pVarType->cType != ' ' && pVarType->cType != pStackValType->cType ) + { GenWarning( WARN_ASSIGN_TYPE, szVarName, NULL ); + } if( pVarType ) + { OurFree( pVarType ); + } if( pFree ) + { OurFree( pFree ); + } } } else if( ( wVar = GetStaticVarPos( szVarName ) ) ) @@ -3124,15 +3134,23 @@ void PopId( char * szVarName ) /* generates the pcode to pop a value from the vi pFree = pStackValType; if( pVarType && pStackValType && pVarType->cType != ' ' && pStackValType->cType == ' ' ) + { GenWarning( WARN_ASSIGN_SUSPECTED, szVarName, NULL ); + } else if( pVarType && pStackValType && pVarType->cType != ' ' && pVarType->cType != pStackValType->cType ) + { GenWarning( WARN_ASSIGN_TYPE, szVarName, NULL ); + } if( pVarType ) + { OurFree( pVarType ); + } if( pFree ) + { OurFree( pFree ); + } } } else diff --git a/harbour/source/rtl/dir.c b/harbour/source/rtl/dir.c index 9c613dd2f2..1761511d78 100644 --- a/harbour/source/rtl/dir.c +++ b/harbour/source/rtl/dir.c @@ -143,7 +143,7 @@ HARBOUR HB_DIRECTORY( void ) if( arg1_it ) { - strcpy(string, _parc(1)); + strcpy(string, hb_parc(1)); pos = strrchr(string,OS_PATH_DELIMITER); if( pos ) { diff --git a/harbour/source/rtl/files.c b/harbour/source/rtl/files.c index ba74cf85a5..39e3e7a1dd 100644 --- a/harbour/source/rtl/files.c +++ b/harbour/source/rtl/files.c @@ -513,7 +513,7 @@ HARBOUR HB_FOPEN( void ) else open_flags = 0; - file_handle = hb_fsOpen( (BYTEP)_parc(1), open_flags ); + file_handle = hb_fsOpen( (BYTEP)hb_parc(1), open_flags ); } hb_retni(file_handle); @@ -535,7 +535,7 @@ HARBOUR HB_FCREATE( void ) else create_flags = 0; - file_handle = hb_fsCreate( (BYTEP)_parc(1), create_flags ); + file_handle = hb_fsCreate( (BYTEP)hb_parc(1), create_flags ); } hb_retni(file_handle); @@ -552,7 +552,7 @@ HARBOUR HB_FREAD( void ) if( arg1_it && arg2_it && arg3_it ) { - bytes = hb_fsRead(_parni(1), (BYTEP)_parc(2), _parnl(3) ); + bytes = hb_fsRead(hb_parni(1), (BYTEP)hb_parc(2), hb_parnl(3) ); } hb_retnl(bytes); @@ -569,8 +569,8 @@ HARBOUR HB_FWRITE( void ) if( arg1_it && arg2_it ) { - bytes = (arg3_it ? _parnl(3) : arg2_it->wLength ); - bytes = hb_fsWrite( _parni(1), (BYTEP)_parc(2), bytes); + bytes = (arg3_it ? hb_parnl(3) : arg2_it->wLength ); + bytes = hb_fsWrite( hb_parni(1), (BYTEP)hb_parc(2), bytes); } hb_retnl(bytes); @@ -602,7 +602,7 @@ HARBOUR HB_FERASE( void ) if( arg1_it ) { - hb_fsDelete( (BYTEP)_parc(1) ); + hb_fsDelete( (BYTEP)hb_parc(1) ); } hb_retni(last_error=0); @@ -616,7 +616,7 @@ HARBOUR HB_FRENAME( void ) if( arg1_it && arg2_it ) { - hb_fsRename( (BYTEP)_parc(1), (BYTEP)_parc(2) ); + hb_fsRename( (BYTEP)hb_parc(1), (BYTEP)hb_parc(2) ); } hb_retni(last_error); diff --git a/harbour/source/rtl/strings.c b/harbour/source/rtl/strings.c index 183557ef88..11b09386a7 100644 --- a/harbour/source/rtl/strings.c +++ b/harbour/source/rtl/strings.c @@ -265,7 +265,12 @@ HARBOUR HB_PADR( void ) hb_xfree(szResult); } else - hb_retclen(szText, (long)hb_parclen(1) ); + { + if( lLen < 0 ) + lLen = 0; + + hb_retclen(szText, lLen); + } } else hb_retc(""); @@ -306,7 +311,12 @@ HARBOUR HB_PADL( void ) hb_xfree(szResult); } else - hb_retclen(szText, (long)hb_parclen(1) ); + { + if( lLen < 0 ) + lLen = 0; + + hb_retclen(szText, lLen); + } } else hb_retc(""); @@ -344,7 +354,12 @@ HARBOUR HB_PADC( void ) hb_xfree(szResult); } else - hb_retclen(szText, (long)hb_parclen(1) ); + { + if( lLen < 0 ) + lLen = 0; + + hb_retclen(szText, lLen); + } } else hb_retc("");