Visual C++ backend for rbuild (for now just a hacked mingw backend) and related compi...
authorKJK::Hyperion <hackbunny@reactos.org>
Sat, 25 Oct 2008 18:13:25 +0000 (18:13 +0000)
committerKJK::Hyperion <hackbunny@reactos.org>
Sat, 25 Oct 2008 18:13:25 +0000 (18:13 +0000)
modified   dll/win32/aclui/guid.c
modified   dll/win32/aclui/precomp.h
modified   drivers/bus/acpi/include/actypes.h
modified   drivers/bus/acpi/include/platform/acenv.h
   Miscellaneous compilation fixes

modified   dll/win32/aclui/sidcache.c
   Damn, forgot to commit this to trunk

deleted    include/psdk/intrin.h
added      include/psdk/intrin.h.bak
   intrin.h is positively not a PSDK header

modified   lib/3rdparty/mingw/wcrt1.c
   Port to Visual C++

modified   ReactOS-generic.rbuild
   Use Visual C++'s built-in CRT headers for now

modified   ReactOS-i386.rbuild
   Translate global compiler flags to Visual C++

modified   tools/rbuild/backend/mingw/mingw.cpp
   No need for -pipe in Visual C++
   Disable precompiled headers for now
   Enable a whole lotta warnings, and disable a few. Should move this to a response file somewhere

