Author: sginsberg Date: Sun Aug 23 17:49:43 2009 New Revision: 42884
URL: http://svn.reactos.org/svn/reactos?rev=42884&view=rev Log: - copy.c, view.c: malloc.h now properly implements alloca/_alloca, so remove #ifdef hacks - main.c: Change bogus #ifdef _MSC_VER to #if 0 -- it seems this is another instance of "MSVC = MS' headers". The code compiles fine with our headers now and should probably be enabled. - debug.h: Define non-NDEBUG DPRINT the same way for GCC and MSVC. The MSVC version was never inlined because the function has a variable argument list. The GCC version works fine under MSVC so use it instead. Results in neater code in object files.
Modified: trunk/reactos/drivers/network/tcpip/tcpip/main.c trunk/reactos/include/reactos/debug.h trunk/reactos/ntoskrnl/cc/copy.c trunk/reactos/ntoskrnl/cc/view.c
Modified: trunk/reactos/drivers/network/tcpip/tcpip/main.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpip... ============================================================================== --- trunk/reactos/drivers/network/tcpip/tcpip/main.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/tcpip/main.c [iso-8859-1] Sun Aug 23 17:49:43 2009 @@ -48,7 +48,7 @@ * DumpData = Pointer to dump data for the log entry */ { -#ifdef _MSC_VER +#if 0 PIO_ERROR_LOG_PACKET LogEntry; UCHAR EntrySize; ULONG StringSize; @@ -481,7 +481,7 @@
Irp->IoStatus.Information = 0;
-#ifdef _MSC_VER +#if 0 Status = TdiMapUserRequest(DeviceObject, Irp, IrpSp); if (NT_SUCCESS(Status)) { TiDispatchInternal(DeviceObject, Irp);
Modified: trunk/reactos/include/reactos/debug.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/debug.h?rev... ============================================================================== --- trunk/reactos/include/reactos/debug.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/debug.h [iso-8859-1] Sun Aug 23 17:49:43 2009 @@ -90,14 +90,9 @@ #define DPRINT DbgPrint("(%s:%d) ",__FILE__,__LINE__), DbgPrint
#else - #ifdef _MSC_VER - static __inline void DPRINT ( const char* fmt, ... ) - { - UNREFERENCED_PARAMETER(fmt); - } - #else - #define DPRINT(...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0) - #endif + + #define DPRINT(...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0) + #endif
#define UNIMPLEMENTED DbgPrint("WARNING: %s at %s:%d is UNIMPLEMENTED!\n",__FUNCTION__,__FILE__,__LINE__);
Modified: trunk/reactos/ntoskrnl/cc/copy.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cc/copy.c?rev=4288... ============================================================================== --- trunk/reactos/ntoskrnl/cc/copy.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/cc/copy.c [iso-8859-1] Sun Aug 23 17:49:43 2009 @@ -19,15 +19,6 @@
#define MAX_ZERO_LENGTH (256 * 1024) #define MAX_RW_LENGTH (256 * 1024) - -#if defined(__GNUC__) -/* void * alloca(size_t size); */ -#elif defined(_MSC_VER) -void* _alloca(size_t size); -#define alloca _alloca -#else -#error Unknown compiler for alloca intrinsic stack allocation "function" -#endif
ULONG CcFastMdlReadWait; ULONG CcFastMdlReadNotPossible; @@ -73,7 +64,7 @@ KEVENT Event; PMDL Mdl;
- Mdl = alloca(MmSizeOfMdl(NULL, MAX_RW_LENGTH)); + Mdl = _alloca(MmSizeOfMdl(NULL, MAX_RW_LENGTH));
Status = CcRosGetCacheSegmentChain(Bcb, ReadOffset, Length, &head); if (!NT_SUCCESS(Status)) @@ -205,7 +196,7 @@ { Size = CacheSeg->Bcb->CacheSegmentSize; } - Mdl = alloca(MmSizeOfMdl(CacheSeg->BaseAddress, Size)); + Mdl = _alloca(MmSizeOfMdl(CacheSeg->BaseAddress, Size)); MmInitializeMdl(Mdl, CacheSeg->BaseAddress, Size); MmBuildMdlForNonPagedPool(Mdl); Mdl->MdlFlags |= MDL_IO_PAGE_READ; @@ -259,7 +250,7 @@ MmGetPfnForProcess(NULL, (PVOID)((ULONG_PTR)CacheSeg->BaseAddress + (i << PAGE_SHIFT))); } while (++i < (Size >> PAGE_SHIFT)); } - Mdl = alloca(MmSizeOfMdl(CacheSeg->BaseAddress, Size)); + Mdl = _alloca(MmSizeOfMdl(CacheSeg->BaseAddress, Size)); MmInitializeMdl(Mdl, CacheSeg->BaseAddress, Size); MmBuildMdlForNonPagedPool(Mdl); Mdl->MdlFlags |= MDL_IO_PAGE_READ; @@ -612,7 +603,7 @@ { /* File is not cached */
- Mdl = alloca(MmSizeOfMdl(NULL, MAX_ZERO_LENGTH)); + Mdl = _alloca(MmSizeOfMdl(NULL, MAX_ZERO_LENGTH));
while (Length > 0) {
Modified: trunk/reactos/ntoskrnl/cc/view.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cc/view.c?rev=4288... ============================================================================== --- trunk/reactos/ntoskrnl/cc/view.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/cc/view.c [iso-8859-1] Sun Aug 23 17:49:43 2009 @@ -69,15 +69,6 @@ NPAGED_LOOKASIDE_LIST iBcbLookasideList; static NPAGED_LOOKASIDE_LIST BcbLookasideList; static NPAGED_LOOKASIDE_LIST CacheSegLookasideList; - - -#if defined(__GNUC__) -/* void * alloca(size_t size); */ -#elif defined(_MSC_VER) -void* _alloca(size_t size); -#else -#error Unknown compiler for alloca intrinsic stack allocation "function" -#endif
#if DBG || defined(KDBG) static void CcRosCacheSegmentIncRefCount_ ( PCACHE_SEGMENT cs, const char* file, int line ) @@ -737,15 +728,8 @@
Length = ROUND_UP(Length, Bcb->CacheSegmentSize);
-#if defined(__GNUC__) - CacheSegList = alloca(sizeof(PCACHE_SEGMENT) * - (Length / Bcb->CacheSegmentSize)); -#elif defined(_MSC_VER) CacheSegList = _alloca(sizeof(PCACHE_SEGMENT) * (Length / Bcb->CacheSegmentSize)); -#else -#error Unknown compiler for alloca intrinsic stack allocation "function" -#endif
/* * Look for a cache segment already mapping the same data.