- svchost: #ifdef _MSC_VER doesn't mean "using Microsoft's headers" anymore
authorStefan Ginsberg <stefanginsberg@gmail.com>
Fri, 21 Aug 2009 15:57:26 +0000 (15:57 +0000)
committerStefan Ginsberg <stefanginsberg@gmail.com>
Fri, 21 Aug 2009 15:57:26 +0000 (15:57 +0000)
- ddraw, imm32, msxml3, oleaut32, riched20: Include typeof.h for typeof emulation when compiling under MSVC and remove from ReactOS-generic.rbuild (this can't go to port.h as the modules do not include it).
- TCPIP: Fix a check for MSVC.
- NDIS: Don't use floating point arithmetics in kernel mode -- spotted by MSVC trying to link to ftol (gcc inlined the operation).
- SAMLIB: Use __VA_ARGS__ instead of gcc-specific macro manipulation.
- WIN32CSR: Don't use gcc-specific \% if you want % in the string -- this is incorrect and will pass a broken string to swprintf (the code seems to be uncalled though, so this shouldn't change anything). Use %% instead.
- Error out on MSVC implementation of logb -- it doesn't produce the same code as the gcc version.
- Rename gcc's float.h to gcc_float.h and use #include instead of #include_next for consistency.
- Remove leftover header guard from types.h
- Remove superfluous brackets from PSEH2->MSVC defines -- this isn't necessary anymore after 41597
- Correction to 42216: MSVC *does* let you define types in a function, but only at the top of scope. Move back the C_ASSERT into KiAcquireGuardedMutex.
- Simplify definition of alloca
- scripts.cpp: Silence unavoidable warning.
- Remove compile time warning from Uniata -- the code has been unused for 1 1/2 years and will probably remain so.

svn path=/trunk/; revision=42829

20 files changed:
reactos/ReactOS-generic.rbuild
reactos/base/services/svchost/svchost.h
reactos/dll/directx/wine/ddraw/ddraw.rbuild
reactos/dll/win32/imm32/imm32.rbuild
reactos/dll/win32/msxml3/msxml3.rbuild
reactos/dll/win32/oleaut32/oleaut32.rbuild
reactos/dll/win32/riched20/riched20.rbuild
reactos/dll/win32/samlib/debug.h
reactos/drivers/network/ndis/ndis/config.c
reactos/drivers/network/tcpip/tcpip/dispatch.c
reactos/drivers/storage/ide/uniata/id_sata.cpp
reactos/include/crt/float.h
reactos/include/crt/malloc.h
reactos/include/crt/mingw32/gcc_float.h [moved from reactos/include/crt/mingw32/float.h with 100% similarity]
reactos/include/crt/sys/types.h
reactos/include/reactos/libs/pseh/pseh2.h
reactos/lib/nls/scripts/scripts.cpp
reactos/lib/sdk/crt/float/i386/logb.c
reactos/ntoskrnl/ke/wait.c
reactos/subsystems/win32/csrss/win32csr/guiconsole.c

index 91aa387..7b1388b 100644 (file)
                <compilerflag>/Zl</compilerflag>
                <compilerflag>/Zi</compilerflag>
                <compilerflag>/W1</compilerflag>
-               <compilerflag>/FIwine/typeof.h</compilerflag>
        </group>
 
        <group compilerset="gcc">
index d5e4287..390b4d0 100644 (file)
@@ -10,7 +10,7 @@
 
 /* INCLUDES ******************************************************************/
 
-#ifdef _MSC_VER
+#if 0
 #define _CRT_SECURE_NO_DEPRECATE 1
 #endif
 
index 9866366..9a905af 100644 (file)
@@ -7,6 +7,7 @@
        <include base="ReactOS">include/reactos/wine</include>
        <define name="__WINESRC__" />
        <define name="USE_WIN32_OPENGL" />
+       <compilerflag compilerset="msc">/FIwine/typeof.h</compilerflag>
 
        <library>advapi32</library>
        <library>dxguid</library>
index 2a15eb0..a0d9b60 100644 (file)
@@ -7,6 +7,7 @@
        <include base="ReactOS">include/reactos/wine</include>
        <define name="__WINESRC__" />
        <redefine name="_WIN32_WINNT">0x600</redefine>
+       <compilerflag compilerset="msc">/FIwine/typeof.h</compilerflag>
        <file>imm.c</file>
        <file>version.rc</file>
        <library>wine</library>
index 4c09c2c..005568d 100644 (file)
@@ -10,6 +10,7 @@
        <define name="_WINE" />
        <redefine name="_WIN32_WINNT">0x601</redefine>
        <define name="LIBXML_STATIC" />
