diff --git a/CesiumGltf/test/TestPropertyAttributePropertyView.cpp b/CesiumGltf/test/TestPropertyAttributePropertyView.cpp index b2290af0a..d880a838b 100644 --- a/CesiumGltf/test/TestPropertyAttributePropertyView.cpp +++ b/CesiumGltf/test/TestPropertyAttributePropertyView.cpp @@ -1,3 +1,8 @@ +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif + #include "CesiumGltf/PropertyAttributePropertyView.h" #include @@ -822,3 +827,7 @@ TEST_CASE("Check that PropertyAttributeProperty values override class property " REQUIRE(view.get(i) == expected[static_cast(i)]); } } + +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic pop +#endif diff --git a/CesiumGltf/test/TestPropertyTablePropertyView.cpp b/CesiumGltf/test/TestPropertyTablePropertyView.cpp index 2cd8730b3..bf6526349 100644 --- a/CesiumGltf/test/TestPropertyTablePropertyView.cpp +++ b/CesiumGltf/test/TestPropertyTablePropertyView.cpp @@ -1,3 +1,8 @@ +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif + #include "CesiumGltf/PropertyTablePropertyView.h" #include @@ -57,10 +62,10 @@ template static void checkNumeric( const std::vector& values, const std::vector>& expected, - const std::optional offset = std::nullopt, - const std::optional scale = std::nullopt, - const std::optional noData = std::nullopt, - const std::optional defaultValue = std::nullopt) { + const std::optional& offset = std::nullopt, + const std::optional& scale = std::nullopt, + const std::optional& noData = std::nullopt, + const std::optional& defaultValue = std::nullopt) { std::vector data; data.resize(values.size() * sizeof(T)); std::memcpy(data.data(), values.data(), data.size()); @@ -102,10 +107,10 @@ template ::type> static void checkNormalizedNumeric( const std::vector& values, const std::vector>& expected, - const std::optional offset = std::nullopt, - const std::optional scale = std::nullopt, - const std::optional noData = std::nullopt, - const std::optional defaultValue = std::nullopt) { + const std::optional& offset = std::nullopt, + const std::optional& scale = std::nullopt, + const std::optional& noData = std::nullopt, + const std::optional& defaultValue = std::nullopt) { std::vector data; data.resize(values.size() * sizeof(T)); std::memcpy(data.data(), values.data(), data.size()); @@ -210,8 +215,8 @@ static void checkVariableLengthArray( PropertyComponentType offsetType, int64_t instanceCount, const std::vector>>& expected, - const std::optional noData = std::nullopt, - const std::optional defaultValue = std::nullopt) { + const std::optional& noData = std::nullopt, + const std::optional& defaultValue = std::nullopt) { // copy data to buffer std::vector buffer; buffer.resize(data.size() * sizeof(DataType)); @@ -291,8 +296,8 @@ static void checkNormalizedVariableLengthArray( PropertyComponentType offsetType, int64_t instanceCount, const std::vector>>& expected, - const std::optional noData = std::nullopt, - const std::optional defaultValue = std::nullopt) { + const std::optional& noData = std::nullopt, + const std::optional& defaultValue = std::nullopt) { // copy data to buffer std::vector buffer; buffer.resize(data.size() * sizeof(DataType)); @@ -420,10 +425,10 @@ static void checkFixedLengthArray( const std::vector& data, int64_t fixedLengthArrayCount, const std::vector>>& expected, - const std::optional offset = std::nullopt, - const std::optional scale = std::nullopt, - const std::optional noData = std::nullopt, - const std::optional defaultValue = std::nullopt) { + const std::optional& offset = std::nullopt, + const std::optional& scale = std::nullopt, + const std::optional& noData = std::nullopt, + const std::optional& defaultValue = std::nullopt) { int64_t instanceCount = static_cast(data.size()) / fixedLengthArrayCount; @@ -495,10 +500,10 @@ static void checkNormalizedFixedLengthArray( const std::vector& data, int64_t fixedLengthArrayCount, const std::vector>>& expected, - const std::optional offset = std::nullopt, - const std::optional scale = std::nullopt, - const std::optional noData = std::nullopt, - const std::optional defaultValue = std::nullopt) { + const std::optional& offset = std::nullopt, + const std::optional& scale = std::nullopt, + const std::optional& noData = std::nullopt, + const std::optional& defaultValue = std::nullopt) { int64_t instanceCount = static_cast(data.size()) / fixedLengthArrayCount; @@ -3710,3 +3715,7 @@ TEST_CASE("Check variable-length boolean array PropertyTablePropertyView") { } } } + +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic pop +#endif diff --git a/CesiumGltf/test/TestPropertyTexturePropertyView.cpp b/CesiumGltf/test/TestPropertyTexturePropertyView.cpp index 8ad8e1b86..31a374ea2 100644 --- a/CesiumGltf/test/TestPropertyTexturePropertyView.cpp +++ b/CesiumGltf/test/TestPropertyTexturePropertyView.cpp @@ -1,3 +1,8 @@ +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif + #include "CesiumGltf/KhrTextureTransform.h" #include "CesiumGltf/PropertyTexturePropertyView.h" #include "CesiumUtility/Math.h" @@ -2050,3 +2055,7 @@ TEST_CASE("Test normalized PropertyTextureProperty constructs with " REQUIRE(view.get(uv[0], uv[1]) == static_cast(data[i]) / 255.0); } } + +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic pop +#endif