From 52d74171c8259cab4c3b9ec2545d0fea7e9aba08 Mon Sep 17 00:00:00 2001 From: Sergey Avseyev Date: Apr 06 2018 18:01:37 +0000 Subject: Fix compiler error --- diff --git a/0001-remove-unnecessary-const-qualifier.patch b/0001-remove-unnecessary-const-qualifier.patch new file mode 100644 index 0000000..4d05269 --- /dev/null +++ b/0001-remove-unnecessary-const-qualifier.patch @@ -0,0 +1,33 @@ +From b8bc68d2c4e35deba49e4640870066f30c458fe5 Mon Sep 17 00:00:00 2001 +From: Sergey Avseyev +Date: Fri, 6 Apr 2018 20:57:11 +0300 +Subject: [PATCH] Remove unnecessary const qualifier + +In file included from include/flatbuffers/flexbuffers.h:24, + from src/idl_gen_text.cpp:20: +include/flatbuffers/util.h: In function 'int flatbuffers::FromUTF8(const char**)': +include/flatbuffers/util.h:324:45: error: type qualifiers ignored on cast result type [-Werror=ignored-qualifiers] + if ((static_cast(**in) << len) & 0x80) return -1; // Bit after leading 1's must be 0. + ^ +cc1plus: all warnings being treated as errors +make[2]: *** [CMakeFiles/flatbuffers_shared.dir/build.make:92: CMakeFiles/flatbuffers_shared.dir/src/idl_gen_text.cpp.o] Error 1 +--- + include/flatbuffers/util.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/flatbuffers/util.h b/include/flatbuffers/util.h +index e654010..7cadd0b 100644 +--- a/include/flatbuffers/util.h ++++ b/include/flatbuffers/util.h +@@ -321,7 +321,7 @@ inline int FromUTF8(const char **in) { + break; + } + } +- if ((static_cast(**in) << len) & 0x80) return -1; // Bit after leading 1's must be 0. ++ if ((static_cast(**in) << len) & 0x80) return -1; // Bit after leading 1's must be 0. + if (!len) return *(*in)++; + // UTF-8 encoded values with a length are between 2 and 4 bytes. + if (len < 2 || len > 4) { return -1; } +-- +2.14.3 + diff --git a/flatbuffers.spec b/flatbuffers.spec index c531dbd..31782aa 100644 --- a/flatbuffers.spec +++ b/flatbuffers.spec @@ -17,6 +17,9 @@ Source0: https://github.com/google/flatbuffers/archive/v%{version}/%{name Source1: flatc.1 Source2: flatbuffers.7 +# https://github.com/google/flatbuffers/pull/4698 +Patch0: 0001-remove-unnecessary-const-qualifier.patch + BuildRequires: gcc-c++ BuildRequires: cmake >= 2.8.9