!6 [sync] PR-4: Remove unwanted patch to fix build fail

From: @openeuler-sync-bot
Reviewed-by: @overweight
Signed-off-by: @overweight
This commit is contained in:
openeuler-ci-bot 2021-08-23 03:52:45 +00:00 committed by Gitee
commit a2b248f8bd
2 changed files with 4 additions and 158 deletions

View File

@ -1,156 +0,0 @@
From c80316a3efc9244af035e1ebfe2b4df15d691c96 Mon Sep 17 00:00:00 2001
From: Sergey Avseyev <sergey.avseyev@gmail.com>
Date: Thu, 10 Jan 2019 07:37:09 +0300
Subject: [PATCH] generate gcc pragmas to ignore -Wclass-memaccess
---
samples/monster_generated.h | 7 +++++++
src/idl_gen_cpp.cpp | 7 +++++++
tests/monster_test_generated.h | 21 +++++++++++++++++++
.../namespace_test1_generated.h | 7 +++++++
tests/union_vector/union_vector_generated.h | 14 +++++++++++++
5 files changed, 56 insertions(+)
diff --git a/samples/monster_generated.h b/samples/monster_generated.h
index 5ac4be3..ae1fd04 100644
--- a/samples/monster_generated.h
+++ b/samples/monster_generated.h
@@ -164,7 +164,14 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Vec3 FLATBUFFERS_FINAL_CLASS {
public:
Vec3() {
+#if defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wclass-memaccess"
+#endif
memset(this, 0, sizeof(Vec3));
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#endif
}
Vec3(float _x, float _y, float _z)
: x_(flatbuffers::EndianScalar(_x)),
diff --git a/src/idl_gen_cpp.cpp b/src/idl_gen_cpp.cpp
index a0abfdd..8d35673 100644
--- a/src/idl_gen_cpp.cpp
+++ b/src/idl_gen_cpp.cpp
@@ -2585,7 +2585,14 @@ class CppGenerator : public BaseGenerator {
// Generate a default constructor.
code_ += " {{STRUCT_NAME}}() {";
+ code_ += "#if defined(__GNUC__)";
+ code_ += "#pragma GCC diagnostic push";
+ code_ += "#pragma GCC diagnostic ignored \"-Wclass-memaccess\"";
+ code_ += "#endif";
code_ += " memset(this, 0, sizeof({{STRUCT_NAME}}));";
+ code_ += "#if defined(__GNUC__)";
+ code_ += "#pragma GCC diagnostic pop";
+ code_ += "#endif";
code_ += " }";
// Generate a constructor that takes all fields as arguments.
diff --git a/tests/monster_test_generated.h b/tests/monster_test_generated.h
index 0f5e252..4b0aa9f 100644
--- a/tests/monster_test_generated.h
+++ b/tests/monster_test_generated.h
@@ -269,7 +269,14 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(2) Test FLATBUFFERS_FINAL_CLASS {
public:
Test() {
+#if defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wclass-memaccess"
+#endif
memset(this, 0, sizeof(Test));
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#endif
}
Test(int16_t _a, int8_t _b)
: a_(flatbuffers::EndianScalar(_a)),
@@ -312,7 +319,14 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(16) Vec3 FLATBUFFERS_FINAL_CLASS {
public:
Vec3() {
+#if defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wclass-memaccess"
+#endif
memset(this, 0, sizeof(Vec3));
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#endif
}
Vec3(float _x, float _y, float _z, double _test1, Color _test2, const Test &_test3)
: x_(flatbuffers::EndianScalar(_x)),
@@ -384,7 +398,14 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Ability FLATBUFFERS_FINAL_CLASS {
public:
Ability() {
+#if defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wclass-memaccess"
+#endif
memset(this, 0, sizeof(Ability));
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#endif
}
Ability(uint32_t _id, uint32_t _distance)
: id_(flatbuffers::EndianScalar(_id)),
diff --git a/tests/namespace_test/namespace_test1_generated.h b/tests/namespace_test/namespace_test1_generated.h
index d82a577..a7637bc 100644
--- a/tests/namespace_test/namespace_test1_generated.h
+++ b/tests/namespace_test/namespace_test1_generated.h
@@ -56,7 +56,14 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) StructInNestedNS FLATBUFFERS_FINAL_CLASS
public:
StructInNestedNS() {
+#if defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wclass-memaccess"
+#endif
memset(this, 0, sizeof(StructInNestedNS));
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#endif
}
StructInNestedNS(int32_t _a, int32_t _b)
: a_(flatbuffers::EndianScalar(_a)),
diff --git a/tests/union_vector/union_vector_generated.h b/tests/union_vector/union_vector_generated.h
index c5b2250..57d208e 100644
--- a/tests/union_vector/union_vector_generated.h
+++ b/tests/union_vector/union_vector_generated.h
@@ -188,7 +188,14 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Rapunzel FLATBUFFERS_FINAL_CLASS {
public:
Rapunzel() {
+#if defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wclass-memaccess"
+#endif
memset(this, 0, sizeof(Rapunzel));
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#endif
}
Rapunzel(int32_t _hair_length)
: hair_length_(flatbuffers::EndianScalar(_hair_length)) {
@@ -213,7 +220,14 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) BookReader FLATBUFFERS_FINAL_CLASS {
public:
BookReader() {
+#if defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wclass-memaccess"
+#endif
memset(this, 0, sizeof(BookReader));
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#endif
}
BookReader(int32_t _books_read)
: books_read_(flatbuffers::EndianScalar(_books_read)) {
--
2.20.1

View File

@ -5,14 +5,13 @@
%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
BuildRequires: gcc-c++ cmake >= 2.8.9
Provides: bundled(grpc)
@ -70,5 +69,8 @@ make test
%{_libdir}/cmake/flatbuffers/*.cmake
%changelog
* Mon Aug 23 2021 liyanan <liyanan32@huawei.com> - 1.10.0-2
- Remove unwanted patch
* Mon Jan 11 2021 yanan li <liyanan32@huawei.com> - 1.10.0-1
- Package init