!2 修改由于gcc升级导致编译失败问题。

From: @liheavy
Reviewed-by: @myeuler
Signed-off-by: @myeuler
This commit is contained in:
openeuler-ci-bot 2021-08-03 09:03:59 +00:00 committed by Gitee
commit 936b4c9a14
2 changed files with 41 additions and 1 deletions

View File

@ -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<const T *>(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<typename T> void WriteScalar(void *p, T t) {
*reinterpret_cast<T *>(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);
}

View File

@ -5,15 +5,18 @@
%endif %endif
Name: flatbuffers Name: flatbuffers
Version: 1.10.0 Version: 1.10.0
Release: 1 Release: 2
Summary: Memory efficient serialization library Summary: Memory efficient serialization library
License: Apache-2.0 License: Apache-2.0
URL: https://github.com/google/flatbuffers URL: https://github.com/google/flatbuffers
Source0: https://github.com/google/flatbuffers/archive/v%{version}/%{name}-%{version}.tar.gz Source0: https://github.com/google/flatbuffers/archive/v%{version}/%{name}-%{version}.tar.gz
Source1: flatc.1 Source1: flatc.1
Source2: flatbuffers.7 Source2: flatbuffers.7
Patch0: 0001-generate-gcc-pragmas-to-ignore-Wclass-memaccess.patch Patch0: 0001-generate-gcc-pragmas-to-ignore-Wclass-memaccess.patch
Patch1: Handle-git-program-or-.git-folder-absence.patch Patch1: Handle-git-program-or-.git-folder-absence.patch
Patch2: fix-compilation-failed.patch
BuildRequires: gcc-c++ cmake >= 2.8.9 BuildRequires: gcc-c++ cmake >= 2.8.9
Provides: bundled(grpc) Provides: bundled(grpc)
%description %description
@ -70,5 +73,8 @@ make test
%{_libdir}/cmake/flatbuffers/*.cmake %{_libdir}/cmake/flatbuffers/*.cmake
%changelog %changelog
* Mon Aug 2 2021 Haiwei Li <lihaiwei8@huawei.com> - 1.10.0-2
- Fix complication failed due to gcc upgrade
* Mon Jan 11 2021 yanan li <liyanan32@huawei.com> - 1.10.0-1 * Mon Jan 11 2021 yanan li <liyanan32@huawei.com> - 1.10.0-1
- Package init - Package init