[ros-diffs] [tkreuzer] 49598: [CRT] Add a number of compilation fixes for MSVC

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Mon Nov 15 20:08:50 UTC 2010


Author: tkreuzer
Date: Mon Nov 15 20:08:49 2010
New Revision: 49598

URL: http://svn.reactos.org/svn/reactos?rev=49598&view=rev
Log:
[CRT]
Add a number of compilation fixes for MSVC

Modified:
    branches/cmake-bringup/lib/sdk/crt/except/cpp.c
    branches/cmake-bringup/lib/sdk/crt/except/cppexcept.c
    branches/cmake-bringup/lib/sdk/crt/float/i386/logb.c
    branches/cmake-bringup/lib/sdk/crt/stdlib/rot.c
    branches/cmake-bringup/lib/sdk/crt/time/ctime.c
    branches/cmake-bringup/lib/sdk/crt/time/futime.c
    branches/cmake-bringup/lib/sdk/crt/time/utime.c

Modified: branches/cmake-bringup/lib/sdk/crt/except/cpp.c
URL: http://svn.reactos.org/svn/reactos/branches/cmake-bringup/lib/sdk/crt/except/cpp.c?rev=49598&r1=49597&r2=49598&view=diff
==============================================================================
--- branches/cmake-bringup/lib/sdk/crt/except/cpp.c [iso-8859-1] (original)
+++ branches/cmake-bringup/lib/sdk/crt/except/cpp.c [iso-8859-1] Mon Nov 15 20:08:49 2010
@@ -63,6 +63,17 @@
 
 #define THISCALL(func) __thiscall_ ## func
 #define THISCALL_NAME(func) __ASM_NAME("__thiscall_" #func)
