- 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

svn path=/trunk/; revision=59151
This commit is contained in:
Timo Kreuzer
2013-06-02 19:04:02 +00:00
parent 98fc7aa05b
commit 0bacae2af9
13 changed files with 36 additions and 26 deletions
+2 -2
View File
@@ -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
+2 -2
View File
@@ -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)
+1
View File
@@ -456,6 +456,7 @@ MmCreateCacheSection(PROS_SECTION_OBJECT *SectionObject,
&Information);
Iosb.Information = Information;
DPRINT("Query => %x\n", Status);
DBG_UNREFERENCED_LOCAL_VARIABLE(Iosb);
if (!NT_SUCCESS(Status))
{
+1
View File
@@ -298,6 +298,7 @@ MmPageOutCacheSection(PMMSUPPORT AddressSpace,
ASSERT(KeGetCurrentIrql() <= APC_LEVEL);
Entry = MmGetPageEntrySectionSegment(Segment, &TotalOffset);
DBG_UNREFERENCED_LOCAL_VARIABLE(Entry);
if (MmIsPageSwapEntry(Process, PAddress))
{
+2
View File
@@ -815,6 +815,8 @@ DisplayBootBitmap(IN BOOLEAN TextMode)
#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 */
+5 -5
View File
@@ -3840,7 +3840,7 @@ static void
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_sI (int bytemode, int sizeflag)
op = *codep++;
if ((op & 0x80) != 0)
op -= 0x100;
mask = 0xffffffff;
//mask = 0xffffffff;
break;
case v_mode:
USED_REX (REX_MODE64);
@@ -3858,11 +3858,11 @@ OP_sI (int bytemode, int sizeflag)
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 @@ OP_sI (int bytemode, int sizeflag)
break;
case w_mode:
op = get16 ();
mask = 0xffffffff;
//mask = 0xffffffff;
if ((op & 0x8000) != 0)
op -= 0x10000;
break;
+2
View File
@@ -615,6 +615,7 @@ ExpRemovePoolTracker(IN ULONG Key,
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 @@ ExpInsertPoolTracker(IN ULONG Key,
Table = PoolTrackTable;
TableMask = PoolTrackTableMask;
TableSize = PoolTrackTableSize;
DBG_UNREFERENCED_LOCAL_VARIABLE(TableSize);
//
// Compute the hash for this key, and loop all the possible buckets
+6 -5
View File
@@ -529,6 +529,7 @@ MiCompleteProtoPteFault(IN BOOLEAN StoreInstruction,
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 @@ MiDispatchFault(IN BOOLEAN StoreInstruction,
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 @@ MiDispatchFault(IN BOOLEAN StoreInstruction,
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))
+3 -2
View File
@@ -1995,7 +1995,7 @@ MiRemoveMappedPtes(IN PVOID BaseAddress,
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 @@ MiRemoveMappedPtes(IN PVOID BaseAddress,
/* 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 @@ MiRemoveMappedPtes(IN PVOID BaseAddress,
/* 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 */
+1 -2
View File
@@ -1559,7 +1559,6 @@ MmFreeDriverInitialization(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
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 @@ MmFreeDriverInitialization(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
if (!PageCount) return;
/* Delete this many PTEs */
PagesDeleted = MiDeleteSystemPageableVm(StartPte, PageCount, 0, NULL);
MiDeleteSystemPageableVm(StartPte, PageCount, 0, NULL);
}
VOID
+4 -3
View File
@@ -252,11 +252,11 @@ MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create)
{
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 @@ MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create)
PsGetCurrentProcess(),
NULL,
NULL);
DBG_UNREFERENCED_LOCAL_VARIABLE(Status);
ASSERT(KeAreAllApcsDisabled() == TRUE);
ASSERT(PointerPde->u.Hard.Valid == 1);
}
@@ -575,7 +576,7 @@ Mmi386MakeKernelPageTableGlobal(PVOID Address)
{
PMMPDE PointerPde = MiAddressToPde(Address);
PMMPTE PointerPte = MiAddressToPte(Address);
if (PointerPde->u.Hard.Valid == 0)
{
if(!MiSynchronizeSystemPde(PointerPde))
+3 -3
View File
@@ -451,10 +451,10 @@ NTAPI
MmGetSegmentRmap(PFN_NUMBER Page, PULONG RawOffset)
{
PCACHE_SECTION_PAGE_TABLE Result = NULL;
PMM_RMAP_ENTRY current_entry, previous_entry;
PMM_RMAP_ENTRY current_entry;//, previous_entry;
ExAcquireFastMutex(&RmapListLock);
previous_entry = NULL;
//previous_entry = NULL;
current_entry = MmGetRmapListHeadPage(Page);
while (current_entry != NULL)
{
@@ -466,7 +466,7 @@ MmGetSegmentRmap(PFN_NUMBER Page, PULONG RawOffset)
ExReleaseFastMutex(&RmapListLock);
return Result;
}
previous_entry = current_entry;
//previous_entry = current_entry;
current_entry = current_entry->Next;
}
ExReleaseFastMutex(&RmapListLock);
+4 -2
View File
@@ -2287,9 +2287,9 @@ MmWritePageSectionView(PMMSUPPORT AddressSpace,
*/
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 @@ MiRosUnmapViewOfSection(IN PEPROCESS Process,
((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);