- 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

diff --git a/dlls/x11drv/wineclipsrv.c b/dlls/x11drv/wineclipsrv.c
index ed77dae..ac70e48 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 6ffa0fb..5abf6b4 100644
--- a/include/wine/debug.h
+++ b/include/wine/debug.h
@@ -76,7 +76,20 @@
 
 #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 @@
 
 #define __WINE_PRINTF_ATTR(fmt, args)
 
-#endif  /* __GNUC__ */
+#endif  /* !__GNUC__ && !__SUNPRO_C */
 
 
 /*
diff --git a/include/winnt.h b/include/winnt.h
index a3fa086..fd4b486 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 @@
 #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 @@
             ".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 76d8fbe..ed1be28 100644
--- a/msdos/int2f.c
+++ b/msdos/int2f.c
@@ -215,7 +215,7 @@
         }
         break;
     case 0xb7:  /* append */
-        LOBYTE(context->Eax) = 0; /* not installed */
+        AL_reg(context) = 0; /* not installed */
         break;
     case 0xb8:  /* network */
         switch (LOBYTE(context->Eax))