+
+#ifdef _MSC_VER
+#pragma message ("DEFINE_THISCALL_WRAPPER broken")
+#define DEFINE_THISCALL_WRAPPER(func,args) \
+    extern void THISCALL(func)(void);
+//    __ASM_GLOBAL_FUNC(__thiscall_ ## func, \
+//                      pop eax \
+//                      push ecx \
+//                      push eax \
+//                      jmp __ASM_NAME(#func) __ASM_STDCALL(args) )
+#else
 #define DEFINE_THISCALL_WRAPPER(func,args) \
     extern void THISCALL(func)(void); \
     __ASM_GLOBAL_FUNC(__thiscall_ ## func, \
@@ -70,6 +81,8 @@
                       "pushl %ecx\n\t" \
                       "pushl %eax\n\t" \
                       "jmp " __ASM_NAME(#func) __ASM_STDCALL(args) )
+#endif /* _MSC_VER */
+
 #else /* __i386__ */
 
 #define THISCALL(func) func

Modified: branches/cmake-bringup/lib/sdk/crt/except/cppexcept.c
URL: http://svn.reactos.org/svn/reactos/branches/cmake-bringup/lib/sdk/crt/except/cppexcept.c?rev=49598&r1=49597&r2=49598&view=diff
==============================================================================
--- branches/cmake-bringup/lib/sdk/crt/except/cppexcept.c [iso-8859-1] (original)
+++ branches/cmake-bringup/lib/sdk/crt/except/cppexcept.c [iso-8859-1] Mon Nov 15 20:08:49 2010
@@ -45,6 +45,9 @@
 {
     void *ret;
     int dummy;
+#ifdef _MSC_VER
+#pragma message ("call_ebp_func is unimplemented for MSC")
+#else
     __asm__ __volatile__ ("pushl %%ebx\n\t"
                           "pushl %%ebp\n\t"
                           "movl %4,%%ebp\n\t"
@@ -53,6 +56,7 @@
                           "popl %%ebx"
                           : "=a" (ret), "=S" (dummy), "=D" (dummy)
                           : "0" (func), "1" (ebp) : "ecx", "edx", "memory" );
+#endif
     return ret;
 }
 
@@ -60,6 +64,9 @@
 static inline void call_copy_ctor( void *func, void *this, void *src, int has_vbase )
 {
     TRACE( "calling copy ctor %p object %p src %p\n", func, this, src );
+#ifdef _MSC_VER
+#pragma message ("call_copy_ctor is unimplemented for MSC")
+#else
     if (has_vbase)
         /* in that case copy ctor takes an extra bool indicating whether to copy the base class */
         __asm__ __volatile__("pushl $1; pushl %2; call *%0"
@@ -67,19 +74,28 @@
     else
         __asm__ __volatile__("pushl %2; call *%0"
                              : : "r" (func), "c" (this), "r" (src) : "eax", "edx", "memory" );
+#endif
 }
 
 /* call the destructor of the exception object */
 static inline void call_dtor( void *func, void *object )
 {
+#ifdef _MSC_VER
+#pragma message ("call_dtor is unimplemented for MSC")
+#else
     __asm__ __volatile__("call *%0" : : "r" (func), "c" (object) : "eax", "edx", "memory" );
+#endif
 }
 
 /* continue execution to the specified address after exception is caught */
 static inline void DECLSPEC_NORETURN continue_after_catch( cxx_exception_frame* frame, void *addr )
 {
+#ifdef _MSC_VER
+#pragma message ("continue_after_catch is unimplemented for MSC")
+#else
     __asm__ __volatile__("movl -4(%0),%%esp; leal 12(%0),%%ebp; jmp *%1"
                          : : "r" (frame), "a" (addr) );
+#endif
     for (;;) ; /* unreached */
 }
 
@@ -415,6 +431,14 @@
  */
 extern DWORD CDECL __CxxFrameHandler( PEXCEPTION_RECORD rec, EXCEPTION_REGISTRATION_RECORD* frame,
                                       PCONTEXT context, EXCEPTION_REGISTRATION_RECORD** dispatch );
+#ifdef _MSC_VER
+#pragma message ("__CxxFrameHandler is unimplemented for MSC")
+DWORD CDECL __CxxFrameHandler( PEXCEPTION_RECORD rec, EXCEPTION_REGISTRATION_RECORD* frame,
+                                      PCONTEXT context, EXCEPTION_REGISTRATION_RECORD** dispatch )
+{
+    return 0;
+}
+#else
 __ASM_GLOBAL_FUNC( __CxxFrameHandler,
                    "pushl $0\n\t"        /* nested_trylevel */
                    __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
@@ -434,7 +458,7 @@
                    "add $28,%esp\n\t"
                    __ASM_CFI(".cfi_adjust_cfa_offset -28\n\t")
                    "ret" )
-
+#endif
 
 /*********************************************************************
  *		__CxxLongjmpUnwind (MSVCRT.@)

Modified: branches/cmake-bringup/lib/sdk/crt/float/i386/logb.c
URL: http://svn.reactos.org/svn/reactos/branches/cmake-bringup/lib/sdk/crt/float/i386/logb.c?rev=49598&r1=49597&r2=49598&view=diff
==============================================================================
--- branches/cmake-bringup/lib/sdk/crt/float/i386/logb.c [iso-8859-1] (original)
+++ branches/cmake-bringup/lib/sdk/crt/float/i386/logb.c [iso-8859-1] Mon Nov 15 20:08:49 2010
@@ -30,7 +30,7 @@
     ("fxtract\n\t"
      : "=t" (__junk), "=u" (__val) : "0" (__x));
 #else
-#error REVIEW ME
+#pragma message ("REVIEW ME")
   __asm fld [__x];
   __asm fxtract;
   __asm fstp st(0);

Modified: branches/cmake-bringup/lib/sdk/crt/stdlib/rot.c
URL: http://svn.reactos.org/svn/reactos/branches/cmake-bringup/lib/sdk/crt/stdlib/rot.c?rev=49598&r1=49597&r2=49598&view=diff
==============================================================================
--- branches/cmake-bringup/lib/sdk/crt/stdlib/rot.c [iso-8859-1] (original)
+++ branches/cmake-bringup/lib/sdk/crt/stdlib/rot.c [iso-8859-1] Mon Nov 15 20:08:49 2010
@@ -9,6 +9,10 @@
  */
 
 #include <stdlib.h>
+
+#ifdef _MSC_VER
+#pragma function(_rotr, _rotl, _rotr, _lrotl, _lrotr)
+#endif
 
 unsigned int _rotr( unsigned int value, int shift );
 /*

Modified: branches/cmake-bringup/lib/sdk/crt/time/ctime.c
URL: http://svn.reactos.org/svn/reactos/branches/cmake-bringup/lib/sdk/crt/time/ctime.c?rev=49598&r1=49597&r2=49598&view=diff
==============================================================================
--- branches/cmake-bringup/lib/sdk/crt/time/ctime.c [iso-8859-1] (original)
+++ branches/cmake-bringup/lib/sdk/crt/time/ctime.c [iso-8859-1] Mon Nov 15 20:08:49 2010
@@ -7,6 +7,7 @@
  */
 #define MINGW_HAS_SECURE_API 1
 
+#define RC_INVOKED 1 // to prevent inline functions
 #include <tchar.h>
 #include <time.h>
 #include "bitsfixup.h"

Modified: branches/cmake-bringup/lib/sdk/crt/time/futime.c
URL: http://svn.reactos.org/svn/reactos/branches/cmake-bringup/lib/sdk/crt/time/futime.c?rev=49598&r1=49597&r2=49598&view=diff
==============================================================================
--- branches/cmake-bringup/lib/sdk/crt/time/futime.c [iso-8859-1] (original)
+++ branches/cmake-bringup/lib/sdk/crt/time/futime.c [iso-8859-1] Mon Nov 15 20:08:49 2010
@@ -6,6 +6,7 @@
  * PROGRAMERS:  Timo Kreuzer
  */
 #include <precomp.h>
+#define RC_INVOKED 1 // to prevent inline functions
 #include <time.h>
 #include <sys/utime.h>
 #include "bitsfixup.h"

Modified: branches/cmake-bringup/lib/sdk/crt/time/utime.c
URL: http://svn.reactos.org/svn/reactos/branches/cmake-bringup/lib/sdk/crt/time/utime.c?rev=49598&r1=49597&r2=49598&view=diff
==============================================================================
--- branches/cmake-bringup/lib/sdk/crt/time/utime.c [iso-8859-1] (original)
+++ branches/cmake-bringup/lib/sdk/crt/time/utime.c [iso-8859-1] Mon Nov 15 20:08:49 2010
@@ -7,6 +7,7 @@
  */
 #include <precomp.h>
 #include <tchar.h>
+#define RC_INVOKED 1 // to prevent inline functions
 #include <sys/utime.h>
 #include "bitsfixup.h"
 




More information about the Ros-diffs mailing list