diff options
Diffstat (limited to 'recipes-extended')
-rw-r--r-- | recipes-extended/ceph/ceph/0001-common-dout-fix-FTBFS-on-GCC-14.patch | 146 | ||||
-rw-r--r-- | recipes-extended/ceph/ceph_18.2.3.bb | 1 |
2 files changed, 147 insertions, 0 deletions
diff --git a/recipes-extended/ceph/ceph/0001-common-dout-fix-FTBFS-on-GCC-14.patch b/recipes-extended/ceph/ceph/0001-common-dout-fix-FTBFS-on-GCC-14.patch new file mode 100644 index 00000000..263bcf70 --- /dev/null +++ b/recipes-extended/ceph/ceph/0001-common-dout-fix-FTBFS-on-GCC-14.patch | |||
@@ -0,0 +1,146 @@ | |||
1 | From 0eace4ea9ea42412d4d6a16d24a8660642e41173 Mon Sep 17 00:00:00 2001 | ||
2 | From: Radoslaw Zarzynski <rzarzyns@redhat.com> | ||
3 | Date: Wed, 24 Jan 2024 17:22:44 +0000 | ||
4 | Subject: [PATCH] common/dout: fix FTBFS on GCC 14 | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | The following problem has been reported by Kaleb Keithley: | ||
10 | |||
11 | ``` | ||
12 | /builddir/build/BUILD/ceph-18.2.1/src/osd/osd_types.h: In lambda function: | ||
13 | /builddir/build/BUILD/ceph-18.2.1/src/common/dout.h:184:73: error: call to non-‘constexpr’ function ‘virtual unsigned int DoutPrefixProvider::get_subsys() const’ | ||
14 | 184 | dout_impl(pdpp->get_cct(), ceph::dout::need_dynamic(pdpp->get_subsys()), v) \ | ||
15 | | ~~~~~~~~~~~~~~~~^~ | ||
16 | /builddir/build/BUILD/ceph-18.2.1/src/common/dout.h:155:58: note: in definition of macro ‘dout_impl’ | ||
17 | 155 | return (cctX->_conf->subsys.template should_gather<sub, v>()); \ | ||
18 | | ^~~ | ||
19 | /builddir/build/BUILD/ceph-18.2.1/src/osd/osd_types.h:3617:3: note: in expansion of macro ‘ldpp_dout’ | ||
20 | 3617 | ldpp_dout(dpp, 10) << "build_prior all_probe " << all_probe << dendl; | ||
21 | | ^~~~~~~~~ | ||
22 | ``` | ||
23 | |||
24 | For details of the problem and the idea behind the fix, | ||
25 | please refer to the comment this commit brings to `dout.h`. | ||
26 | |||
27 | The minimized replicator that the facilitated Goldbot-based | ||
28 | investigation: | ||
29 | |||
30 | ```cpp | ||
31 | namespace ceph::dout { | ||
32 | |||
33 | template<typename T> | ||
34 | struct dynamic_marker_t { | ||
35 | T value; | ||
36 | // constexpr ctor isn't needed as it's an aggregate type | ||
37 | constexpr operator T() const { return value; } | ||
38 | }; | ||
39 | |||
40 | template<typename T> | ||
41 | constexpr dynamic_marker_t<T> need_dynamic(T&& t) { | ||
42 | return dynamic_marker_t<T>{ std::forward<T>(t) }; | ||
43 | } | ||
44 | |||
45 | template<typename T> | ||
46 | struct is_dynamic : public std::false_type {}; | ||
47 | |||
48 | template<typename T> | ||
49 | struct is_dynamic<dynamic_marker_t<T>> : public std::true_type {}; | ||
50 | |||
51 | } // ceph::dout | ||
52 | |||
53 | struct subsys_t { | ||
54 | template <unsigned SubV, int LvlV> | ||
55 | bool should_gather() const { | ||
56 | return true; | ||
57 | } | ||
58 | bool should_gather(const unsigned sub, int level) const { | ||
59 | return false; | ||
60 | } | ||
61 | }; | ||
62 | |||
63 | static subsys_t subsys; | ||
64 | |||
65 | do { \ | ||
66 | const bool should_gather = [&](const auto cctX) { \ | ||
67 | if constexpr (ceph::dout::is_dynamic<decltype(sub)>::value || \ | ||
68 | ceph::dout::is_dynamic<decltype(v)>::value) { \ | ||
69 | std::cout << "the dynamic path" << std::endl; \ | ||
70 | return subsys.should_gather(sub, v); \ | ||
71 | } else { \ | ||
72 | /* The parentheses are **essential** because commas in angle \ | ||
73 | * brackets are NOT ignored on macro expansion! A language's \ | ||
74 | * limitation, sorry. */ \ | ||
75 | std::cout << "the static path" << std::endl; \ | ||
76 | /*return subsys.should_gather(sub, v);*/ \ | ||
77 | return (subsys.template should_gather<sub, v>()); \ | ||
78 | } \ | ||
79 | }(cct); \ | ||
80 | } while (0) | ||
81 | |||
82 | if (decltype(auto) pdpp = (dpp); pdpp) /* workaround -Wnonnull-compare for 'this' */ \ | ||
83 | dout_impl(42, sub, v) | ||
84 | |||
85 | if (decltype(auto) pdpp = (dpp); pdpp) /* workaround -Wnonnull-compare for 'this' */ \ | ||
86 | dout_impl(42, ceph::dout::need_dynamic(42), v) | ||
87 | |||
88 | int main() { | ||
89 | std::random_device dev; | ||
90 | std::mt19937 rng(dev()); | ||
91 | std::uniform_int_distribution<std::mt19937::result_type> dist6(1,6); // distribution in range [1, 6] | ||
92 | |||
93 | int sub = dist6(rng); | ||
94 | ldpp_dout("mocked out", sub); | ||
95 | //ldpp_subdout("mocked out", 4, 3); | ||
96 | } | ||
97 | ``` | ||
98 | |||
99 | Upstream-Status: Backport [commit 0eace4ea9ea42412d4d6a16d24a8660642e41173] | ||
100 | |||
101 | Fixes: https://tracker.ceph.com/issues/64050 | ||
102 | Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com> | ||
103 | --- | ||
104 | src/common/dout.h | 20 +++++++++++++++----- | ||
105 | 1 file changed, 15 insertions(+), 5 deletions(-) | ||
106 | |||
107 | diff --git a/src/common/dout.h b/src/common/dout.h | ||
108 | index 4cd60efff8f..6516060c543 100644 | ||
109 | --- a/src/common/dout.h | ||
110 | +++ b/src/common/dout.h | ||
111 | @@ -144,17 +144,27 @@ struct is_dynamic<dynamic_marker_t<T>> : public std::true_type {}; | ||
112 | #else | ||
113 | #define dout_impl(cct, sub, v) \ | ||
114 | do { \ | ||
115 | - const bool should_gather = [&](const auto cctX) { \ | ||
116 | - if constexpr (ceph::dout::is_dynamic<decltype(sub)>::value || \ | ||
117 | - ceph::dout::is_dynamic<decltype(v)>::value) { \ | ||
118 | + const bool should_gather = [&](const auto cctX, auto sub_, auto v_) { \ | ||
119 | + /* The check is performed on `sub_` and `v_` to leverage the C++'s \ | ||
120 | + * guarantee on _discarding_ one of blocks of `if constexpr`, which \ | ||
121 | + * includes also the checks for ill-formed code (`should_gather<>` \ | ||
122 | + * must not be feed with non-const expresions), BUT ONLY within \ | ||
123 | + * a template (thus the generic lambda) and under the restriction \ | ||
124 | + * it's dependant on a parameter of this template). \ | ||
125 | + * GCC prior to v14 was not enforcing these restrictions. */ \ | ||
126 | + if constexpr (ceph::dout::is_dynamic<decltype(sub_)>::value || \ | ||
127 | + ceph::dout::is_dynamic<decltype(v_)>::value) { \ | ||
128 | return cctX->_conf->subsys.should_gather(sub, v); \ | ||
129 | } else { \ | ||
130 | + constexpr auto sub_helper = static_cast<decltype(sub_)>(sub); \ | ||
131 | + constexpr auto v_helper = static_cast<decltype(v_)>(v); \ | ||
132 | /* The parentheses are **essential** because commas in angle \ | ||
133 | * brackets are NOT ignored on macro expansion! A language's \ | ||
134 | * limitation, sorry. */ \ | ||
135 | - return (cctX->_conf->subsys.template should_gather<sub, v>()); \ | ||
136 | + return (cctX->_conf->subsys.template should_gather<sub_helper, \ | ||
137 | + v_helper>()); \ | ||
138 | } \ | ||
139 | - }(cct); \ | ||
140 | + }(cct, sub, v); \ | ||
141 | \ | ||
142 | if (should_gather) { \ | ||
143 | ceph::logging::MutableEntry _dout_e(v, sub); \ | ||
144 | -- | ||
145 | 2.39.2 | ||
146 | |||
diff --git a/recipes-extended/ceph/ceph_18.2.3.bb b/recipes-extended/ceph/ceph_18.2.3.bb index e48615c5..282c265a 100644 --- a/recipes-extended/ceph/ceph_18.2.3.bb +++ b/recipes-extended/ceph/ceph_18.2.3.bb | |||
@@ -14,6 +14,7 @@ SRC_URI = "http://download.ceph.com/tarballs/ceph-${PV}.tar.gz \ | |||
14 | file://0001-avoid-to_string-error.patch \ | 14 | file://0001-avoid-to_string-error.patch \ |
15 | file://0001-delete-install-layout-deb.patch \ | 15 | file://0001-delete-install-layout-deb.patch \ |
16 | file://0001-cephadm-build.py-avoid-using-python3-from-sysroot-wh.patch \ | 16 | file://0001-cephadm-build.py-avoid-using-python3-from-sysroot-wh.patch \ |
17 | file://0001-common-dout-fix-FTBFS-on-GCC-14.patch \ | ||
17 | " | 18 | " |
18 | 19 | ||
19 | SRC_URI[sha256sum] = "47a3aecb724bf246e74ec980464b40d770cd8910f3727e2732575212f13e84ea" | 20 | SRC_URI[sha256sum] = "47a3aecb724bf246e74ec980464b40d770cd8910f3727e2732575212f13e84ea" |