diff --git a/fix-compilation-failed.patch b/fix-compilation-failed.patch new file mode 100644 index 0000000000000000000000000000000000000000..f2fd2bfc4f4e650d0b4d10b7d22b8de0c0d98c56 --- /dev/null +++ b/fix-compilation-failed.patch @@ -0,0 +1,34 @@ +diff -Nur a/include/flatbuffers/base.h b/include/flatbuffers/base.h +--- a/include/flatbuffers/base.h 2018-10-04 03:48:47.000000000 +0800 ++++ b/include/flatbuffers/base.h 2021-08-02 19:48:18.468933100 +0800 +@@ -266,13 +266,30 @@ + return EndianScalar(*reinterpret_cast(p)); + } + ++#if defined(__GNUC__) && !defined(__clang__) ++ #define FLATBUFFERS_GCC (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) ++#else ++ #define FLATBUFFERS_GCC 0 ++#endif ++ ++// See https://github.com/google/flatbuffers/issues/5950 ++#if (FLATBUFFERS_GCC >= 100000) && (FLATBUFFERS_GCC < 110000) ++ #pragma GCC diagnostic push ++ #pragma GCC diagnostic ignored "-Wstringop-overflow" ++#endif ++ + template void WriteScalar(void *p, T t) { + *reinterpret_cast(p) = EndianScalar(t); + } + ++#if (FLATBUFFERS_GCC >= 100000) && (FLATBUFFERS_GCC < 110000) ++ #pragma GCC diagnostic pop ++#endif ++ + // Computes how many bytes you'd have to pad to be able to write an + // "scalar_size" scalar if the buffer had grown to "buf_size" (downwards in + // memory). ++ + inline size_t PaddingBytes(size_t buf_size, size_t scalar_size) { + return ((~buf_size) + 1) & (scalar_size - 1); + } diff --git a/flatbuffers.spec b/flatbuffers.spec index a8f4fe0e836e6588030112ea1eb5b72ead488a33..744ba944fa3b87b450404ae7b50f76a0684e2a54 100644 --- a/flatbuffers.spec +++ b/flatbuffers.spec @@ -5,15 +5,18 @@ %endif Name: flatbuffers Version: 1.10.0 -Release: 1 +Release: 2 Summary: Memory efficient serialization library License: Apache-2.0 URL: https://github.com/google/flatbuffers Source0: https://github.com/google/flatbuffers/archive/v%{version}/%{name}-%{version}.tar.gz Source1: flatc.1 Source2: flatbuffers.7 + Patch0: 0001-generate-gcc-pragmas-to-ignore-Wclass-memaccess.patch Patch1: Handle-git-program-or-.git-folder-absence.patch +Patch2: fix-compilation-failed.patch + BuildRequires: gcc-c++ cmake >= 2.8.9 Provides: bundled(grpc) %description @@ -70,5 +73,8 @@ make test %{_libdir}/cmake/flatbuffers/*.cmake %changelog +* Mon Aug 2 2021 Haiwei Li - 1.10.0-2 +- Fix complication failed due to gcc upgrade + * Mon Jan 11 2021 yanan li - 1.10.0-1 - Package init