+       <compilerflag compilerset="msc">/FIwine/typeof.h</compilerflag>
        <library>libxml2</library>
        <library>libxslt</library>
        <library>wine</library>
index 5d5c184..faf5ce2 100644 (file)
@@ -15,6 +15,7 @@
        <define name="PROXY_DELEGATION"/>
        <define name="REGISTER_PROXY_DLL"/>
        <define name="ENTRY_PREFIX">OLEAUTPS_</define>
+       <compilerflag compilerset="msc">/FIwine/typeof.h</compilerflag>
        <file>connpt.c</file>
        <file>dispatch.c</file>
        <file>hash.c</file>
index 3844457..f28a2fa 100644 (file)
@@ -6,6 +6,7 @@
        <include base="riched20">.</include>
        <include base="ReactOS">include/reactos/wine</include>
        <define name="__WINESRC__" />
+       <compilerflag compilerset="msc">/FIwine/typeof.h</compilerflag>
        <linkerflag linkerset="ld">-enable-stdcall-fixup</linkerflag>
        <file>caret.c</file>
        <file>clipboard.c</file>
index 6fdb2ed..b54107f 100644 (file)
@@ -1,12 +1,12 @@
 #ifdef NDEBUG
-#define DPRINT(args...)
+#define DPRINT(...)
 #define CHECKPOINT
 #else
-#define DPRINT(args...) do { DebugPrint("(SAMLIB:%s:%d) ",__FILE__,__LINE__); DebugPrint(args); } while(0)
+#define DPRINT(...) do { DebugPrint("(SAMLIB:%s:%d) ",__FILE__,__LINE__); DebugPrint(__VA_ARGS__); } while(0)
 #define CHECKPOINT do { DebugPrint("(SAMLIB:%s:%d) Checkpoint\n",__FILE__,__LINE__); } while(0)
 #endif
 
-#define DPRINT1(args...) do { DebugPrint("(SAMLIB:%s:%d) ",__FILE__,__LINE__); DebugPrint(args); } while(0)
+#define DPRINT1(...) do { DebugPrint("(SAMLIB:%s:%d) ",__FILE__,__LINE__); DebugPrint(__VA_ARGS__); } while(0)
 #define CHECKPOINT1 do { DebugPrint("(SAMLIB:%s:%d) Checkpoint\n",__FILE__,__LINE__); } while(0)
 
 
