From 858796a029486ee367b90c108f3b9e8c8726e885 Mon Sep 17 00:00:00 2001 From: Mat M Date: Sun, 4 Sep 2016 06:30:57 -0400 Subject: [PATCH] Eliminate variable shadowing warnings with MSVC (#17) --- CMakeLists.txt | 11 ++++++++++- src/backend_x64/block_of_code.cpp | 4 ++-- src/backend_x64/block_of_code.h | 2 +- src/frontend/ir/basic_block.cpp | 4 ++-- src/frontend/ir/basic_block.h | 2 +- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ac0739af..7cd4612e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,16 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules) # Compiler flags if (MSVC) - add_compile_options(/W3 /MP /Zi /Zo /EHsc /WX) + add_compile_options(/W3 + /w34456 # Declaration of 'var' hides previous local declaration + /w34457 # Declaration of 'var' hides function parameter + /w34458 # Declaration of 'var' hides class member + /w34459 # Declaration of 'var' hides global definition + /MP + /Zi + /Zo + /EHsc + /WX) add_compile_options(/DNOMINMAX) else() add_compile_options(-Wall diff --git a/src/backend_x64/block_of_code.cpp b/src/backend_x64/block_of_code.cpp index a020d23a..928244d3 100644 --- a/src/backend_x64/block_of_code.cpp +++ b/src/backend_x64/block_of_code.cpp @@ -227,9 +227,9 @@ void BlockOfCode::nop(size_t size) { } } -void BlockOfCode::SetCodePtr(CodePtr ptr) { +void BlockOfCode::SetCodePtr(CodePtr code_ptr) { // The "size" defines where top_, the insertion point, is. - size_t required_size = reinterpret_cast(ptr) - getCode(); + size_t required_size = reinterpret_cast(code_ptr) - getCode(); setSize(required_size); } diff --git a/src/backend_x64/block_of_code.h b/src/backend_x64/block_of_code.h index a2280caf..d25aaa93 100644 --- a/src/backend_x64/block_of_code.h +++ b/src/backend_x64/block_of_code.h @@ -127,7 +127,7 @@ public: void int3() { db(0xCC); } void nop(size_t size = 1); - void SetCodePtr(CodePtr ptr); + void SetCodePtr(CodePtr code_ptr); void EnsurePatchLocationSize(CodePtr begin, size_t size); #ifdef _WIN32 diff --git a/src/frontend/ir/basic_block.cpp b/src/frontend/ir/basic_block.cpp index 78bfe1bc..81e005f5 100644 --- a/src/frontend/ir/basic_block.cpp +++ b/src/frontend/ir/basic_block.cpp @@ -46,8 +46,8 @@ Arm::LocationDescriptor Block::ConditionFailedLocation() const { return cond_failed.get(); } -void Block::SetConditionFailedLocation(Arm::LocationDescriptor location) { - cond_failed = location; +void Block::SetConditionFailedLocation(Arm::LocationDescriptor fail_location) { + cond_failed = fail_location; } size_t& Block::ConditionFailedCycleCount() { diff --git a/src/frontend/ir/basic_block.h b/src/frontend/ir/basic_block.h index 46a85feb..18a05b0f 100644 --- a/src/frontend/ir/basic_block.h +++ b/src/frontend/ir/basic_block.h @@ -87,7 +87,7 @@ public: /// Gets the location of the block to execute if the predicated condition fails. Arm::LocationDescriptor ConditionFailedLocation() const; /// Sets the location of the block to execute if the predicated condition fails. - void SetConditionFailedLocation(Arm::LocationDescriptor location); + void SetConditionFailedLocation(Arm::LocationDescriptor fail_location); /// Determines whether or not a prediated condition failure block is present. bool HasConditionFailedLocation() const;