From 147d4c61e53fca052a8f14544878bdbb68982241 Mon Sep 17 00:00:00 2001 From: Miki Rozloznik Date: Tue, 20 Aug 2024 10:52:23 +0200 Subject: [PATCH] Enable gcc warning -Wshadow --- cmake/compiler_utils.cmake | 2 +- .../cpp/ParameterizedNestedInArrayTest.cpp | 4 ++-- .../cpp/StructureWithRemovedEnumItemFieldTest.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmake/compiler_utils.cmake b/cmake/compiler_utils.cmake index 59080fd99..8af9f05f7 100644 --- a/cmake/compiler_utils.cmake +++ b/cmake/compiler_utils.cmake @@ -8,7 +8,7 @@ endfunction() # Prepares warnings setup for current target function(compiler_get_warnings_setup VARNAME) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - set(WARNINGS_SETUP "-Wall -Wextra -pedantic -Wconversion -Wno-long-long") + set(WARNINGS_SETUP "-Wall -Wextra -pedantic -Wconversion -Wno-long-long -Wshadow") # gcc 7.5 reports Wsign-conversion even on static_cast, reportedly fixed in gcc 9.3 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "9.3.0") set(WARNINGS_SETUP "${WARNINGS_SETUP} -Wsign-conversion") diff --git a/test/language/parameterized_types/cpp/ParameterizedNestedInArrayTest.cpp b/test/language/parameterized_types/cpp/ParameterizedNestedInArrayTest.cpp index 58f06dfed..75024f936 100644 --- a/test/language/parameterized_types/cpp/ParameterizedNestedInArrayTest.cpp +++ b/test/language/parameterized_types/cpp/ParameterizedNestedInArrayTest.cpp @@ -19,8 +19,8 @@ TEST_F(ParameterizedNestedInArrayTest, writeRead) { Holder holder({{Element{Parameterized{6}}}}, {{Element{Parameterized{6}}}}); - const auto bitBuffer = zserio::serialize(holder); - const Holder readHolder = zserio::deserialize(bitBuffer); + const auto bitBufferHolder = zserio::serialize(holder); + const Holder readHolder = zserio::deserialize(bitBufferHolder); ASSERT_EQ(holder, readHolder); } diff --git a/test/language/structure_types/cpp/StructureWithRemovedEnumItemFieldTest.cpp b/test/language/structure_types/cpp/StructureWithRemovedEnumItemFieldTest.cpp index 57b0242d5..5d7747742 100644 --- a/test/language/structure_types/cpp/StructureWithRemovedEnumItemFieldTest.cpp +++ b/test/language/structure_types/cpp/StructureWithRemovedEnumItemFieldTest.cpp @@ -34,8 +34,8 @@ TEST_F(StructureWithRemovedEnumItemFieldTest, fieldConstructor) TEST_F(StructureWithRemovedEnumItemFieldTest, bitStreamReaderConstructor) { - zserio::BitBuffer bitBuffer(8); - zserio::BitStreamWriter writer(bitBuffer); + zserio::BitBuffer smallBitBuffer(8); + zserio::BitStreamWriter writer(smallBitBuffer); writer.writeBits(0, 8); zserio::BitStreamReader reader(writer.getWriteBuffer(), writer.getBitPosition(), zserio::BitsTag());