Skip to content

Reenable and fix warning 4457 - declaration of '' hides function parameter #970

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Build/Chakra.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
<!-- REVIEW: These are warning are introduced when moving to VS2015 tools, may want to clean these up -->
<DisableSpecificWarnings>
%(DisableSpecificWarnings);
4457; <!-- declaration of '' hides function parameter -->
4458; <!-- declaration of '' hides class member -->
4312; <!-- 'type cast': conversion from '' to '' of greater size -->
</DisableSpecificWarnings>
Expand Down
16 changes: 8 additions & 8 deletions lib/Backend/GlobOpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18545,14 +18545,14 @@ GlobOpt::OptHoistInvariant(

if (instr->HasBailOutInfo())
{
IR::BailOutKind bailoutKind = instr->GetBailOutKind();
Assert(bailoutKind == IR::BailOutIntOnly ||
bailoutKind == IR::BailOutExpectingInteger ||
bailoutKind == IR::BailOutOnNotPrimitive ||
bailoutKind == IR::BailOutNumberOnly ||
bailoutKind == IR::BailOutPrimitiveButString ||
bailoutKind == IR::BailOutSimd128F4Only ||
bailoutKind == IR::BailOutSimd128I4Only);
IR::BailOutKind instrBailoutKind = instr->GetBailOutKind();
Assert(instrBailoutKind == IR::BailOutIntOnly ||
instrBailoutKind == IR::BailOutExpectingInteger ||
instrBailoutKind == IR::BailOutOnNotPrimitive ||
instrBailoutKind == IR::BailOutNumberOnly ||
instrBailoutKind == IR::BailOutPrimitiveButString ||
instrBailoutKind == IR::BailOutSimd128F4Only ||
instrBailoutKind == IR::BailOutSimd128I4Only);
}
else if (src1StackSym && bailoutKind != IR::BailOutInvalid)
{
Expand Down
10 changes: 5 additions & 5 deletions lib/Backend/IRBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6851,15 +6851,15 @@ IRBuilder::ResolveVirtualLongBranch(IR::BranchInstr * branchInstr, uint offset)
branchInstr->InsertBefore(returnIPInstr);

// Any jump to this branch to jump to the return IP load instr first
uint32 offset = branchInstr->GetByteCodeOffset();
if (this->m_offsetToInstruction[offset] == branchInstr)
uint32 branchInstrByteCodeOffset = branchInstr->GetByteCodeOffset();
if (this->m_offsetToInstruction[branchInstrByteCodeOffset] == branchInstr)
{
this->m_offsetToInstruction[offset] = returnIPInstr;
this->m_offsetToInstruction[branchInstrByteCodeOffset] = returnIPInstr;
}
else
{
Assert(this->m_offsetToInstruction[offset]->HasBailOutInfo() &&
this->m_offsetToInstruction[offset]->GetBailOutKind() == IR::BailOutInjected);
Assert(this->m_offsetToInstruction[branchInstrByteCodeOffset]->HasBailOutInfo() &&
this->m_offsetToInstruction[branchInstrByteCodeOffset]->GetBailOutKind() == IR::BailOutInjected);
}
}
return GetLoopBodyExitInstrOffset();
Expand Down
4 changes: 2 additions & 2 deletions lib/Backend/Lower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12228,8 +12228,8 @@ Lowerer::GenerateBailOut(IR::Instr * instr, IR::BranchInstr * branchInstr, IR::L
#endif
Assert(bailOutLabel == nullptr || bailOutLabel == bailOutTargetLabel);

IR::BranchInstr * branchInstr = IR::BranchInstr::New(LowererMD::MDUncondBranchOpcode, bailOutTargetLabel, this->m_func);
instr->InsertAfter(branchInstr);
IR::BranchInstr * newBranchInstr = IR::BranchInstr::New(LowererMD::MDUncondBranchOpcode, bailOutTargetLabel, this->m_func);
instr->InsertAfter(newBranchInstr);
instr->Remove();
return collectRuntimeStatsLabel ? collectRuntimeStatsLabel : bailOutLabel;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Backend/LowerMDSharedSimd128.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3070,9 +3070,9 @@ LowererMD::Simd128LoadHeadSegment(IR::IndirOpnd *indirOpnd, ValueType arrType, I
{
// MOV headSegment, [base + offset(head)]
int32 headOffset = m_lowerer->GetArrayOffsetOfHeadSegment(arrType);
IR::IndirOpnd * indirOpnd = IR::IndirOpnd::New(arrayRegOpnd, headOffset, TyMachPtr, this->m_func);
IR::IndirOpnd * newIndirOpnd = IR::IndirOpnd::New(arrayRegOpnd, headOffset, TyMachPtr, this->m_func);
headSegmentOpnd = IR::RegOpnd::New(TyMachPtr, this->m_func);
m_lowerer->InsertMove(headSegmentOpnd, indirOpnd, instr);
m_lowerer->InsertMove(headSegmentOpnd, newIndirOpnd, instr);
}

// change base to be the head segment instead of the array object
Expand Down
6 changes: 3 additions & 3 deletions lib/Runtime/Base/EtwTrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ void EtwTrace::LogMethodNativeLoadEvent(FunctionBody* body, FunctionEntryPointIn

void EtwTrace::LogLoopBodyLoadEvent(FunctionBody* body, LoopHeader* loopHeader, LoopEntryPointInfo* entryPoint, uint16 loopNumber)
{
Assert(loopNumber == body->GetLoopNumberWithLock(loopHeader));
LogLoopBodyEventBG(EventWriteMethodLoad, body, loopHeader, entryPoint, loopNumber);

#ifdef VTUNE_PROFILING
Expand All @@ -387,8 +388,7 @@ void EtwTrace::LogLoopBodyLoadEvent(FunctionBody* body, LoopHeader* loopHeader,
{
methodInfo.method_id = iJIT_GetNewMethodID();
size_t len = utf8::EncodeInto(utf8MethodName, methodName, (charcount_t)methodLength);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this loopNumber is the same as the parameter and that data is contained in loopHeader, should we remove that parameter and extract that value from loopHeader? Otherwise, is there an assertion that should be made about whether the parameter loopNumber matches the value in body->GetLoopNumber(loopHeader)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added assert

uint loopNumber = body->GetLoopNumber(loopHeader) + 1;
sprintf_s((char*)(utf8MethodName + len), length - len," %s %d", LoopStr, loopNumber);
sprintf_s((char*)(utf8MethodName + len), length - len," %s %d", LoopStr, loopNumber + 1);
methodInfo.method_name = (char*)utf8MethodName;
methodInfo.method_load_address = (void*)entryPoint->GetNativeAddress();
methodInfo.method_size = (uint)entryPoint->GetCodeSize(); // Size in memory - Must be exact
Expand All @@ -399,7 +399,7 @@ void EtwTrace::LogLoopBodyLoadEvent(FunctionBody* body, LoopHeader* loopHeader,
methodInfo.env = iJDE_JittingAPI;

iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, &methodInfo);
OUTPUT_TRACE(Js::ProfilerPhase, _u("Loop body load event: %s Loop %d\n"), methodName, loopNumber);
OUTPUT_TRACE(Js::ProfilerPhase, _u("Loop body load event: %s Loop %d\n"), methodName, loopNumber + 1);

if(urlLength > 0)
{
Expand Down
10 changes: 4 additions & 6 deletions lib/Runtime/ByteCode/ByteCodeEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7264,9 +7264,8 @@ void EmitCallTarget(
}

Emit(pnodeTarget->sxBin.pnode1, byteCodeGenerator, funcInfo, false);
Js::PropertyId propertyId = pnodeTarget->sxBin.pnode2->sxPid.PropertyIdFromNameNode();
Js::RegSlot callObjLocation = pnodeTarget->sxBin.pnode1->location;
Js::RegSlot protoLocation = callObjLocation;
Js::PropertyId propertyId = pnodeTarget->sxBin.pnode2->sxPid.PropertyIdFromNameNode();
Js::RegSlot protoLocation = pnodeTarget->sxBin.pnode1->location;
EmitSuperMethodBegin(pnodeTarget, byteCodeGenerator, funcInfo);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. I wonder how this ended up getting into the code in the first place?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dunno.

EmitMethodFld(pnodeTarget, protoLocation, propertyId, byteCodeGenerator, funcInfo);

Expand All @@ -7289,9 +7288,8 @@ void EmitCallTarget(
Emit(pnodeTarget->sxBin.pnode1, byteCodeGenerator, funcInfo, false);
Emit(pnodeTarget->sxBin.pnode2, byteCodeGenerator, funcInfo, false);

Js::RegSlot indexLocation = pnodeTarget->sxBin.pnode2->location;
Js::RegSlot callObjLocation = pnodeTarget->sxBin.pnode1->location;
Js::RegSlot protoLocation = callObjLocation;
Js::RegSlot indexLocation = pnodeTarget->sxBin.pnode2->location;
Js::RegSlot protoLocation = pnodeTarget->sxBin.pnode1->location;
EmitSuperMethodBegin(pnodeTarget, byteCodeGenerator, funcInfo);
EmitMethodElem(pnodeTarget, protoLocation, indexLocation, byteCodeGenerator);

Expand Down
2 changes: 1 addition & 1 deletion lib/Runtime/Library/RegexHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ namespace Js

BEGIN_TEMP_ALLOCATOR(tempAlloc, scriptContext, _u("RegexHelper"))
{
results->Map([&](int i, RecyclableObject* resultObj) {
results->Map([&](int resultIndex, RecyclableObject* resultObj) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this lambda parameter used at all, here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. But I thought it would be nice to leave it there for debugging.

int64 length = JavascriptConversion::ToLength(
JavascriptOperators::GetProperty(resultObj, PropertyIds::length, scriptContext),
scriptContext);
Expand Down
8 changes: 4 additions & 4 deletions lib/Runtime/Types/PathTypeHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1045,14 +1045,14 @@ namespace Js
{
typeHandlerToUpdate->typePath = newTypePath;

DynamicType * predecessorType = typeHandlerToUpdate->GetPredecessorType();
if (predecessorType == nullptr)
DynamicType * currPredecessorType = typeHandlerToUpdate->GetPredecessorType();
if (currPredecessorType == nullptr)
{
break;
}

Assert(predecessorType->GetTypeHandler()->IsPathTypeHandler());
typeHandlerToUpdate = (PathTypeHandlerBase *)predecessorType->GetTypeHandler();
Assert(currPredecessorType->GetTypeHandler()->IsPathTypeHandler());
typeHandlerToUpdate = (PathTypeHandlerBase *)currPredecessorType->GetTypeHandler();
if (typeHandlerToUpdate->typePath != oldTypePath)
{
break;
Expand Down