Author: tkreuzer
Date: Sun Jun 2 19:04:02 2013
New Revision: 59151
URL:
http://svn.reactos.org/svn/reactos?rev=59151&view=rev
Log:
[PSDK]
- Add proper definition for DBG_UNREFERENCED_PARAMETER and
DBG_UNREFERENCED_LOCAL_VARIABLE
[NTOSKRNL/RTL]
- Fix a number of warnings about unreferenced local variables
- Add 2 assertions that unmapping a section succeeds
Modified:
trunk/reactos/include/psdk/ntdef.h
trunk/reactos/include/psdk/winnt.h
trunk/reactos/ntoskrnl/cache/section/data.c
trunk/reactos/ntoskrnl/cache/section/swapout.c
trunk/reactos/ntoskrnl/inbv/inbv.c
trunk/reactos/ntoskrnl/kdbg/i386/i386-dis.c
trunk/reactos/ntoskrnl/mm/ARM3/expool.c
trunk/reactos/ntoskrnl/mm/ARM3/pagfault.c
trunk/reactos/ntoskrnl/mm/ARM3/section.c
trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c
trunk/reactos/ntoskrnl/mm/i386/page.c
trunk/reactos/ntoskrnl/mm/rmap.c
trunk/reactos/ntoskrnl/mm/section.c
Modified: trunk/reactos/include/psdk/ntdef.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/ntdef.h?rev=5…
==============================================================================
--- trunk/reactos/include/psdk/ntdef.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/ntdef.h [iso-8859-1] Sun Jun 2 19:04:02 2013
@@ -310,8 +310,8 @@
/* Use to silence unused variable warnings when it is intentional */
#define UNREFERENCED_PARAMETER(P) {(P)=(P);}
#define UNREFERENCED_LOCAL_VARIABLE(L) {(L)=(L);}
-#define DBG_UNREFERENCED_PARAMETER(P)
-#define DBG_UNREFERENCED_LOCAL_VARIABLE(L)
+#define DBG_UNREFERENCED_PARAMETER(P) {(P)=(P);}
+#define DBG_UNREFERENCED_LOCAL_VARIABLE(L) {(L)=(L);}
/* min/max helper macros */
#ifndef NOMINMAX
Modified: trunk/reactos/include/psdk/winnt.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winnt.h?rev=5…
==============================================================================
--- trunk/reactos/include/psdk/winnt.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/winnt.h [iso-8859-1] Sun Jun 2 19:04:02 2013
@@ -131,8 +131,8 @@
#define UNREFERENCED_PARAMETER(P) {(P)=(P);}
#define UNREFERENCED_LOCAL_VARIABLE(L) {(L)=(L);}
-#define DBG_UNREFERENCED_PARAMETER(P)
-#define DBG_UNREFERENCED_LOCAL_VARIABLE(L)
+#define DBG_UNREFERENCED_PARAMETER(P) {(L)=(L);}
+#define DBG_UNREFERENCED_LOCAL_VARIABLE(L) {(L)=(L);}
#ifndef DECLSPEC_ALIGN
# if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
Modified: trunk/reactos/ntoskrnl/cache/section/data.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cache/section/dat…
==============================================================================
--- trunk/reactos/ntoskrnl/cache/section/data.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/cache/section/data.c [iso-8859-1] Sun Jun 2 19:04:02 2013
@@ -456,6 +456,7 @@
&Information);
Iosb.Information = Information;
DPRINT("Query => %x\n", Status);
+ DBG_UNREFERENCED_LOCAL_VARIABLE(Iosb);
if (!NT_SUCCESS(Status))
{
Modified: trunk/reactos/ntoskrnl/cache/section/swapout.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cache/section/swa…
==============================================================================
--- trunk/reactos/ntoskrnl/cache/section/swapout.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/cache/section/swapout.c [iso-8859-1] Sun Jun 2 19:04:02 2013
@@ -298,6 +298,7 @@
ASSERT(KeGetCurrentIrql() <= APC_LEVEL);
Entry = MmGetPageEntrySectionSegment(Segment, &TotalOffset);
+ DBG_UNREFERENCED_LOCAL_VARIABLE(Entry);
if (MmIsPageSwapEntry(Process, PAddress))
{
Modified: trunk/reactos/ntoskrnl/inbv/inbv.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/inbv/inbv.c?rev=5…
==============================================================================
--- trunk/reactos/ntoskrnl/inbv/inbv.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/inbv/inbv.c [iso-8859-1] Sun Jun 2 19:04:02 2013
@@ -815,6 +815,8 @@
#ifdef CORE_6781_resolved
/* Draw the SKU text if it exits */
if (Text) InbvBitBlt(Text, 180, 121);
+#else
+ DBG_UNREFERENCED_LOCAL_VARIABLE(Text);
#endif
/* Draw the progress bar bit */
Modified: trunk/reactos/ntoskrnl/kdbg/i386/i386-dis.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kdbg/i386/i386-di…
==============================================================================
--- trunk/reactos/ntoskrnl/kdbg/i386/i386-dis.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/kdbg/i386/i386-dis.c [iso-8859-1] Sun Jun 2 19:04:02 2013
@@ -3840,7 +3840,7 @@
OP_sI (int bytemode, int sizeflag)
{
bfd_signed_vma op;
- bfd_signed_vma mask = -1;
+ //bfd_signed_vma mask = -1;
switch (bytemode)
{
@@ -3849,7 +3849,7 @@
op = *codep++;
if ((op & 0x80) != 0)
op -= 0x100;
- mask = 0xffffffff;
+ //mask = 0xffffffff;
break;
case v_mode:
USED_REX (REX_MODE64);
@@ -3858,11 +3858,11 @@
else if (sizeflag & DFLAG)
{
op = get32s ();
- mask = 0xffffffff;
+ //mask = 0xffffffff;
}
else
{
- mask = 0xffffffff;
+ //mask = 0xffffffff;
op = get16 ();
if ((op & 0x8000) != 0)
op -= 0x10000;
@@ -3871,7 +3871,7 @@
break;
case w_mode:
op = get16 ();
- mask = 0xffffffff;
+ //mask = 0xffffffff;
if ((op & 0x8000) != 0)
op -= 0x10000;
break;
Modified: trunk/reactos/ntoskrnl/mm/ARM3/expool.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/expool.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/expool.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/expool.c [iso-8859-1] Sun Jun 2 19:04:02 2013
@@ -615,6 +615,7 @@
Table = PoolTrackTable;
TableMask = PoolTrackTableMask;
TableSize = PoolTrackTableSize;
+ DBG_UNREFERENCED_LOCAL_VARIABLE(TableSize);
//
// Compute the hash for this key, and loop all the possible buckets
@@ -717,6 +718,7 @@
Table = PoolTrackTable;
TableMask = PoolTrackTableMask;
TableSize = PoolTrackTableSize;
+ DBG_UNREFERENCED_LOCAL_VARIABLE(TableSize);
//
// Compute the hash for this key, and loop all the possible buckets
Modified: trunk/reactos/ntoskrnl/mm/ARM3/pagfault.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/pagfault.…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/pagfault.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/pagfault.c [iso-8859-1] Sun Jun 2 19:04:02 2013
@@ -529,6 +529,7 @@
PageTablePte = MiAddressToPte(PointerPte);
Pfn2 = MiGetPfnEntry(PageTablePte->u.Hard.PageFrameNumber);
//Pfn2->u2.ShareCount++;
+ DBG_UNREFERENCED_LOCAL_VARIABLE(Pfn2);
/* Check where we should be getting the protection information from */
if (PointerPte->u.Soft.PageFileHigh == MI_PTE_LOOKUP_NEEDED)
@@ -986,19 +987,19 @@
DPRINT("oooh, shiny, a soft fault! 0x%lx\n",
PageFrameIndex);
Pfn1 = MI_PFN_ELEMENT(PageFrameIndex);
ASSERT(Pfn1->u3.e1.PageLocation != ActiveAndValid);
-
+
/* Should not yet happen in ReactOS */
ASSERT(Pfn1->u3.e1.ReadInProgress == 0);
ASSERT(Pfn1->u4.InPageError == 0);
-
+
/* Get the page */
MiUnlinkPageFromList(Pfn1);
-
+
/* Bump its reference count */
ASSERT(Pfn1->u2.ShareCount == 0);
InterlockedIncrement16((PSHORT)&Pfn1->u3.e2.ReferenceCount);
Pfn1->u2.ShareCount++;
-
+
/* Make it valid again */
/* This looks like another macro.... */
Pfn1->u3.e1.PageLocation = ActiveAndValid;
@@ -1009,7 +1010,7 @@
MmProtectToPteMask[PointerProtoPte->u.Trans.Protection];
TempPte.u.Hard.Valid = 1;
TempPte.u.Hard.Accessed = 1;
-
+
/* Is the PTE writeable? */
if (((Pfn1->u3.e1.Modified) && (TempPte.u.Hard.Write))
&&
(TempPte.u.Hard.CopyOnWrite == 0))
Modified: trunk/reactos/ntoskrnl/mm/ARM3/section.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/section.c…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/section.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/section.c [iso-8859-1] Sun Jun 2 19:04:02 2013
@@ -1995,7 +1995,7 @@
IN PCONTROL_AREA ControlArea,
IN PMMSUPPORT Ws)
{
- PMMPTE PointerPte, FirstPte;
+ PMMPTE PointerPte;//, FirstPte;
PMMPDE PointerPde, SystemMapPde;
PMMPFN Pfn1, Pfn2;
MMPTE PteContents;
@@ -2004,7 +2004,7 @@
/* Get the PTE and loop each one */
PointerPte = MiAddressToPte(BaseAddress);
- FirstPte = PointerPte;
+ //FirstPte = PointerPte;
while (NumberOfPtes)
{
/* Check if the PTE is already valid */
@@ -2041,6 +2041,7 @@
/* Dereference the PDE and the PTE */
Pfn2 = MiGetPfnEntry(PFN_FROM_PTE(PointerPde));
//MiDecrementShareCount(Pfn2, PFN_FROM_PTE(PointerPde));
+ DBG_UNREFERENCED_LOCAL_VARIABLE(Pfn2);
MiDecrementShareCount(Pfn1, PFN_FROM_PTE(&PteContents));
/* Release the PFN lock */
Modified: trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/sysldr.c [iso-8859-1] Sun Jun 2 19:04:02 2013
@@ -1559,7 +1559,6 @@
ULONG i;
PIMAGE_NT_HEADERS NtHeader;
PIMAGE_SECTION_HEADER Section, DiscardSection;
- ULONG PagesDeleted;
/* Get the base address and the page count */
DllBase = LdrEntry->DllBase;
@@ -1604,7 +1603,7 @@
if (!PageCount) return;
/* Delete this many PTEs */
- PagesDeleted = MiDeleteSystemPageableVm(StartPte, PageCount, 0, NULL);
+ MiDeleteSystemPageableVm(StartPte, PageCount, 0, NULL);
}
VOID
Modified: trunk/reactos/ntoskrnl/mm/i386/page.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/i386/page.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/i386/page.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/i386/page.c [iso-8859-1] Sun Jun 2 19:04:02 2013
@@ -252,11 +252,11 @@
{
PMMPDE PdeBase;
ULONG PdeOffset = MiGetPdeOffset(Address);
-
+
/* Nobody but page fault should ask for creating the PDE,
* Which imples that Process is the current one */
ASSERT(Create == FALSE);
-
+
PdeBase =
MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase[0]));
if (PdeBase == NULL)
{
@@ -301,6 +301,7 @@
PsGetCurrentProcess(),
NULL,
NULL);
+ DBG_UNREFERENCED_LOCAL_VARIABLE(Status);
ASSERT(KeAreAllApcsDisabled() == TRUE);
ASSERT(PointerPde->u.Hard.Valid == 1);
}
@@ -575,7 +576,7 @@
{
PMMPDE PointerPde = MiAddressToPde(Address);
PMMPTE PointerPte = MiAddressToPte(Address);
-
+
if (PointerPde->u.Hard.Valid == 0)
{
if(!MiSynchronizeSystemPde(PointerPde))
Modified: trunk/reactos/ntoskrnl/mm/rmap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/rmap.c?rev=591…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/rmap.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/rmap.c [iso-8859-1] Sun Jun 2 19:04:02 2013
@@ -451,10 +451,10 @@
MmGetSegmentRmap(PFN_NUMBER Page, PULONG RawOffset)
{
PCACHE_SECTION_PAGE_TABLE Result = NULL;
- PMM_RMAP_ENTRY current_entry, previous_entry;
-
- ExAcquireFastMutex(&RmapListLock);
- previous_entry = NULL;
+ PMM_RMAP_ENTRY current_entry;//, previous_entry;
+
+ ExAcquireFastMutex(&RmapListLock);
+ //previous_entry = NULL;
current_entry = MmGetRmapListHeadPage(Page);
while (current_entry != NULL)
{
@@ -466,7 +466,7 @@
ExReleaseFastMutex(&RmapListLock);
return Result;
}
- previous_entry = current_entry;
+ //previous_entry = current_entry;
current_entry = current_entry->Next;
}
ExReleaseFastMutex(&RmapListLock);
Modified: trunk/reactos/ntoskrnl/mm/section.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/section.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] Sun Jun 2 19:04:02 2013
@@ -2287,9 +2287,9 @@
*/
if (DirectMapped && !Private)
{
- LARGE_INTEGER SOffset;
+ //LARGE_INTEGER SOffset;
ASSERT(SwapEntry == 0);
- SOffset.QuadPart = Offset.QuadPart + Segment->Image.FileOffset;
+ //SOffset.QuadPart = Offset.QuadPart + Segment->Image.FileOffset;
#ifndef NEWCC
CcRosMarkDirtyCacheSegment(Bcb, Offset.LowPart);
#endif
@@ -4116,12 +4116,14 @@
((char*)ImageBaseAddress +
(ULONG_PTR)SectionSegments[i].Image.VirtualAddress);
Status = MmUnmapViewOfSegment(AddressSpace, SBaseAddress);
+ NT_ASSERT(NT_SUCCESS(Status));
}
}
}
else
{
Status = MmUnmapViewOfSegment(AddressSpace, BaseAddress);
+ NT_ASSERT(NT_SUCCESS(Status));
}
MmUnlockAddressSpace(AddressSpace);