From 903b798da7a4c6cc34ca5e2a9e7cccde90cd6052 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Mon, 7 May 2018 23:41:53 +0200 Subject: [PATCH] Fix GCC 8.1 build. --- build_glslang_spirv_tools.sh | 2 +- spirv_common.hpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/build_glslang_spirv_tools.sh b/build_glslang_spirv_tools.sh index 6748089..a966427 100755 --- a/build_glslang_spirv_tools.sh +++ b/build_glslang_spirv_tools.sh @@ -20,7 +20,7 @@ cd ../.. echo "Building SPIRV-Tools." mkdir -p external/spirv-tools-build cd external/spirv-tools-build -cmake ../spirv-tools -DCMAKE_BUILD_TYPE=$PROFILE -G"Unix Makefiles" +cmake ../spirv-tools -DCMAKE_BUILD_TYPE=$PROFILE -G"Unix Makefiles" -DSPIRV_WERROR=OFF make -j$NPROC cd ../.. diff --git a/spirv_common.hpp b/spirv_common.hpp index a00979b..8d8ba12 100644 --- a/spirv_common.hpp +++ b/spirv_common.hpp @@ -867,6 +867,7 @@ struct SPIRConstant : IVariant // Workaround for MSVC 2013, initializing an array breaks. ConstantVector() { + memset(r, 0, sizeof(r)); for (unsigned i = 0; i < 4; i++) id[i] = 0; } @@ -1005,7 +1006,7 @@ struct SPIRConstant : IVariant inline void make_null(const SPIRType &constant_type_) { - std::memset(&m, 0, sizeof(m)); + m = {}; m.columns = constant_type_.columns; for (auto &c : m.c) c.vecsize = constant_type_.vecsize;