From dbcd987a991c4fd3c3375b46a3762ecbf4525989 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Mon, 24 May 2010 09:39:17 +0000 Subject: [PATCH] 2010-05-24 11:38 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbapi.h * harbour/include/hbvmint.h * harbour/include/hbvmopt.h * harbour/include/hbstack.h * harbour/include/hbvmpub.h * harbour/include/hbtypes.h * harbour/src/vm/estack.c * harbour/src/vm/hvmall.c * slightly modified the names of HB_{API|STACK}_MACROS. These are internal macros in current Harbour code but they are still defined in some old user build scripts used to compiled user or core code what could cause unpredictable results for final binaries. AFAIR default xMate configuration enables them. --- harbour/ChangeLog | 15 +++++++++++++++ harbour/include/hbapi.h | 8 ++++---- harbour/include/hbstack.h | 16 ++++++++-------- harbour/include/hbtypes.h | 2 +- harbour/include/hbvmint.h | 4 ++-- harbour/include/hbvmopt.h | 8 ++++---- harbour/include/hbvmpub.h | 4 ++-- harbour/src/vm/estack.c | 12 ++++++------ harbour/src/vm/hvmall.c | 4 ++-- 9 files changed, 44 insertions(+), 29 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ca6d15f350..4bb501848a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,21 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-05-24 11:38 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbapi.h + * harbour/include/hbvmint.h + * harbour/include/hbvmopt.h + * harbour/include/hbstack.h + * harbour/include/hbvmpub.h + * harbour/include/hbtypes.h + * harbour/src/vm/estack.c + * harbour/src/vm/hvmall.c + * slightly modified the names of HB_{API|STACK}_MACROS. + These are internal macros in current Harbour code but they are + still defined in some old user build scripts used to compiled + user or core code what could cause unpredictable results for + final binaries. AFAIR default xMate configuration enables them. + 2010-05-24 11:02 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * utils/hbmk2/hbmk2.prg ! Fixed non-initialized variable (broken in after one of diff --git a/harbour/include/hbapi.h b/harbour/include/hbapi.h index c8380061a2..7ffc4c8d59 100644 --- a/harbour/include/hbapi.h +++ b/harbour/include/hbapi.h @@ -699,7 +699,7 @@ extern HB_EXPORT void hb_retnlllen( HB_LONGLONG lNumber, int iWidth ); /* retu #define HB_IS_VALID_INDEX( idx, max ) ( (idx) > 0 && ( HB_ULONG ) (idx) <= (max) ) -#ifdef HB_API_MACROS +#ifdef _HB_API_MACROS_ #define hb_pcount() ( ( int ) ( hb_stackBaseItem() )->item.asSymbol.paramcnt ) @@ -731,7 +731,7 @@ extern HB_EXPORT void hb_retnlllen( HB_LONGLONG lNumber, int iWidth ); /* retu #define hb_retptr( pointer ) hb_itemPutPtr( hb_stackReturnItem(), pointer ) #define hb_retptrGC( pointer ) hb_itemPutPtrGC( hb_stackReturnItem(), pointer ) -#endif /* HB_API_MACROS */ +#endif /* _HB_API_MACROS_ */ extern HB_EXPORT int hb_stor( int iParam ); /* stores a NIL on a variable by reference */ @@ -1047,9 +1047,9 @@ extern void hb_memvarRestoreFromArray( PHB_ITEM pArray ); extern void hb_memvarValueIncRef( PHB_ITEM pValue ); /* increase the reference count of a global value */ extern void hb_memvarValueDecRef( PHB_ITEM pValue ); /* decrease the reference count of a global value */ extern PHB_ITEM hb_memvarGetItem( PHB_SYMB pMemvarSymb ); -#if defined( HB_API_MACROS ) +#if defined( _HB_API_MACROS_ ) # define hb_memvarValueIncRef( p ) hb_xRefInc( p ) -#endif /* HB_API_MACROS */ +#endif /* _HB_API_MACROS_ */ #endif /* _HB_API_INTERNAL_ */ /* console I/O subsystem */ diff --git a/harbour/include/hbstack.h b/harbour/include/hbstack.h index bd14b01408..a560a4c3f7 100644 --- a/harbour/include/hbstack.h +++ b/harbour/include/hbstack.h @@ -188,10 +188,10 @@ typedef struct #endif } HB_STACK, * PHB_STACK; -#if defined( HB_STACK_MACROS ) +#if defined( _HB_STACK_MACROS_ ) # if defined( HB_MT_VM ) # if defined( HB_USE_TLS ) -# if !defined( HB_STACK_LOCAL_MACROS ) +# if !defined( _HB_STACK_LOCAL_MACROS_ ) # if defined( __BORLANDC__ ) extern PHB_STACK HB_TLS_ATTR hb_stack_ptr; # else @@ -199,13 +199,13 @@ typedef struct # endif # endif # else -# if !defined( HB_STACK_LOCAL_MACROS ) +# if !defined( _HB_STACK_LOCAL_MACROS_ ) extern HB_TLS_KEY hb_stack_key; # endif # if defined( __BORLANDC__ ) && defined( HB_STACK_PRELOAD ) && \ !defined( HB_OS_WIN_64 ) && !defined( HB_OS_WIN_CE ) && \ defined( HB_ASM_TLS ) -# if defined( HB_STACK_LOCAL_MACROS ) +# if defined( _HB_STACK_LOCAL_MACROS_ ) static HB_TLS_KEY hb_stack_key; # endif static __inline void * hb_stack_ptr_from_tls( void ) @@ -222,7 +222,7 @@ typedef struct # define hb_stack_ptr_get() hb_stack_ptr_from_tls() # elif defined( __MINGW32__ ) && defined( HB_ASM_TLS ) && \ !defined( HB_OS_WIN_64 ) && !defined( HB_OS_WIN_CE ) -# if defined( HB_STACK_LOCAL_MACROS ) +# if defined( _HB_STACK_LOCAL_MACROS_ ) static HB_TLS_KEY hb_stack_key; # endif static __inline__ __attribute__ ((pure, malloc)) void * hb_stack_ptr_from_tls( void ) @@ -257,7 +257,7 @@ typedef struct # define hb_stack_ref() ( hb_stack_ptr ) # endif # else -# if !defined( HB_STACK_LOCAL_MACROS ) +# if !defined( _HB_STACK_LOCAL_MACROS_ ) extern HB_STACK hb_stack; # endif # define hb_stack_ref() ( &hb_stack ) @@ -267,7 +267,7 @@ typedef struct # if defined( HB_STACK_PRELOAD ) # define HB_STACK_TLS_PRELOAD # undef HB_STACK_PRELOAD -# elif defined( HB_STACK_MACROS ) +# elif defined( _HB_STACK_MACROS_ ) # define HB_STACK_TLS_PRELOAD # endif #endif @@ -376,7 +376,7 @@ extern void hb_stackUpdateAllocator( void *, PHB_ALLOCUPDT_FUNC, int ); #endif -#if defined( HB_STACK_MACROS ) +#if defined( _HB_STACK_MACROS_ ) #define hb_stackItemFromTop( n ) ( * ( hb_stack.pPos + ( int ) ( n ) ) ) #define hb_stackItemFromBase( n ) ( * ( hb_stack.pBase + ( int ) ( n ) + 1 ) ) diff --git a/harbour/include/hbtypes.h b/harbour/include/hbtypes.h index 5dd559dcf4..39e6159ee5 100644 --- a/harbour/include/hbtypes.h +++ b/harbour/include/hbtypes.h @@ -53,7 +53,7 @@ #ifndef HB_TYPES_H_ #define HB_TYPES_H_ -#undef HB_API_MACROS +#undef _HB_API_MACROS_ #include "hbapi.h" diff --git a/harbour/include/hbvmint.h b/harbour/include/hbvmint.h index bc7df447a4..03795616e1 100644 --- a/harbour/include/hbvmint.h +++ b/harbour/include/hbvmint.h @@ -59,8 +59,8 @@ * which interacts with alignment are used. [druzus] */ -#undef HB_API_MACROS -#undef HB_STACK_MACROS +#undef _HB_API_MACROS_ +#undef _HB_STACK_MACROS_ #if !defined( _HB_API_INTERNAL_ ) # define _HB_API_INTERNAL_ diff --git a/harbour/include/hbvmopt.h b/harbour/include/hbvmopt.h index 38a136c533..c1874f749d 100644 --- a/harbour/include/hbvmopt.h +++ b/harbour/include/hbvmopt.h @@ -58,12 +58,12 @@ * it was compiled and only if exactly the same C compiler switches * which interacts with alignment are used. [druzus] */ -#if !defined( HB_NO_DEFAULT_API_MACROS ) && !defined( HB_API_MACROS ) -# define HB_API_MACROS +#if !defined( HB_NO_DEFAULT_API_MACROS ) && !defined( _HB_API_MACROS_ ) +# define _HB_API_MACROS_ #endif -#if !defined( HB_NO_DEFAULT_STACK_MACROS ) && !defined( HB_STACK_MACROS ) -# define HB_STACK_MACROS +#if !defined( HB_NO_DEFAULT_STACK_MACROS ) && !defined( _HB_STACK_MACROS_ ) +# define _HB_STACK_MACROS_ #endif #if !defined( _HB_API_INTERNAL_ ) diff --git a/harbour/include/hbvmpub.h b/harbour/include/hbvmpub.h index 097a7c9b83..a19e34c10b 100644 --- a/harbour/include/hbvmpub.h +++ b/harbour/include/hbvmpub.h @@ -157,8 +157,8 @@ struct _HB_SYMB; #else /* !_HB_API_INTERNAL_ */ -# undef HB_API_MACROS -# undef HB_STACK_MACROS +# undef _HB_API_MACROS_ +# undef _HB_STACK_MACROS_ /* This is ugly trick but works without speed overhead */ # define HB_ITEM_TYPERAW( p ) ( * ( HB_TYPE * ) ( p ) ) diff --git a/harbour/src/vm/estack.c b/harbour/src/vm/estack.c index f3dd14f6c5..ce290b6405 100644 --- a/harbour/src/vm/estack.c +++ b/harbour/src/vm/estack.c @@ -87,13 +87,13 @@ # ifdef HB_USE_TLS /* compiler has native support for TLS */ -# if !defined( HB_STACK_MACROS ) +# if !defined( _HB_STACK_MACROS_ ) # if defined( __BORLANDC__ ) static PHB_STACK HB_TLS_ATTR hb_stack_ptr; # else static HB_TLS_ATTR PHB_STACK hb_stack_ptr; # endif -# elif !defined( HB_STACK_LOCAL_MACROS ) +# elif !defined( _HB_STACK_LOCAL_MACROS_ ) # if defined( __BORLANDC__ ) PHB_STACK HB_TLS_ATTR hb_stack_ptr = NULL; # else @@ -110,10 +110,10 @@ # else /* compiler has no native TLS support, we have to implement it ourselves */ -# if !defined( HB_STACK_MACROS ) +# if !defined( _HB_STACK_MACROS_ ) static HB_TLS_KEY hb_stack_key; # define hb_stack_ptr ( ( PHB_STACK ) hb_tls_get( hb_stack_key ) ) -# elif !defined( HB_STACK_LOCAL_MACROS ) +# elif !defined( _HB_STACK_LOCAL_MACROS_ ) HB_TLS_KEY hb_stack_key; # endif static volatile HB_BOOL s_fInited = HB_FALSE; @@ -138,9 +138,9 @@ #else /* no MT mode */ -# if !defined( HB_STACK_MACROS ) +# if !defined( _HB_STACK_MACROS_ ) static HB_STACK hb_stack; -# elif !defined( HB_STACK_LOCAL_MACROS ) +# elif !defined( _HB_STACK_LOCAL_MACROS_ ) HB_STACK hb_stack; # endif diff --git a/harbour/src/vm/hvmall.c b/harbour/src/vm/hvmall.c index 0f5abe96b7..010f175c34 100644 --- a/harbour/src/vm/hvmall.c +++ b/harbour/src/vm/hvmall.c @@ -58,7 +58,7 @@ #define HB_NO_FLATTEN -#define HB_STACK_LOCAL_MACROS +#define _HB_STACK_LOCAL_MACROS_ #define HB_STACK_PRELOAD #define INCL_BASE @@ -84,7 +84,7 @@ #include "hbstack.h" -#if defined( HB_STACK_MACROS ) && defined( HB_STACK_LOCAL_MACROS ) +#if defined( _HB_STACK_MACROS_ ) && defined( _HB_STACK_LOCAL_MACROS_ ) # if defined( HB_MT_VM ) # if defined( HB_USE_TLS ) # if defined( __BORLANDC__ )