Browse Source

Fix various variable shadowing warnings.

pull/539/head
Vladimír Vondruš 4 years ago
parent
commit
d5e66e8009
  1. 12
      src/Magnum/ShaderTools/shaderconverter.cpp
  2. 4
      src/Magnum/Trade/MaterialData.cpp
  3. 36
      src/Magnum/Trade/Test/MeshDataTest.cpp
  4. 4
      src/Magnum/Vk/Device.cpp

12
src/Magnum/ShaderTools/shaderconverter.cpp

@ -430,15 +430,15 @@ see documentation of a particular converter for more information.)")
Containers::Array<std::pair<Containers::StringView, Containers::StringView>> definitions; Containers::Array<std::pair<Containers::StringView, Containers::StringView>> definitions;
arrayReserve(definitions, args.arrayValueCount("define") + args.arrayValueCount("undefine")); arrayReserve(definitions, args.arrayValueCount("define") + args.arrayValueCount("undefine"));
for(std::size_t i = 0; i != args.arrayValueCount("define"); ++i) { for(std::size_t j = 0; j != args.arrayValueCount("define"); ++j) {
const Containers::Array3<Containers::StringView> define = const Containers::Array3<Containers::StringView> define =
args.arrayValue<Containers::StringView>("define", i).partition('='); args.arrayValue<Containers::StringView>("define", j).partition('=');
arrayAppend(definitions, InPlaceInit, arrayAppend(definitions, InPlaceInit,
define[0], define[2]); define[0], define[2]);
} }
for(std::size_t i = 0; i != args.arrayValueCount("undefine"); ++i) { for(std::size_t j = 0; j != args.arrayValueCount("undefine"); ++j) {
arrayAppend(definitions, InPlaceInit, arrayAppend(definitions, InPlaceInit,
args.arrayValue<Containers::StringView>("undefine", i), nullptr); args.arrayValue<Containers::StringView>("undefine", j), nullptr);
} }
converter->setDefinitions(definitions); converter->setDefinitions(definitions);
@ -464,9 +464,9 @@ see documentation of a particular converter for more information.)")
if(args.isSet("link")) { if(args.isSet("link")) {
arrayReserve(linkInputs, args.arrayValueCount("input")); arrayReserve(linkInputs, args.arrayValueCount("input"));
for(std::size_t i = 0; i != args.arrayValueCount("input"); ++i) for(std::size_t j = 0; j != args.arrayValueCount("input"); ++j)
arrayAppend(linkInputs, InPlaceInit, arrayAppend(linkInputs, InPlaceInit,
ShaderTools::Stage::Unspecified, args.arrayValue<Containers::StringView>("input", i)); ShaderTools::Stage::Unspecified, args.arrayValue<Containers::StringView>("input", j));
} }
} }

4
src/Magnum/Trade/MaterialData.cpp

