!2 修改由于gcc升级导致编译失败问题。
From: @liheavy Reviewed-by: @myeuler Signed-off-by: @myeuler
This commit is contained in:
commit
936b4c9a14
34
fix-compilation-failed.patch
Normal file
34
fix-compilation-failed.patch
Normal 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);
|
||||
}
|
||||
@ -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 <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
|
||||
- Package init
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user