modified   tools/rbuild/backend/mingw/modulehandler.cpp
   .a -> .lib
   .o -> .obj
   .coff -> .res.obj, fix windres command line to remove the ambiguity
   ${gcc}/${gpp} -> ${cl}, translate command line options
   ECHO_CC -> ECHO_CL
   Pass *_RCFLAGS to gas instead of *_CFLAGS, for now, so that gas only sees includes and defines (in the future we'll have something like *_ASFLAGS)
   Disabled some gcc-specific code for now

modified   tools/rbuild/module.cpp
   .a -> .lib, .o -> .obj, lib<name>.a -> <name>.lib; and why the hell is this in the front-end?

svn path=/branches/the-real-msvc/; revision=36963

ReactOS-generic.rbuild
ReactOS-i386.rbuild
dll/win32/aclui/guid.c
dll/win32/aclui/precomp.h
dll/win32/aclui/sidcache.c
drivers/bus/acpi/include/actypes.h
drivers/bus/acpi/include/platform/acenv.h
include/psdk/intrin.h.bak [moved from include/psdk/intrin.h with 100% similarity]
lib/3rdparty/mingw/wcrt1.c

index 540bb9a..e0b3a72 100644 (file)
@@ -64,8 +64,8 @@
        <include root="intermediate">include/psdk</include>
        <include>include/dxsdk</include>
        <include root="intermediate">include/dxsdk</include>
-       <include>include/crt</include>
-       <include>include/crt/mingw32</include>
+       <!--<include>include/crt</include>-->
+       <!--<include>include/crt/mingw32</include>-->
        <include>include/ddk</include>
        <include>include/GL</include>
        <include>include/ndk</include>
index 8ddfbb5..82ec6b2 100644 (file)
        <property name="NTOSKRNL_SHARED" value="-file-alignment=0x1000 -section-alignment=0x1000 -shared"/>
 
        <if property="OPTIMIZE" value="1">
+       <!--
                <compilerflag>-Os</compilerflag>
                <compilerflag>-ftracer</compilerflag>
                <compilerflag>-momit-leaf-frame-pointer</compilerflag>
+       -->
+               <compilerflag>-O1</compilerflag>
        </if>
        <if property="OPTIMIZE" value="2">
-               <compilerflag>-Os</compilerflag>
+               <!--<compilerflag>-Os</compilerflag>-->
+               <compilerflag>-O2</compilerflag>
        </if>
        <if property="OPTIMIZE" value="3">
-               <compilerflag>-O1</compilerflag>
+               <!--<compilerflag>-O1</compilerflag>-->
+               <compilerflag>-Ox</compilerflag>
+               <compilerflag>-Os</compilerflag>
        </if>
        <if property="OPTIMIZE" value="4">
-               <compilerflag>-O2</compilerflag>
+               <!--<compilerflag>-O2</compilerflag>-->
+               <compilerflag>-Ox</compilerflag>
+               <compilerflag>-Os</compilerflag>
        </if>
        <if property="OPTIMIZE" value="5">
-               <compilerflag>-O3</compilerflag>
+               <!--<compilerflag>-O3</compilerflag>-->
+               <compilerflag>-Ox</compilerflag>
+               <compilerflag>-Os</compilerflag>
        </if>
 
+       <!--
        <compilerflag>-mpreferred-stack-boundary=2</compilerflag>
        <compilerflag>-fno-strict-aliasing</compilerflag>
        <compilerflag>-Wno-strict-aliasing</compilerflag>
        <compilerflag>-Wpointer-arith</compilerflag>
+       -->
+       <compilerflag>-Oy-</compilerflag>
+       <compilerflag>-GS-</compilerflag>
        <linkerflag>-disable-stdcall-fixup</linkerflag>
 
 </project>
index 791f78e..3c661f5 100644 (file)
 
 /* DO NOT USE THE PRECOMPILED HEADER FOR THIS FILE! */
 
-#include <initguid.h>
 #include <windows.h>
+
+#include <initguid.h>
+#include <objbase.h>
+
 #include <aclui.h>
 #include <objsel.h>
 
index d300be0..48b4907 100644 (file)
@@ -4,7 +4,7 @@
 #include <windows.h>
 #include <ndk/ntndk.h>
 #include <commctrl.h>
-#include <oleauto.h>
+#include <ole2.h>
 #include <objsel.h>
 #include <prsht.h>
 #include <aclui.h>
index 5e8db06..c5f4920 100644 (file)
@@ -178,7 +178,7 @@ OpenLSAPolicyHandle(IN LPWSTR SystemName,
     if (SystemName != NULL && SystemName[0] != L'\0')
     {
         LsaSystemName.Buffer = SystemName;
-        LsaSystemName.Length = wcslen(SystemName) * sizeof(WCHAR);
+        LsaSystemName.Length = (USHORT)(wcslen(SystemName) * sizeof(WCHAR)); /* FIXME: possible overflow */
         LsaSystemName.MaximumLength = LsaSystemName.Length + sizeof(WCHAR);
         psn = &LsaSystemName;
     }
index c2cc112..cd406f7 100644 (file)
@@ -193,11 +193,11 @@ typedef UINT64                          u64;
  */
 #ifdef _MSC_VER
 typedef ULONGLONG u64;
-typedef ULONG u32;
+//~ typedef ULONG u32;
 typedef USHORT u16;
 typedef UCHAR u8;
 typedef LONGLONG s64;
-typedef LONG s32;
+//~ typedef LONG s32;
 typedef SHORT s16;
 typedef CHAR s8;
 #endif
index 9679222..b73856b 100644 (file)
 #elif _AED_EFI
 #include "acefi.h"
 
-#elif WIN32
+#elif defined(WIN32)
 #include "acwin.h"
 
-#elif __FreeBSD__
+#elif defined(__FreeBSD__)
 #include "acfreebsd.h"
 
 #else
index df1cec8..59385ff 100644 (file)
@@ -42,7 +42,7 @@ extern int wmain (int, wchar_t **, wchar_t **);
 #define __UNKNOWN_APP    0
 #define __CONSOLE_APP    1
 #define __GUI_APP        2
-__MINGW_IMPORT void __set_app_type(int);
+_CRTIMP void __set_app_type(int);
 #endif /* __MSVCRT__ */
 
 /*  Global _fmode for this .exe, not the one in msvcrt.dll,
@@ -181,7 +181,7 @@ _gnu_exception_handler (EXCEPTION_POINTERS * exception_data)
 /*
  * The function mainCRTStartup is the entry point for all console programs.
  */
-static void  __attribute__((noreturn))
+static void  __declspec(noreturn)
 __mingw_wCRTStartup (void)
 {
   int nRet;
@@ -218,6 +218,7 @@ __mingw_wCRTStartup (void)
   _pei386_runtime_relocator ();
 #endif
 
+#if defined(__GNUC__)
 #if defined(__i386__)
   /* Align the stack to 16 bytes for the sake of SSE ops in main
      or in functions inlined into main.  */
@@ -230,6 +231,17 @@ __mingw_wCRTStartup (void)
   asm  __volatile__  ("li 0,15\n\tandc 1,1,0" : : : "r1");
 #else
 #error Unsupported architecture
+#endif
+#endif
+
+#if defined(_MSC_VER)
+#if defined(_M_IX86)
+  /* Align the stack to 16 bytes for the sake of SSE ops in main
+     or in functions inlined into main.  */
+  __asm and esp, 0FFFFFFF0h
+#else
+#error Unsupported architecture
+#endif
 #endif
 
   /*