@ -230,8 +230,8 @@ MaterialData::MaterialData(const MaterialTypes types, Containers::Array<Material
immutable (for example when acquiring release()d immutable data from immutable (for example when acquiring release()d immutable data from
another instance) it could cause crashes. (I expected not, but another instance) it could cause crashes. (I expected not, but
apparently ASan blows up on that.) */ apparently ASan blows up on that.) */
if(end - begin > 1) for(std::size_t i = begin + 1; i != end; ++i) { if(end - begin > 1) for(std::size_t j = begin + 1; j != end; ++j) {
if(_data[i - 1].name() < _data[i].name()) continue; if(_data[j - 1].name() < _data[j].name()) continue;
std::sort(_data + begin, _data + end, [](const MaterialAttributeData& a, const MaterialAttributeData& b) { std::sort(_data + begin, _data + end, [](const MaterialAttributeData& a, const MaterialAttributeData& b) {
/* Need to check here (instead of in the outer for loop) as we /* Need to check here (instead of in the outer for loop) as we

36
src/Magnum/Trade/Test/MeshDataTest.cpp

@ -545,12 +545,12 @@ void MeshDataTest::constructIndexStrided() {
CORRADE_COMPARE(indices.data().stride(), sizeof(IndexStruct)); CORRADE_COMPARE(indices.data().stride(), sizeof(IndexStruct));
constexpr MeshIndexData cindices{Containers::stridedArrayView(IndexStructData, &IndexStructData[0].byteIndex, 3, sizeof(IndexStruct))}; constexpr MeshIndexData cindices{Containers::stridedArrayView(IndexStructData, &IndexStructData[0].byteIndex, 3, sizeof(IndexStruct))};
constexpr MeshIndexType type = cindices.type(); constexpr MeshIndexType ctype = cindices.type();
constexpr Containers::StridedArrayView1D<const void> data = cindices.data(); constexpr Containers::StridedArrayView1D<const void> cdata = cindices.data();
CORRADE_COMPARE(type, MeshIndexType::UnsignedByte); CORRADE_COMPARE(ctype, MeshIndexType::UnsignedByte);
CORRADE_COMPARE(data.data(), &IndexStructData[0].byteIndex); CORRADE_COMPARE(cdata.data(), &IndexStructData[0].byteIndex);
CORRADE_COMPARE(data.size(), 3); CORRADE_COMPARE(cdata.size(), 3);
CORRADE_COMPARE(data.stride(), sizeof(IndexStruct)); CORRADE_COMPARE(cdata.stride(), sizeof(IndexStruct));
} { } {
MeshIndexData indices{view.slice(&IndexStruct::shortIndex)}; MeshIndexData indices{view.slice(&IndexStruct::shortIndex)};
CORRADE_COMPARE(indices.type(), MeshIndexType::UnsignedShort); CORRADE_COMPARE(indices.type(), MeshIndexType::UnsignedShort);
@ -559,12 +559,12 @@ void MeshDataTest::constructIndexStrided() {
CORRADE_COMPARE(indices.data().stride(), sizeof(IndexStruct)); CORRADE_COMPARE(indices.data().stride(), sizeof(IndexStruct));
constexpr MeshIndexData cindices{Containers::stridedArrayView(IndexStructData, &IndexStructData[0].shortIndex, 3, sizeof(IndexStruct))}; constexpr MeshIndexData cindices{Containers::stridedArrayView(IndexStructData, &IndexStructData[0].shortIndex, 3, sizeof(IndexStruct))};
constexpr MeshIndexType type = cindices.type(); constexpr MeshIndexType ctype = cindices.type();
constexpr Containers::StridedArrayView1D<const void> data = cindices.data(); constexpr Containers::StridedArrayView1D<const void> cdata = cindices.data();
CORRADE_COMPARE(type, MeshIndexType::UnsignedShort); CORRADE_COMPARE(ctype, MeshIndexType::UnsignedShort);
CORRADE_COMPARE(data.data(), &IndexStructData[0].shortIndex); CORRADE_COMPARE(cdata.data(), &IndexStructData[0].shortIndex);
CORRADE_COMPARE(data.size(), 3); CORRADE_COMPARE(cdata.size(), 3);
CORRADE_COMPARE(data.stride(), sizeof(IndexStruct)); CORRADE_COMPARE(cdata.stride(), sizeof(IndexStruct));
} { } {
MeshIndexData indices{view.slice(&IndexStruct::intIndex)}; MeshIndexData indices{view.slice(&IndexStruct::intIndex)};
CORRADE_COMPARE(indices.type(), MeshIndexType::UnsignedInt); CORRADE_COMPARE(indices.type(), MeshIndexType::UnsignedInt);
@ -573,12 +573,12 @@ void MeshDataTest::constructIndexStrided() {
CORRADE_COMPARE(indices.data().stride(), sizeof(IndexStruct)); CORRADE_COMPARE(indices.data().stride(), sizeof(IndexStruct));
constexpr MeshIndexData cindices{Containers::stridedArrayView(IndexStructData, &IndexStructData[0].intIndex, 3, sizeof(IndexStruct))}; constexpr MeshIndexData cindices{Containers::stridedArrayView(IndexStructData, &IndexStructData[0].intIndex, 3, sizeof(IndexStruct))};
constexpr MeshIndexType type = cindices.type(); constexpr MeshIndexType ctype = cindices.type();
constexpr Containers::StridedArrayView1D<const void> data = cindices.data(); constexpr Containers::StridedArrayView1D<const void> cdata = cindices.data();
CORRADE_COMPARE(type, MeshIndexType::UnsignedInt); CORRADE_COMPARE(ctype, MeshIndexType::UnsignedInt);
CORRADE_COMPARE(data.data(), &IndexStructData[0].intIndex); CORRADE_COMPARE(cdata.data(), &IndexStructData[0].intIndex);
CORRADE_COMPARE(data.size(), 3); CORRADE_COMPARE(cdata.size(), 3);
CORRADE_COMPARE(data.stride(), sizeof(IndexStruct)); CORRADE_COMPARE(cdata.stride(), sizeof(IndexStruct));
} }
} }

4
src/Magnum/Vk/Device.cpp

@ -807,8 +807,8 @@ Result Device::tryCreateInternal(Instance& instance, const DeviceCreateInfo& inf
if(missingExtensions.any()) { if(missingExtensions.any()) {
for(std::size_t i = 0; i != Implementation::ExtensionCount; ++i) { for(std::size_t i = 0; i != Implementation::ExtensionCount; ++i) {
if(!missingExtensions[i]) continue; if(!missingExtensions[i]) continue;
for(const Version version: KnownVersionsForExtensions) { for(const Version extensionVersion: KnownVersionsForExtensions) {
for(const Extension extension: Extension::extensions(version)) { for(const Extension extension: Extension::extensions(extensionVersion)) {
if(extension.index() != i) continue; if(extension.index() != i) continue;
CORRADE_ASSERT_UNREACHABLE("Vk::Device::tryCreate(): some enabled features need" << extension.string() << "enabled", {}); CORRADE_ASSERT_UNREACHABLE("Vk::Device::tryCreate(): some enabled features need" << extension.string() << "enabled", {});
} }

Loading…
Cancel
Save