diff --git a/gcc48.diff b/gcc48.diff new file mode 100644 index 0000000..120778c --- /dev/null +++ b/gcc48.diff @@ -0,0 +1,30 @@ +From: Jan Engelhardt +Date: 2017-02-02 19:42:44.679588946 +0100 + +build: workaround gcc 4.8 bug + +tools/io.h:41:38: +error: ignoring return value of 'long int ftell(FILE*)', +declared with attribute warn_unused_result [-Werror=unused-result,-Werror] + if (sizeof(T) != 1 && (ftell(fp) % sizeof(T))) { + +Workaround gcc 4.8's wrongful idea that ftell's return value +were ignored. +--- + tools/io.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +Index: spirv-tools-2016.7~g24/tools/io.h +=================================================================== +--- spirv-tools-2016.7~g24.orig/tools/io.h ++++ spirv-tools-2016.7~g24/tools/io.h +@@ -38,7 +38,8 @@ bool ReadFile(const char* filename, cons + return false; + } + } else { +- if (sizeof(T) != 1 && (ftell(fp) % sizeof(T))) { ++ long ftx = ftell(fp); ++ if (sizeof(T) != 1 && ftx % sizeof(T) != 0) { + fprintf(stderr, "error: corrupted word found in file '%s'\n", filename); + return false; + } diff --git a/spirv-tools.changes b/spirv-tools.changes index 9a13486..3edce6d 100644 --- a/spirv-tools.changes +++ b/spirv-tools.changes @@ -11,6 +11,7 @@ Thu Feb 2 10:35:57 UTC 2017 - jengelh@inai.de * Allow missing memory model instructions in modules. * Add spirv-lesspipe.sh * Add spirv-dis/spirv-as support for emacs when loading .spv binaries +- Add gcc48.diff ------------------------------------------------------------------- Mon Jun 13 09:46:37 UTC 2016 - jengelh@inai.de diff --git a/spirv-tools.spec b/spirv-tools.spec index ee523ee..7bad373 100644 --- a/spirv-tools.spec +++ b/spirv-tools.spec @@ -29,6 +29,7 @@ Url: https://github.com/KhronosGroup/SPIRV-Tools Source: %name-%version.tar.xz Patch1: ver.diff +Patch2: gcc48.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: bison BuildRequires: cmake >= 2.8.12 @@ -65,7 +66,7 @@ integration into other code bases directly. %prep %setup -q -%patch -P 1 -p1 +%patch -P 1 -P 2 -p1 %build %cmake -D"SPIRV-Headers_SOURCE_DIR=%_prefix"