From 789168ba310125bb6f7e3d7eda68845dad48e688 Mon Sep 17 00:00:00 2001 From: feishengfei Date: Tue, 27 Sep 2022 20:23:28 +0800 Subject: [PATCH 1/3] FIX: C++ std::tuple constexpr initial list on old compiler --- test/unit/utglTF2ImportExport.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/unit/utglTF2ImportExport.cpp b/test/unit/utglTF2ImportExport.cpp index 00f76aa47..203b69efd 100644 --- a/test/unit/utglTF2ImportExport.cpp +++ b/test/unit/utglTF2ImportExport.cpp @@ -753,12 +753,21 @@ TEST_F(utglTF2ImportExport, wrongTypes) { // Deliberately broken version of the BoxTextured.gltf asset. using tup_T = std::tuple; std::vector wrongTypes = { +#ifdef __cpp_lib_constexpr_tuple { "/glTF2/wrongTypes/badArray.gltf", "array", "primitives", "meshes[0]" }, { "/glTF2/wrongTypes/badString.gltf", "string", "name", "scenes[0]" }, { "/glTF2/wrongTypes/badUint.gltf", "uint", "index", "materials[0]" }, { "/glTF2/wrongTypes/badNumber.gltf", "number", "scale", "materials[0]" }, { "/glTF2/wrongTypes/badObject.gltf", "object", "pbrMetallicRoughness", "materials[0]" }, { "/glTF2/wrongTypes/badExtension.gltf", "object", "KHR_texture_transform", "materials[0]" } +#else + tup_T( "/glTF2/wrongTypes/badArray.gltf", "array", "primitives", "meshes[0]" ), + tup_T( "/glTF2/wrongTypes/badString.gltf", "string", "name", "scenes[0]" ), + tup_T( "/glTF2/wrongTypes/badUint.gltf", "uint", "index", "materials[0]" ), + tup_T( "/glTF2/wrongTypes/badNumber.gltf", "number", "scale", "materials[0]" ), + tup_T( "/glTF2/wrongTypes/badObject.gltf", "object", "pbrMetallicRoughness", "materials[0]" ), + tup_T( "/glTF2/wrongTypes/badExtension.gltf", "object", "KHR_texture_transform", "materials[0]" ) +#endif }; for (const auto& tuple : wrongTypes) { From 816b8e6156e9acab89125b1a56aae44923e5dd3b Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Thu, 29 Sep 2022 16:48:15 +0200 Subject: [PATCH 2/3] Update utglTF2ImportExport.cpp Needed some change of scenery and optimized this a little bit. --- test/unit/utglTF2ImportExport.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/test/unit/utglTF2ImportExport.cpp b/test/unit/utglTF2ImportExport.cpp index 203b69efd..399bbdc4f 100644 --- a/test/unit/utglTF2ImportExport.cpp +++ b/test/unit/utglTF2ImportExport.cpp @@ -754,20 +754,17 @@ TEST_F(utglTF2ImportExport, wrongTypes) { using tup_T = std::tuple; std::vector wrongTypes = { #ifdef __cpp_lib_constexpr_tuple - { "/glTF2/wrongTypes/badArray.gltf", "array", "primitives", "meshes[0]" }, - { "/glTF2/wrongTypes/badString.gltf", "string", "name", "scenes[0]" }, - { "/glTF2/wrongTypes/badUint.gltf", "uint", "index", "materials[0]" }, - { "/glTF2/wrongTypes/badNumber.gltf", "number", "scale", "materials[0]" }, - { "/glTF2/wrongTypes/badObject.gltf", "object", "pbrMetallicRoughness", "materials[0]" }, - { "/glTF2/wrongTypes/badExtension.gltf", "object", "KHR_texture_transform", "materials[0]" } + #define TUPLE(x) {x} #else - tup_T( "/glTF2/wrongTypes/badArray.gltf", "array", "primitives", "meshes[0]" ), - tup_T( "/glTF2/wrongTypes/badString.gltf", "string", "name", "scenes[0]" ), - tup_T( "/glTF2/wrongTypes/badUint.gltf", "uint", "index", "materials[0]" ), - tup_T( "/glTF2/wrongTypes/badNumber.gltf", "number", "scale", "materials[0]" ), - tup_T( "/glTF2/wrongTypes/badObject.gltf", "object", "pbrMetallicRoughness", "materials[0]" ), - tup_T( "/glTF2/wrongTypes/badExtension.gltf", "object", "KHR_texture_transform", "materials[0]" ) + #define TUPLE(x) tup_T(x) #endif + TUPLE("/glTF2/wrongTypes/badArray.gltf", "array", "primitives", "meshes[0]"), + TUPLE("/glTF2/wrongTypes/badString.gltf", "string", "name", "scenes[0]"), + TUPLE("/glTF2/wrongTypes/badUint.gltf", "uint", "index", "materials[0]"), + TUPLE("/glTF2/wrongTypes/badNumber.gltf", "number", "scale", "materials[0]"), + TUPLE("/glTF2/wrongTypes/badObject.gltf", "object", "pbrMetallicRoughness", "materials[0]"), + TUPLE("/glTF2/wrongTypes/badExtension.gltf", "object", "KHR_texture_transform", "materials[0]") +#undef TUPLE }; for (const auto& tuple : wrongTypes) { From 0be5c567c9b3aaa970c487bcc32e0c12654f48cb Mon Sep 17 00:00:00 2001 From: felix Date: Thu, 29 Sep 2022 23:32:44 +0800 Subject: [PATCH 3/3] FIX: C++ std::tuple constexpr initial list on old compiler [cont 1] --- test/unit/utglTF2ImportExport.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/utglTF2ImportExport.cpp b/test/unit/utglTF2ImportExport.cpp index 399bbdc4f..ef3fc4137 100644 --- a/test/unit/utglTF2ImportExport.cpp +++ b/test/unit/utglTF2ImportExport.cpp @@ -754,9 +754,9 @@ TEST_F(utglTF2ImportExport, wrongTypes) { using tup_T = std::tuple; std::vector wrongTypes = { #ifdef __cpp_lib_constexpr_tuple - #define TUPLE(x) {x} + #define TUPLE(x, y, z, w) {x, y, z, w} #else - #define TUPLE(x) tup_T(x) + #define TUPLE(x, y, z, w) tup_T(x, y, z, w) #endif TUPLE("/glTF2/wrongTypes/badArray.gltf", "array", "primitives", "meshes[0]"), TUPLE("/glTF2/wrongTypes/badString.gltf", "string", "name", "scenes[0]"),