1
0

unbreak g++ 4.8 i586 build

OBS-URL: https://build.opensuse.org/package/show/X11:Wayland/spirv-tools?expand=0&rev=9
This commit is contained in:
2017-02-02 19:03:27 +00:00
committed by Git OBS Bridge
parent af152ac901
commit 946010b45b
3 changed files with 33 additions and 1 deletions

30
gcc48.diff Normal file
View File

@@ -0,0 +1,30 @@
From: Jan Engelhardt <jengelh@inai.de>
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;
}