summaryrefslogtreecommitdiff
path: root/user/rttr/gcc9.patch
blob: 4e438859e08e7697b184e7aa5b2d99d98bcc855d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
From 7edbd580cfad509a3253c733e70144e36f02ecd4 Mon Sep 17 00:00:00 2001
From: Axel Menzel <info@axelmenzel.de>
Date: Sun, 8 Aug 2021 12:27:15 +0200
Subject: [PATCH] add github actions workflow & disable gcc9 warnings

Additional: disable initializer list warning
---
 .github/workflows/linux.yml                   | 23 +++++++++++++++++++
 src/rttr/detail/base/core_prerequisites.h     | 15 ++++++++++++
 src/rttr/detail/variant/variant_data_policy.h |  3 ++-
 3 files changed, 40 insertions(+), 1 deletion(-)
 create mode 100644 .github/workflows/linux.yml

diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
new file mode 100644
index 00000000..c232943e
--- /dev/null
+++ b/.github/workflows/linux.yml
@@ -0,0 +1,23 @@
+name: Linux
+
+on: [push]
+env:
+  # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
+  BUILD_TYPE: Release
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+
+    steps:
+    - uses: actions/checkout@v2
+    - uses: seanmiddleditch/gha-setup-ninja@master
+
+    - name: Configure CMake
+      run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_EXAMPLES=OFF -G Ninja
+
+    - name: Build
+      run: cmake --build ${{github.workspace}}/build
+
+    - name: Test
+      run: cmake --build ${{github.workspace}}/build --target run_tests
diff --git a/src/rttr/detail/base/core_prerequisites.h b/src/rttr/detail/base/core_prerequisites.h
index 6aa29d77..601ddeb9 100644
--- a/src/rttr/detail/base/core_prerequisites.h
+++ b/src/rttr/detail/base/core_prerequisites.h
@@ -278,6 +278,15 @@ namespace rttr
 #   define RTTR_END_DISABLE_OVERRIDE_WARNING
 #endif
 
+#if RTTR_COMP_VER >= 900
+#   define RTTR_BEGIN_DISABLE_INIT_LIST_WARNING       _Pragma ("GCC diagnostic push") \
+                                                      _Pragma ("GCC diagnostic ignored \"-Winit-list-lifetime\"")
+#   define RTTR_END_DISABLE_INIT_LIST_WARNING         _Pragma ("GCC diagnostic pop")
+# else
+#   define RTTR_BEGIN_DISABLE_INIT_LIST_WARNING
+#   define RTTR_END_DISABLE_INIT_LIST_WARNING
+#endif
+
 #   define RTTR_DECLARE_PLUGIN_CTOR       __attribute__((constructor))
 #   define RTTR_DECLARE_PLUGIN_DTOR       __attribute__((destructor))
 
@@ -313,6 +322,10 @@ namespace rttr
 #   define RTTR_END_DISABLE_OVERRIDE_WARNING
 #endif
 
+
+#   define RTTR_BEGIN_DISABLE_INIT_LIST_WARNING
+#   define RTTR_END_DISABLE_INIT_LIST_WARNING
+
 #   define RTTR_DECLARE_PLUGIN_CTOR        __attribute__((__constructor__))
 #   define RTTR_DECLARE_PLUGIN_DTOR        __attribute__((__destructor__))
 
@@ -332,6 +345,8 @@ namespace rttr
 #   define RTTR_DECLARE_PLUGIN_DTOR
 #   define RTTR_BEGIN_DISABLE_OVERRIDE_WARNING
 #   define RTTR_END_DISABLE_OVERRIDE_WARNING
+#   define RTTR_BEGIN_DISABLE_INIT_LIST_WARNING
+#   define RTTR_END_DISABLE_INIT_LIST_WARNING
 
 #else
 #   pragma message("WARNING: unknown compiler, don't know how to disable deprecated warnings")
diff --git a/src/rttr/detail/variant/variant_data_policy.h b/src/rttr/detail/variant/variant_data_policy.h
index 39dbb2f9..8eeaafbe 100644
--- a/src/rttr/detail/variant/variant_data_policy.h
+++ b/src/rttr/detail/variant/variant_data_policy.h
@@ -434,7 +434,7 @@ struct variant_data_policy_big : variant_data_base_policy<T, variant_data_policy
     {
         delete &value;
     }
-
+RTTR_BEGIN_DISABLE_INIT_LIST_WARNING
     static RTTR_INLINE void clone(const T& value, variant_data& dest)
     {
         reinterpret_cast<T*&>(dest) = new T(value);
@@ -450,6 +450,7 @@ struct variant_data_policy_big : variant_data_base_policy<T, variant_data_policy
     {
         reinterpret_cast<T*&>(dest) = new T(std::forward<U>(value));
     }
+RTTR_END_DISABLE_INIT_LIST_WARNING
 };
 
 /////////////////////////////////////////////////////////////////////////////////////////