From 81cbb28d07ed21f2151500c73ffee451b427e037 Mon Sep 17 00:00:00 2001 From: Gregg Mattinson Date: Fri, 5 Jul 2002 21:22:09 +0000 Subject: [PATCH] - Forte C does not support nameless structures or unions - Implemented __builtin_return_address for Forte C on sparc - Implemented DECL_GLOBAL_CONSTRUCTOR for non-386, non-GNU C - Implemented WINE_DPRINTF to have function name with Forte C --- dlls/x11drv/wineclipsrv.c | 4 ++++ include/wine/debug.h | 17 +++++++++++++++-- include/winnt.h | 28 +++++++++++++++++++++++++--- msdos/int2f.c | 2 +- 4 files changed, 45 insertions(+), 6 deletions(-) diff --git a/dlls/x11drv/wineclipsrv.c b/dlls/x11drv/wineclipsrv.c index ed77dae233c..ac70e48ac10 100644 --- a/dlls/x11drv/wineclipsrv.c +++ b/dlls/x11drv/wineclipsrv.c @@ -77,6 +77,10 @@ /* Internal definitions (do not use these directly) */ +#ifdef __SUNPRO_C +#define __FUNCTION__ __func__ +#endif + enum __DEBUG_CLASS { __DBCL_FIXME, __DBCL_ERR, __DBCL_WARN, __DBCL_TRACE, __DBCL_COUNT }; extern char __debug_msg_enabled[__DBCL_COUNT]; diff --git a/include/wine/debug.h b/include/wine/debug.h index 6ffa0fbede6..5abf6b4ed84 100644 --- a/include/wine/debug.h +++ b/include/wine/debug.h @@ -76,7 +76,20 @@ enum __WINE_DEBUG_CLASS { #define __WINE_PRINTF_ATTR(fmt,args) __attribute__((format (printf,fmt,args))) -#else /* __GNUC__ */ +#elif defined(__SUNPRO_C) + +#define __WINE_DPRINTF(dbcl,dbch) \ + do { if(__WINE_GET_DEBUGGING(dbcl,(dbch))) { \ + const char * const __dbch = (dbch); \ + const enum __WINE_DEBUG_CLASS __dbcl = __WINE_DBCL##dbcl; \ + __WINE_DBG_LOG + +#define __WINE_DBG_LOG(...) \ + wine_dbg_log( __dbcl, __dbch, __func__, __VA_ARGS__); } } while(0) + +#define __WINE_PRINTF_ATTR(fmt,args) + +#else /* !__GNUC__ && !__SUNPRO_C */ #define __WINE_DPRINTF(dbcl,dbch) \ (!__WINE_GET_DEBUGGING(dbcl,(dbch)) || \ @@ -85,7 +98,7 @@ enum __WINE_DEBUG_CLASS { #define __WINE_PRINTF_ATTR(fmt, args) -#endif /* __GNUC__ */ +#endif /* !__GNUC__ && !__SUNPRO_C */ /* diff --git a/include/winnt.h b/include/winnt.h index a3fa086b6a7..fd4b48629f5 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -152,11 +152,11 @@ # define NONAMELESSUNION #else /* Anonymous struct support starts with gcc/g++ 2.96 */ -# if !defined(NONAMELESSSTRUCT) && defined(__GNUC__) && ((__GNUC__ < 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ < 96))) +# if !defined(NONAMELESSSTRUCT) && (defined(__GNUC__) && ((__GNUC__ < 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ < 96)))) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) # define NONAMELESSSTRUCT # endif /* Anonymous unions support starts with gcc 2.96/g++ 2.95 */ -# if !defined(NONAMELESSUNION) && defined(__GNUC__) && ((__GNUC__ < 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ < 95) || ((__GNUC_MINOR__ == 95) && !defined(__cplusplus))))) +# if !defined(NONAMELESSUNION) && (defined(__GNUC__) && ((__GNUC__ < 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ < 95) || ((__GNUC_MINOR__ == 95) && !defined(__cplusplus)))))) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) # define NONAMELESSUNION # endif #endif @@ -1137,6 +1137,18 @@ typedef CONTEXT *PCONTEXT; #endif /* __i386__ */ #ifdef __sparc__ + +#ifdef __SUNPRO_C +static DWORD __builtin_return_address(int p_iDepth) +{ + asm("ta 3"); + asm("mov %fp, %l0"); + while (p_iDepth--) + asm("ld [%l0+56], %l0"); + asm("ld [%l0+60], %i0"); +} +#endif + /* FIXME: use getcontext() to retrieve full context */ #define _GET_CONTEXT \ CONTEXT context; \ @@ -1210,7 +1222,17 @@ typedef CONTEXT *PCONTEXT; ".previous"); } \ static void func(void) # else /* __i386__ */ -# error You must define the DECL_GLOBAL_CONSTRUCTOR macro for your platform +# ifdef __sparc__ +# define DECL_GLOBAL_CONSTRUCTOR(func) \ + static void __dummy_init_##func(void) { \ + asm("\t.section \".init\",#alloc,#execinstr\n" \ + "\tcall " #func "\n" \ + "\tnop\n" \ + "\t.section \".text\",#alloc,#execinstr\n" ); } \ + static void func(void) +# else +# error You must define the DECL_GLOBAL_CONSTRUCTOR macro for your platform +# endif # endif #endif /* __GNUC__ */ diff --git a/msdos/int2f.c b/msdos/int2f.c index 76d8fbe27c0..ed1be28d3ae 100644 --- a/msdos/int2f.c +++ b/msdos/int2f.c @@ -215,7 +215,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context ) } break; case 0xb7: /* append */ - LOBYTE(context->Eax) = 0; /* not installed */ + AL_reg(context) = 0; /* not installed */ break; case 0xb8: /* network */ switch (LOBYTE(context->Eax))