index f83be9e..85bc7e0 100644 (file)
@@ -705,7 +705,14 @@ NdisReadNetworkAddress(
 
     while (j < str.Length && str.Buffer[j] != '\0') j++;
          
-    *NetworkAddressLength = (UINT)((j/2)+0.5);
+    if ((j % 2) == 0)
+    {
+        *NetworkAddressLength = (UINT)(j/2);
+    }
+    else
+    {
+        *NetworkAddressLength = (UINT)((j/2)+1);
+    }
 
     if ((*NetworkAddressLength) == 0)
     {
index 4b0aa94..06ffa1b 100644 (file)
@@ -1058,7 +1058,7 @@ NTSTATUS DispTdiSendDatagram(
                    ("About to call send routine %x\n",
                     (*((PADDRESS_FILE)Request.Handle.AddressHandle)->Send)));
 
-        if( (*((PADDRESS_FILE)Request.Handle.AddressHandle)->Send) )
+        if( (*((PADDRESS_FILE)Request.Handle.AddressHandle)->Send != NULL) )
             Status = (*((PADDRESS_FILE)Request.Handle.AddressHandle)->Send)(
                 Request.Handle.AddressHandle,
                 DgramInfo->SendDatagramInformation,
index 9b0d1e0..e175f19 100644 (file)
@@ -426,9 +426,8 @@ UniataAhciSetupFIS(
         i++;
     } else {
 #ifdef _MSC_VER
-#pragma message ("HACK HACK HACK Disabling warning HACK HACK HACK")
 #pragma warning(push)
-#pragma warning(disable:4333)
+#pragma warning(disable:4333) // right shift by too large amount, data loss
 #endif
         fis[7] |= (plba[3] >> 24) & 0x0f;
 #ifdef _MSC_VER
index caa2d0d..13bde7b 100644 (file)
  *
  */
 
-#ifdef __GNUC__
-#include_next<float.h>
-#endif
-
-#ifdef _MSC_VER
+#if defined(__GNUC__)
+#include <gcc_float.h>
+#elif defined(_MSC_VER)
 #include <msc_float.h>
+#else
+#error
 #endif
 
 #ifndef _MINGW_FLOAT_H_
index 18ffa80..24d7c38 100644 (file)
@@ -146,13 +146,8 @@ extern "C" {
 #endif /* RC_INVOKED */
 
 #ifndef        NO_OLDNAMES
-#undef alloca
-#ifdef __GNUC__
-#define alloca(x) __builtin_alloca((x))
-#else
 #define alloca _alloca
 #endif
-#endif
 
 #ifdef HEAPHOOK
 #ifndef _HEAPHOOK_DEFINED
index eef90b0..adec817 100644 (file)
@@ -36,9 +36,7 @@ typedef unsigned int dev_t;
 # endif
 #endif
 
-#ifdef _WINE
-#ifndef _PID_T_
-#define        _PID_T_
+#if defined(_WINE)
 #ifndef _WIN64
 typedef int    _pid_t;
 #else
@@ -50,7 +48,6 @@ typedef __int64       _pid_t;
 typedef _pid_t pid_t;
 #endif /* __pid_t_defined */
 #endif
-#endif /* Not _PID_T_ */
 #endif
 
 #endif /* !_INC_TYPES */
index b585b0c..9c10af5 100644 (file)
@@ -370,10 +370,10 @@ __SEH_END_SCOPE_CHAIN;
 
 #include <excpt.h>
 
-#define _SEH2_TRY __try {
-#define _SEH2_FINALLY } __finally {
-#define _SEH2_EXCEPT(...) } __except(__VA_ARGS__) {
-#define _SEH2_END }
+#define _SEH2_TRY __try
+#define _SEH2_FINALLY __finally
+#define _SEH2_EXCEPT(...) __except(__VA_ARGS__)
+#define _SEH2_END
 
 #define _SEH2_GetExceptionInformation() (GetExceptionInformation())
 #define _SEH2_GetExceptionCode() (GetExceptionCode())
index faaac2a..c2bb1d3 100644 (file)
 
 #include "scripts.h"
 
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4351) // elements of array 'array' will be default initialized
+#endif
+
 struct SCRIPTS_ScriptsSet
 {
 private:
@@ -145,6 +150,10 @@ public:
        }
 };
 
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
 int
 WINAPI
 GetStringScripts
index b0bd799..dc2b406 100644 (file)
@@ -29,6 +29,7 @@ double _logb (double __x)
     ("fxtract\n\t"
      : "=t" (__junk), "=u" (__val) : "0" (__x));
 #else
+#error REVIEW ME
   __asm fld [__x];
   __asm fxtract;
   __asm fstp st(0);
index ac1ae64..83d9c69 100644 (file)
@@ -117,15 +117,15 @@ KiAcquireFastMutex(IN PFAST_MUTEX FastMutex)
                           NULL);
 }
 
-/* KiAcquireGuardedMutex depends on these bits being right */
-C_ASSERT((GM_LOCK_WAITER_WOKEN * 2) == GM_LOCK_WAITER_INC);
-
 VOID
 FASTCALL
 KiAcquireGuardedMutex(IN OUT PKGUARDED_MUTEX GuardedMutex)
 {
     ULONG BitsToRemove, BitsToAdd;
     LONG OldValue, NewValue;
+
+    /* We depend on these bits being just right */
+    C_ASSERT((GM_LOCK_WAITER_WOKEN * 2) == GM_LOCK_WAITER_INC);
     
     /* Increase the contention count */
     GuardedMutex->Contention++;
index 86c0e09..1b43429 100644 (file)
@@ -375,11 +375,11 @@ GuiConsoleOpenUserSettings(PGUI_CONSOLE_DATA GuiData, DWORD ProcessId, PHKEY hSu
           while((ptr = wcschr(szProcessName, L'\\')))
             ptr[0] = L'_';
 
-          swprintf(szBuffer, L"Console\\\%SystemRoot\%%S", &szProcessName[wLength]);
+          swprintf(szBuffer, L"Console\\%%SystemRoot%%%S", &szProcessName[wLength]);
           DPRINT("#3 Path : %S\n", szBuffer);
           if (RegOpenKeyExW(hKey, szBuffer, 0, samDesired, hSubKey) == ERROR_SUCCESS)
             {
-              swprintf(GuiData->szProcessName, L"\%SystemRoot\%%S", &szProcessName[wLength]);
+              swprintf(GuiData->szProcessName, L"%%SystemRoot%%%S", &szProcessName[wLength]);
               RegCloseKey(hKey);
               return TRUE;
             }