Preprocessor macros

Gregg Mattinson gm138242 at scot.canada.sun.com
Tue Jul 2 14:56:33 CDT 2002


Changelog: dlls/ntdll/signal_sparc.c include/basetsd.h
           dlls/x11drv/wineclipsrv.c include/winnt.h
           include/wine/debug.h include/wine/obj_base.h
           include/wine/port.h msdos/int2f.c
           programs/uninstaller/main.c server/context_sparc.c
 - Forte C defines __sparc instead of __sparc__, __sun instead of __sun__, and 
__func__ instead of __FUNCTION__
 - 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
 - Forte C has riid's in vtables, so ICOM_MSVTABLE_COMPAT must be defined
 - Fixed DEBUG macro in uninstaller to support Forte C
 
Gregg Mattinson
Co-op Developer
Sun Microsystems of Canada

-------------- next part --------------
Index: dlls/ntdll/signal_sparc.c
===================================================================
RCS file: /opcom/comp/ws/wine/CVSROOT/wine/dlls/ntdll/signal_sparc.c,v
retrieving revision 1.1
diff -u -r1.1 signal_sparc.c
--- /tmp/T0TvaOyF	Tue Jul  2 13:51:13 2002
+++ signal_sparc.c	Tue Jun 25 09:53:19 2002
@@ -18,7 +18,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef __sparc__
+#if defined(__sparc__) || defined(__sparc)
 
 #include "config.h"
 
Index: include/basetsd.h
===================================================================
RCS file: /opcom/comp/ws/wine/CVSROOT/wine/include/basetsd.h,v
retrieving revision 1.1
diff -u -r1.1 basetsd.h
--- /tmp/T0J_aiGF	Tue Jul  2 13:52:54 2002
+++ basetsd.h	Tue Jun 25 07:50:43 2002
@@ -158,6 +158,18 @@
 
 /* Architecture dependent settings. */
 /* These are hardcoded to avoid dependencies on config.h in Winelib apps. */
+#ifdef __sparc
+#ifndef __sparc__
+#define __sparc__
+#endif
+#endif
+
+#ifdef __sun
+#ifndef __sun__
+#define __sun__
+#endif
+#endif
+
 #if defined(__i386__)
 # undef  WORDS_BIGENDIAN
 # undef  BITFIELDS_BIGENDIAN
Index: dlls/x11drv/wineclipsrv.c
===================================================================
RCS file: /opcom/comp/ws/wine/CVSROOT/wine/dlls/x11drv/wineclipsrv.c,v
retrieving revision 1.1
diff -u -r1.1 wineclipsrv.c
--- /tmp/T0nraaFF	Tue Jul  2 13:52:35 2002
+++ wineclipsrv.c	Tue Jun 25 07:46:25 2002
@@ -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];
Index: include/winnt.h
===================================================================
RCS file: /opcom/comp/ws/wine/CVSROOT/wine/include/winnt.h,v
retrieving revision 1.1
diff -u -r1.1 winnt.h
--- /tmp/T0SoaOKF	Tue Jul  2 13:53:16 2002
+++ winnt.h	Thu Jun 27 15:03:03 2002
@@ -152,11 +154,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 +1139,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 +1224,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__ */
 
Index: include/wine/debug.h
===================================================================
RCS file: /opcom/comp/ws/wine/CVSROOT/wine/include/wine/debug.h,v
retrieving revision 1.1
diff -u -r1.1 debug.h
--- /tmp/T0SRaWLF	Tue Jul  2 13:53:22 2002
+++ debug.h	Wed Jun 26 14:17:21 2002
@@ -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 */
 
 
 /*
Index: include/wine/obj_base.h
===================================================================
RCS file: /opcom/comp/ws/wine/CVSROOT/wine/include/wine/obj_base.h,v
retrieving revision 1.1
diff -u -r1.1 obj_base.h
--- /tmp/T0lcaiMF	Tue Jul  2 13:53:23 2002
+++ obj_base.h	Fri Jun 28 11:37:20 2002
@@ -572,6 +572,10 @@
 #define ICOM_VFIELD(iface)       ICOM_VTABLE(iface)* lpVtbl
 #define ICOM_VTBL(iface)         (iface)->lpVtbl
 
+#if defined(__SUNPRO_CC) || defined(__SUNPRO_C)
+#define ICOM_MSVTABLE_COMPAT
+#endif
+
 #ifdef ICOM_MSVTABLE_COMPAT
 #define ICOM_DEFINE(iface,ibase) \
     typedef struct ICOM_VTABLE(iface) ICOM_VTABLE(iface); \
Index: include/wine/port.h
===================================================================
RCS file: /opcom/comp/ws/wine/CVSROOT/wine/include/wine/port.h,v
retrieving revision 1.2
diff -u -r1.2 port.h
--- /tmp/T0Asa4MF	Tue Jul  2 13:53:28 2002
+++ port.h	Tue Jun 25 15:23:14 2002
@@ -141,7 +141,11 @@
 #ifdef NEED_TYPE_IN_DEF
 # define __ASM_FUNC(name) ".def " __ASM_NAME(name) "; .scl 2; .type 32; .endef"
 #else
+#ifndef __SUNPRO_C
 # define __ASM_FUNC(name) ".type " __ASM_NAME(name) ", at function"
+#else
+# define __ASM_FUNC(name) ".type " __ASM_NAME(name) ",2"
+#endif
 #endif
 
 #ifdef __GNUC__
Index: msdos/int2f.c
===================================================================
RCS file: /opcom/comp/ws/wine/CVSROOT/wine/msdos/int2f.c,v
retrieving revision 1.1
diff -u -r1.1 int2f.c
--- /tmp/T0nsayRF	Tue Jul  2 13:53:45 2002
+++ int2f.c	Mon Jun 24 15:26:05 2002
@@ -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))
Index: programs/uninstaller/main.c
===================================================================
RCS file: /opcom/comp/ws/wine/CVSROOT/wine/programs/uninstaller/main.c,v
retrieving revision 1.1
diff -u -r1.1 main.c
--- /tmp/T0hMa4mG       Tue Jul  2 14:51:40 2002
+++ main.c      Tue Jul  2 14:50:08 2002
@@ -39,10 +39,18 @@
 
 #undef DUMB_DEBUG
 #ifdef DUMB_DEBUG
-#include <stdio.h>
-#define DEBUG(x...) fprintf(stderr,x)
+# include <stdio.h>
+# ifdef __SUNPRO_C
+#  define DEBUG(x,...) fprintf(stderr,x,__VA_ARGS__)
+# else
+#  define DEBUG(x...) fprintf(stderr,x)
+# endif
 #else
-#define DEBUG(x...)
+# ifdef __SUNPRO_C
+#  define DEBUG(x,...)
+# else
+#  define DEBUG(x...)
+# endif
 #endif
 
 /* use multi-select listbox */
Index: server/context_sparc.c
===================================================================
RCS file: /opcom/comp/ws/wine/CVSROOT/wine/server/context_sparc.c,v
retrieving revision 1.1
diff -u -r1.1 context_sparc.c
--- /tmp/T0CyaO2F	Tue Jul  2 13:54:30 2002
+++ context_sparc.c	Mon Jun 24 15:42:00 2002
@@ -20,7 +20,7 @@
 
 #include "config.h"
 
-#ifdef __sparc__
+#ifdef __sparc
 
 #include <assert.h>
 #include <errno.h>


More information about the wine-patches mailing list