From 496972d91e30a7abcf20809a1068949e69e6b81f Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Thu, 19 Nov 2009 23:18:42 +0000 Subject: [PATCH] 2009-11-20 00:18 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/rtl/gtcrs/gtcrs.c * pacified warning caused by wrong tigetnum() declarations in some curses versions * harbour/src/rtl/gtsln/gtsln.c ! fixed non ANSI-C variable declarations * harbour/include/hbsetup.h + added macros for PURE and CONST function attributes * harbour/contrib/hbct/ctc.c * modified variable names --- harbour/ChangeLog | 14 ++++++++++++++ harbour/contrib/hbct/ctc.c | 18 ++++++++++-------- harbour/include/hbsetup.h | 14 +++++++++----- harbour/src/rtl/gtcrs/gtcrs.c | 2 +- harbour/src/rtl/gtsln/gtsln.c | 36 +++++++++++++++++++---------------- 5 files changed, 54 insertions(+), 30 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index aea9644a06..f828130821 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,20 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-11-20 00:18 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/src/rtl/gtcrs/gtcrs.c + * pacified warning caused by wrong tigetnum() declarations in some + curses versions + + * harbour/src/rtl/gtsln/gtsln.c + ! fixed non ANSI-C variable declarations + + * harbour/include/hbsetup.h + + added macros for PURE and CONST function attributes + + * harbour/contrib/hbct/ctc.c + * modified variable names + 2009-11-19 19:57 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbqt/detect.mk ! Fix attempt to handle cross-build situations. diff --git a/harbour/contrib/hbct/ctc.c b/harbour/contrib/hbct/ctc.c index 8d02983afe..247b500331 100644 --- a/harbour/contrib/hbct/ctc.c +++ b/harbour/contrib/hbct/ctc.c @@ -59,8 +59,9 @@ /* throwing a CT-subsystem error without value substitution - function adapted from errorapi.c */ -USHORT ct_error( USHORT uiSeverity, HB_ERRCODE ulGenCode, HB_ERRCODE ulSubCode, - const char * szDescription, const char * szOperation, HB_ERRCODE uiOsCode, USHORT uiFlags, ULONG ulArgCount, ... ) +USHORT ct_error( USHORT uiSeverity, HB_ERRCODE errGenCode, HB_ERRCODE errSubCode, + const char * szDescription, const char * szOperation, + HB_ERRCODE errOsCode, USHORT uiFlags, ULONG ulArgCount, ... ) { USHORT uiAction; PHB_ITEM pError; @@ -70,9 +71,9 @@ USHORT ct_error( USHORT uiSeverity, HB_ERRCODE ulGenCode, HB_ERRCODE ulSubCode, ULONG ulArgPos; HB_TRACE( HB_TR_DEBUG, ( "ct_error(%hu, %d, %d, %s, %s, %d, %hu, %lu)", - uiSeverity, ulGenCode, ulSubCode, szDescription, szOperation, uiOsCode, uiFlags, ulArgCount ) ); + uiSeverity, errGenCode, errSubCode, szDescription, szOperation, errOsCode, uiFlags, ulArgCount ) ); - pError = hb_errRT_New( uiSeverity, CT_SUBSYSTEM, ulGenCode, ulSubCode, szDescription, szOperation, uiOsCode, uiFlags ); + pError = hb_errRT_New( uiSeverity, CT_SUBSYSTEM, errGenCode, errSubCode, szDescription, szOperation, errOsCode, uiFlags ); /* Build the array from the passed arguments. */ if( ulArgCount == 0 ) @@ -126,8 +127,9 @@ USHORT ct_error( USHORT uiSeverity, HB_ERRCODE ulGenCode, HB_ERRCODE ulSubCode, /* throwing a CT-subsystem error with value substitution - function adapted from errorapi.c */ -PHB_ITEM ct_error_subst( USHORT uiSeverity, HB_ERRCODE ulGenCode, HB_ERRCODE ulSubCode, - const char * szDescription, const char * szOperation, HB_ERRCODE uiOsCode, USHORT uiFlags, ULONG ulArgCount, ... ) +PHB_ITEM ct_error_subst( USHORT uiSeverity, HB_ERRCODE errGenCode, HB_ERRCODE errSubCode, + const char * szDescription, const char * szOperation, + HB_ERRCODE errOsCode, USHORT uiFlags, ULONG ulArgCount, ... ) { PHB_ITEM pRetVal; PHB_ITEM pError; @@ -137,9 +139,9 @@ PHB_ITEM ct_error_subst( USHORT uiSeverity, HB_ERRCODE ulGenCode, HB_ERRCODE ulS ULONG ulArgPos; HB_TRACE( HB_TR_DEBUG, ( "ct_error_subst(%hu, %d, %d, %s, %s, %d, %hu, %lu)", - uiSeverity, ulGenCode, ulSubCode, szDescription, szOperation, uiOsCode, uiFlags, ulArgCount ) ); + uiSeverity, errGenCode, errSubCode, szDescription, szOperation, errOsCode, uiFlags, ulArgCount ) ); - pError = hb_errRT_New_Subst( uiSeverity, CT_SUBSYSTEM, ulGenCode, ulSubCode, szDescription, szOperation, uiOsCode, uiFlags ); + pError = hb_errRT_New_Subst( uiSeverity, CT_SUBSYSTEM, errGenCode, errSubCode, szDescription, szOperation, errOsCode, uiFlags ); /* Build the array from the passed arguments. */ if( ulArgCount == 0 ) diff --git a/harbour/include/hbsetup.h b/harbour/include/hbsetup.h index 35b45622d7..8977a456af 100644 --- a/harbour/include/hbsetup.h +++ b/harbour/include/hbsetup.h @@ -482,19 +482,20 @@ #define HB_EXTERN_END #endif -#if defined( __GNUC__ ) +#if defined( __GNUC__ ) && ( __GNUC__ - 0 >= 3 ) + #define HB_PRINTF_FORMAT( _nStr, _nParam ) \ __attribute__ (( format (printf, _nStr, _nParam))) -# if ( __GNUC__ >= 3 ) #define HB_MALLOC_ATTR \ __attribute__ (( malloc )) -# else - #define HB_MALLOC_ATTR -# endif #define HB_HOT_ATTR \ __attribute__ (( hot )) #define HB_COLD_ATTR \ __attribute__ (( cold )) + #define HB_PURE_ATTR \ + __attribute__ (( pure )) + #define HB_CONST_ATTR \ + __attribute__ (( const )) # if 0 #define HB_NORETURN_ATTR \ __attribute__ (( noreturn )) @@ -516,12 +517,15 @@ #define HB_ALLOC_SIZE_ATTR( _nParam ) # endif #define HB_RESTRICT __restrict + #else #define HB_PRINTF_FORMAT( _nStr, _nParam ) #define HB_MALLOC_ATTR #define HB_NORETURN_ATTR #define HB_HOT_ATTR #define HB_COLD_ATTR + #define HB_PURE_ATTR + #define HB_CONST_ATTR #define HB_FLATTEN_ATTR #define HB_ALLOC_SIZE_ATTR( _nParam ) #define HB_RESTRICT diff --git a/harbour/src/rtl/gtcrs/gtcrs.c b/harbour/src/rtl/gtcrs/gtcrs.c index 1dc1ce8276..3e883af0ee 100644 --- a/harbour/src/rtl/gtcrs/gtcrs.c +++ b/harbour/src/rtl/gtcrs/gtcrs.c @@ -1241,7 +1241,7 @@ static void mouse_init( InOutBase * ioBase ) memset( ( void * ) &ioBase->mLastEvt, 0, sizeof( ioBase->mLastEvt ) ); ioBase->mLastEvt.click_delay = DBLCLK_DELAY; /* curses mouse buttons check */ - ioBase->mButtons = tigetnum( "btns" ); + ioBase->mButtons = tigetnum( ( char * ) "btns" ); if ( ioBase->mButtons < 1 ) ioBase->mButtons = 3; } diff --git a/harbour/src/rtl/gtsln/gtsln.c b/harbour/src/rtl/gtsln/gtsln.c index ed444b312d..f4cee5c314 100644 --- a/harbour/src/rtl/gtsln/gtsln.c +++ b/harbour/src/rtl/gtsln/gtsln.c @@ -956,17 +956,19 @@ static BOOL hb_gt_sln_SetDispCP( PHB_GT pGT, const char * pszTermCDP, const char HB_GTSUPER_SETDISPCP( pGT, pszTermCDP, pszHostCDP, fBox ); #ifndef HB_CDP_SUPPORT_OFF - PHB_CODEPAGE cdpTerm = NULL, cdpHost = NULL; + { + PHB_CODEPAGE cdpTerm = NULL, cdpHost = NULL; - if ( pszHostCDP ) - cdpHost = hb_cdpFind( pszHostCDP ); - if ( ! cdpHost ) - cdpHost = hb_vmCDP(); + if ( pszHostCDP ) + cdpHost = hb_cdpFind( pszHostCDP ); + if ( ! cdpHost ) + cdpHost = hb_vmCDP(); - if ( pszTermCDP ) - cdpTerm = hb_cdpFind( pszTermCDP ); + if ( pszTermCDP ) + cdpTerm = hb_cdpFind( pszTermCDP ); - hb_sln_setCharTrans( cdpHost, cdpTerm, fBox ); + hb_sln_setCharTrans( cdpHost, cdpTerm, fBox ); + } #endif return TRUE; @@ -979,17 +981,19 @@ static BOOL hb_gt_sln_SetKeyCP( PHB_GT pGT, const char * pszTermCDP, const char HB_GTSUPER_SETKEYCP( pGT, pszTermCDP, pszHostCDP ); #ifndef HB_CDP_SUPPORT_OFF - PHB_CODEPAGE cdpTerm = NULL, cdpHost = NULL; + { + PHB_CODEPAGE cdpTerm = NULL, cdpHost = NULL; - if ( pszHostCDP ) - cdpHost = hb_cdpFind( pszHostCDP ); - if ( ! cdpHost ) - cdpHost = hb_vmCDP(); + if ( pszHostCDP ) + cdpHost = hb_cdpFind( pszHostCDP ); + if ( ! cdpHost ) + cdpHost = hb_vmCDP(); - if ( pszTermCDP ) - cdpTerm = hb_cdpFind( pszTermCDP ); + if ( pszTermCDP ) + cdpTerm = hb_cdpFind( pszTermCDP ); - hb_sln_setKeyTrans( cdpHost, cdpTerm ); + hb_sln_setKeyTrans( cdpHost, cdpTerm ); + } #endif return TRUE;