1 |
commit: bae8d953c47d62c398e1ee4ee5b3cf1e5f54bb61 |
2 |
Author: stefson <herrtimson <AT> yahoo <DOT> de> |
3 |
AuthorDate: Sun Aug 2 11:53:51 2020 +0000 |
4 |
Commit: Jory Pratt <anarchy <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Aug 18 23:47:51 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=bae8d953 |
7 |
|
8 |
sys-auth/polkit: bump to v0.117 |
9 |
|
10 |
Signed-off-by: Steffen Kuhn <nielson2 <AT> yandex.com> |
11 |
Signed-off-by: Jory Pratt <anarchy <AT> gentoo.org> |
12 |
|
13 |
Closes: https://github.com/gentoo/musl/pull/332 |
14 |
|
15 |
sys-auth/polkit/Manifest | 1 + |
16 |
.../files/polkit-0.116-spidermonkey-68.patch | 1457 -------------------- |
17 |
...{polkit-0.116-r2.ebuild => polkit-0.117.ebuild} | 5 +- |
18 |
3 files changed, 2 insertions(+), 1461 deletions(-) |
19 |
|
20 |
diff --git a/sys-auth/polkit/Manifest b/sys-auth/polkit/Manifest |
21 |
index 8e04530..3fa4f06 100644 |
22 |
--- a/sys-auth/polkit/Manifest |
23 |
+++ b/sys-auth/polkit/Manifest |
24 |
@@ -1 +1,2 @@ |
25 |
DIST polkit-0.116.tar.gz 1548311 BLAKE2B e9761a2934136d453a47b81dd1f132f9fc96c45b731d5fceb2aa7706f5325b6499f6acbb68032befc1b21878b1b54754685607c916ca8e02a8accca3ca014b31 SHA512 b66b01cc2bb4349de70147f41f161f0f6f41e7230b581dfb054058b48969ec57041ab05b51787c749ccfc36aa5f317952d7e7ba337b4f6f6c0a923ed5866c2d5 |
26 |
+DIST polkit-0.117.tar.gz 1554536 BLAKE2B 1cf7e0ff9db19a29be626f4bea96c9e2ef8b1eab4b8287a5f1f4d2a818b86d58c1c4c4a41849d95e31559dba1b18853a31e934ebbadd8e07f94dfd58b45240e0 SHA512 c10ea984f2386fe436e58a2866e5323afc80d24f744f0ee61d966941259aa491bd96b07d911434aa731b300c3cca25b647804b396501175ab5b3c53384e94c70 |
27 |
|
28 |
diff --git a/sys-auth/polkit/files/polkit-0.116-spidermonkey-68.patch b/sys-auth/polkit/files/polkit-0.116-spidermonkey-68.patch |
29 |
deleted file mode 100644 |
30 |
index d944c24..0000000 |
31 |
--- a/sys-auth/polkit/files/polkit-0.116-spidermonkey-68.patch |
32 |
+++ /dev/null |
33 |
@@ -1,1457 +0,0 @@ |
34 |
-From 12f3d25fb73c68151f84c97c79acab7d5344f606 Mon Sep 17 00:00:00 2001 |
35 |
-From: =?UTF-8?q?X=E2=84=B9=20Ruoyao?= <xry111@×××××××××××.wang> |
36 |
-Date: Fri, 13 Mar 2020 14:55:44 +0800 |
37 |
-Subject: [PATCH 1/5] Port JavaScript authority to mozjs-68 |
38 |
- |
39 |
---- |
40 |
- configure.ac | 2 +- |
41 |
- .../polkitbackendjsauthority.cpp | 136 ++++++++++-------- |
42 |
- 2 files changed, 76 insertions(+), 62 deletions(-) |
43 |
- |
44 |
-diff --git a/configure.ac b/configure.ac |
45 |
-index 5cedb4ec..cd678f1c 100644 |
46 |
---- a/configure.ac |
47 |
-+++ b/configure.ac |
48 |
-@@ -79,7 +79,7 @@ PKG_CHECK_MODULES(GLIB, [gmodule-2.0 gio-unix-2.0 >= 2.30.0]) |
49 |
- AC_SUBST(GLIB_CFLAGS) |
50 |
- AC_SUBST(GLIB_LIBS) |
51 |
- |
52 |
--PKG_CHECK_MODULES(LIBJS, [mozjs-60]) |
53 |
-+PKG_CHECK_MODULES(LIBJS, [mozjs-68]) |
54 |
- |
55 |
- AC_SUBST(LIBJS_CFLAGS) |
56 |
- AC_SUBST(LIBJS_CXXFLAGS) |
57 |
-diff --git a/src/polkitbackend/polkitbackendjsauthority.cpp b/src/polkitbackend/polkitbackendjsauthority.cpp |
58 |
-index 0f180856..d5113cb0 100644 |
59 |
---- a/src/polkitbackend/polkitbackendjsauthority.cpp |
60 |
-+++ b/src/polkitbackend/polkitbackendjsauthority.cpp |
61 |
-@@ -43,7 +43,12 @@ |
62 |
- #include <systemd/sd-login.h> |
63 |
- #endif /* HAVE_LIBSYSTEMD */ |
64 |
- |
65 |
-+#include <js/CompilationAndEvaluation.h> |
66 |
-+#include <js/ContextOptions.h> |
67 |
- #include <js/Initialization.h> |
68 |
-+#include <js/Realm.h> |
69 |
-+#include <js/SourceText.h> |
70 |
-+#include <js/Warnings.h> |
71 |
- #include <jsapi.h> |
72 |
- |
73 |
- #include "initjs.h" /* init.js */ |
74 |
-@@ -76,7 +81,7 @@ struct _PolkitBackendJsAuthorityPrivate |
75 |
- |
76 |
- JSContext *cx; |
77 |
- JS::Heap<JSObject*> *js_global; |
78 |
-- JSAutoCompartment *ac; |
79 |
-+ JSAutoRealm *ac; |
80 |
- JS::Heap<JSObject*> *js_polkit; |
81 |
- |
82 |
- GThread *runaway_killer_thread; |
83 |
-@@ -298,14 +303,35 @@ load_scripts (PolkitBackendJsAuthority *authority) |
84 |
- for (l = files; l != NULL; l = l->next) |
85 |
- { |
86 |
- const gchar *filename = (gchar *)l->data; |
87 |
-- JS::RootedScript script(authority->priv->cx); |
88 |
-+ GFile *file = g_file_new_for_path (filename); |
89 |
-+ char *contents; |
90 |
-+ gsize len; |
91 |
-+ if (!g_file_load_contents (file, NULL, &contents, &len, NULL, NULL)) |
92 |
-+ { |
93 |
-+ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), |
94 |
-+ "Error compiling script %s", |
95 |
-+ filename); |
96 |
-+ continue; |
97 |
-+ } |
98 |
-+ JS::SourceText<mozilla::Utf8Unit> source; |
99 |
-+ if (!source.init (authority->priv->cx, contents, len, |
100 |
-+ JS::SourceOwnership::Borrowed)) |
101 |
-+ { |
102 |
-+ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), |
103 |
-+ "Error compiling script %s", |
104 |
-+ filename); |
105 |
-+ g_free (contents); |
106 |
-+ continue; |
107 |
-+ } |
108 |
- JS::CompileOptions options(authority->priv->cx); |
109 |
-- options.setUTF8(true); |
110 |
-- if (!JS::Compile (authority->priv->cx, options, filename, &script)) |
111 |
-+ JS::RootedScript script(authority->priv->cx, |
112 |
-+ JS::Compile (authority->priv->cx, options, source)); |
113 |
-+ if (!script) |
114 |
- { |
115 |
- polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), |
116 |
- "Error compiling script %s", |
117 |
- filename); |
118 |
-+ g_free (contents); |
119 |
- continue; |
120 |
- } |
121 |
- |
122 |
-@@ -318,11 +344,13 @@ load_scripts (PolkitBackendJsAuthority *authority) |
123 |
- polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), |
124 |
- "Error executing script %s", |
125 |
- filename); |
126 |
-+ g_free (contents); |
127 |
- continue; |
128 |
- } |
129 |
- |
130 |
- //g_print ("Successfully loaded and evaluated script `%s'\n", filename); |
131 |
- |
132 |
-+ g_free (contents); |
133 |
- num_scripts++; |
134 |
- } |
135 |
- |
136 |
-@@ -335,8 +363,6 @@ load_scripts (PolkitBackendJsAuthority *authority) |
137 |
- static void |
138 |
- reload_scripts (PolkitBackendJsAuthority *authority) |
139 |
- { |
140 |
-- JS_BeginRequest (authority->priv->cx); |
141 |
-- |
142 |
- JS::AutoValueArray<1> args(authority->priv->cx); |
143 |
- JS::RootedValue rval(authority->priv->cx); |
144 |
- |
145 |
-@@ -351,7 +377,7 @@ reload_scripts (PolkitBackendJsAuthority *authority) |
146 |
- { |
147 |
- polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), |
148 |
- "Error deleting old rules, not loading new ones"); |
149 |
-- goto out; |
150 |
-+ return; |
151 |
- } |
152 |
- |
153 |
- polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), |
154 |
-@@ -362,8 +388,6 @@ reload_scripts (PolkitBackendJsAuthority *authority) |
155 |
- |
156 |
- /* Let applications know we have new rules... */ |
157 |
- g_signal_emit_by_name (authority, "changed"); |
158 |
-- out: |
159 |
-- JS_EndRequest (authority->priv->cx); |
160 |
- } |
161 |
- |
162 |
- static void |
163 |
-@@ -462,11 +486,10 @@ polkit_backend_js_authority_constructed (GObject *object) |
164 |
- JS::SetWarningReporter(authority->priv->cx, report_error); |
165 |
- JS_SetContextPrivate (authority->priv->cx, authority); |
166 |
- |
167 |
-- JS_BeginRequest(authority->priv->cx); |
168 |
- entered_request = TRUE; |
169 |
- |
170 |
- { |
171 |
-- JS::CompartmentOptions compart_opts; |
172 |
-+ JS::RealmOptions compart_opts; |
173 |
- |
174 |
- JS::RootedObject global(authority->priv->cx); |
175 |
- |
176 |
-@@ -476,12 +499,12 @@ polkit_backend_js_authority_constructed (GObject *object) |
177 |
- if (!global) |
178 |
- goto fail; |
179 |
- |
180 |
-- authority->priv->ac = new JSAutoCompartment(authority->priv->cx, global); |
181 |
-+ authority->priv->ac = new JSAutoRealm(authority->priv->cx, global); |
182 |
- |
183 |
- if (!authority->priv->ac) |
184 |
- goto fail; |
185 |
- |
186 |
-- if (!JS_InitStandardClasses (authority->priv->cx, global)) |
187 |
-+ if (!JS::InitRealmStandardClasses (authority->priv->cx)) |
188 |
- goto fail; |
189 |
- |
190 |
- JS::RootedObject polkit(authority->priv->cx); |
191 |
-@@ -503,13 +526,13 @@ polkit_backend_js_authority_constructed (GObject *object) |
192 |
- |
193 |
- JS::CompileOptions options(authority->priv->cx); |
194 |
- JS::RootedValue rval(authority->priv->cx); |
195 |
-- if (!JS::Evaluate (authority->priv->cx, |
196 |
-- options, |
197 |
-- init_js, strlen (init_js), /* init.js */ |
198 |
-- &rval)) /* rval */ |
199 |
-- { |
200 |
-- goto fail; |
201 |
-- } |
202 |
-+ JS::SourceText<mozilla::Utf8Unit> source; |
203 |
-+ if (!source.init (authority->priv->cx, init_js, strlen (init_js), |
204 |
-+ JS::SourceOwnership::Borrowed)) |
205 |
-+ goto fail; |
206 |
-+ |
207 |
-+ if (!JS::Evaluate (authority->priv->cx, options, source, &rval)) |
208 |
-+ goto fail; |
209 |
- |
210 |
- if (authority->priv->rules_dirs == NULL) |
211 |
- { |
212 |
-@@ -529,7 +552,6 @@ polkit_backend_js_authority_constructed (GObject *object) |
213 |
- setup_file_monitors (authority); |
214 |
- load_scripts (authority); |
215 |
- } |
216 |
-- JS_EndRequest (authority->priv->cx); |
217 |
- entered_request = FALSE; |
218 |
- |
219 |
- G_OBJECT_CLASS (polkit_backend_js_authority_parent_class)->constructed (object); |
220 |
-@@ -537,8 +559,6 @@ polkit_backend_js_authority_constructed (GObject *object) |
221 |
- return; |
222 |
- |
223 |
- fail: |
224 |
-- if (entered_request) |
225 |
-- JS_EndRequest (authority->priv->cx); |
226 |
- g_critical ("Error initializing JavaScript environment"); |
227 |
- g_assert_not_reached (); |
228 |
- } |
229 |
-@@ -680,7 +700,7 @@ set_property_strv (PolkitBackendJsAuthority *authority, |
230 |
- GPtrArray *value) |
231 |
- { |
232 |
- JS::RootedValue value_jsval(authority->priv->cx); |
233 |
-- JS::AutoValueVector elems(authority->priv->cx); |
234 |
-+ JS::RootedValueVector elems(authority->priv->cx); |
235 |
- guint n; |
236 |
- |
237 |
- if (!elems.resize(value->len)) |
238 |
-@@ -755,10 +775,15 @@ subject_to_jsval (PolkitBackendJsAuthority *authority, |
239 |
- JS::RootedObject global(authority->priv->cx, authority->priv->js_global->get ()); |
240 |
- |
241 |
- src = "new Subject();"; |
242 |
-- if (!JS::Evaluate (authority->priv->cx, |
243 |
-- options, |
244 |
-- src, strlen (src), |
245 |
-- out_jsval)) |
246 |
-+ JS::SourceText<mozilla::Utf8Unit> source; |
247 |
-+ if (!source.init (authority->priv->cx, src, strlen (src), |
248 |
-+ JS::SourceOwnership::Borrowed)) |
249 |
-+ { |
250 |
-+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Evaluating '%s' failed", src); |
251 |
-+ goto out; |
252 |
-+ } |
253 |
-+ |
254 |
-+ if (!JS::Evaluate (authority->priv->cx, options, source, out_jsval)) |
255 |
- { |
256 |
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Evaluating '%s' failed", src); |
257 |
- goto out; |
258 |
-@@ -877,11 +902,15 @@ action_and_details_to_jsval (PolkitBackendJsAuthority *authority, |
259 |
- JS::RootedObject global(authority->priv->cx, authority->priv->js_global->get ()); |
260 |
- |
261 |
- src = "new Action();"; |
262 |
-+ JS::SourceText<mozilla::Utf8Unit> source; |
263 |
-+ if (!source.init (authority->priv->cx, src, strlen (src), |
264 |
-+ JS::SourceOwnership::Borrowed)) |
265 |
-+ { |
266 |
-+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Evaluating '%s' failed", src); |
267 |
-+ goto out; |
268 |
-+ } |
269 |
- |
270 |
-- if (!JS::Evaluate (authority->priv->cx, |
271 |
-- options, |
272 |
-- src, strlen (src), |
273 |
-- out_jsval)) |
274 |
-+ if (!JS::Evaluate (authority->priv->cx, options, source, out_jsval)) |
275 |
- { |
276 |
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Evaluating '%s' failed", src); |
277 |
- goto out; |
278 |
-@@ -1089,11 +1118,9 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA |
279 |
- guint n; |
280 |
- GError *error = NULL; |
281 |
- JS::RootedString ret_jsstr (authority->priv->cx); |
282 |
-- gchar *ret_str = NULL; |
283 |
-+ JS::UniqueChars ret_str; |
284 |
- gchar **ret_strs = NULL; |
285 |
- |
286 |
-- JS_BeginRequest (authority->priv->cx); |
287 |
-- |
288 |
- if (!action_and_details_to_jsval (authority, action_id, details, args[0], &error)) |
289 |
- { |
290 |
- polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), |
291 |
-@@ -1142,7 +1169,7 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA |
292 |
- goto out; |
293 |
- } |
294 |
- |
295 |
-- ret_strs = g_strsplit (ret_str, ",", -1); |
296 |
-+ ret_strs = g_strsplit (ret_str.get(), ",", -1); |
297 |
- for (n = 0; ret_strs != NULL && ret_strs[n] != NULL; n++) |
298 |
- { |
299 |
- const gchar *identity_str = ret_strs[n]; |
300 |
-@@ -1166,15 +1193,12 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA |
301 |
- |
302 |
- out: |
303 |
- g_strfreev (ret_strs); |
304 |
-- g_free (ret_str); |
305 |
- /* fallback to root password auth */ |
306 |
- if (ret == NULL) |
307 |
- ret = g_list_prepend (ret, polkit_unix_user_new (0)); |
308 |
- |
309 |
- JS_MaybeGC (authority->priv->cx); |
310 |
- |
311 |
-- JS_EndRequest (authority->priv->cx); |
312 |
-- |
313 |
- return ret; |
314 |
- } |
315 |
- |
316 |
-@@ -1197,11 +1221,9 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu |
317 |
- JS::RootedValue rval(authority->priv->cx); |
318 |
- GError *error = NULL; |
319 |
- JS::RootedString ret_jsstr (authority->priv->cx); |
320 |
-- gchar *ret_str = NULL; |
321 |
-+ JS::UniqueChars ret_str; |
322 |
- gboolean good = FALSE; |
323 |
- |
324 |
-- JS_BeginRequest (authority->priv->cx); |
325 |
-- |
326 |
- if (!action_and_details_to_jsval (authority, action_id, details, args[0], &error)) |
327 |
- { |
328 |
- polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), |
329 |
-@@ -1257,12 +1279,12 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu |
330 |
- goto out; |
331 |
- } |
332 |
- |
333 |
-- g_strstrip (ret_str); |
334 |
-- if (!polkit_implicit_authorization_from_string (ret_str, &ret)) |
335 |
-+ g_strstrip (ret_str.get()); |
336 |
-+ if (!polkit_implicit_authorization_from_string (ret_str.get(), &ret)) |
337 |
- { |
338 |
- polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), |
339 |
- "Returned result `%s' is not valid", |
340 |
-- ret_str); |
341 |
-+ ret_str.get()); |
342 |
- goto out; |
343 |
- } |
344 |
- |
345 |
-@@ -1271,12 +1293,9 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu |
346 |
- out: |
347 |
- if (!good) |
348 |
- ret = POLKIT_IMPLICIT_AUTHORIZATION_NOT_AUTHORIZED; |
349 |
-- g_free (ret_str); |
350 |
- |
351 |
- JS_MaybeGC (authority->priv->cx); |
352 |
- |
353 |
-- JS_EndRequest (authority->priv->cx); |
354 |
-- |
355 |
- return ret; |
356 |
- } |
357 |
- |
358 |
-@@ -1289,15 +1308,14 @@ js_polkit_log (JSContext *cx, |
359 |
- { |
360 |
- PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (JS_GetContextPrivate (cx)); |
361 |
- bool ret = false; |
362 |
-- char *s; |
363 |
-+ JS::UniqueChars s; |
364 |
- |
365 |
- JS::CallArgs args = JS::CallArgsFromVp (argc, vp); |
366 |
- |
367 |
- JS::RootedString jsstr (authority->priv->cx); |
368 |
- jsstr = args[0].toString (); |
369 |
- s = JS_EncodeStringToUTF8 (cx, jsstr); |
370 |
-- JS_ReportWarningUTF8 (cx, "%s", s); |
371 |
-- JS_free (cx, s); |
372 |
-+ JS::WarnUTF8 (cx, "%s", s.get()); |
373 |
- |
374 |
- ret = true; |
375 |
- |
376 |
-@@ -1400,7 +1418,7 @@ js_polkit_spawn (JSContext *cx, |
377 |
- for (n = 0; n < array_len; n++) |
378 |
- { |
379 |
- JS::RootedValue elem_val(cx); |
380 |
-- char *s; |
381 |
-+ JS::UniqueChars s; |
382 |
- |
383 |
- if (!JS_GetElement (cx, array_object, n, &elem_val)) |
384 |
- { |
385 |
-@@ -1415,8 +1433,7 @@ js_polkit_spawn (JSContext *cx, |
386 |
- JS::RootedString jsstr (authority->priv->cx); |
387 |
- jsstr = elem_val.toString(); |
388 |
- s = JS_EncodeStringToUTF8 (cx, jsstr); |
389 |
-- argv[n] = g_strdup (s); |
390 |
-- JS_free (cx, s); |
391 |
-+ argv[n] = g_strdup (s.get()); |
392 |
- } |
393 |
- |
394 |
- context = g_main_context_new (); |
395 |
-@@ -1499,8 +1516,8 @@ js_polkit_user_is_in_netgroup (JSContext *cx, |
396 |
- { |
397 |
- PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (JS_GetContextPrivate (cx)); |
398 |
- bool ret = false; |
399 |
-- char *user; |
400 |
-- char *netgroup; |
401 |
-+ JS::UniqueChars user; |
402 |
-+ JS::UniqueChars netgroup; |
403 |
- bool is_in_netgroup = false; |
404 |
- |
405 |
- JS::CallArgs args = JS::CallArgsFromVp (argc, vp); |
406 |
-@@ -1512,17 +1529,14 @@ js_polkit_user_is_in_netgroup (JSContext *cx, |
407 |
- netgstr = args[1].toString(); |
408 |
- netgroup = JS_EncodeStringToUTF8 (cx, netgstr); |
409 |
- |
410 |
-- if (innetgr (netgroup, |
411 |
-+ if (innetgr (netgroup.get(), |
412 |
- NULL, /* host */ |
413 |
-- user, |
414 |
-+ user.get(), |
415 |
- NULL)) /* domain */ |
416 |
- { |
417 |
- is_in_netgroup = true; |
418 |
- } |
419 |
- |
420 |
-- JS_free (cx, netgroup); |
421 |
-- JS_free (cx, user); |
422 |
-- |
423 |
- ret = true; |
424 |
- |
425 |
- args.rval ().setBoolean (is_in_netgroup); |
426 |
--- |
427 |
-GitLab |
428 |
- |
429 |
- |
430 |
-From cf22af32577cf49b4e5ed9945ec9cca862c45b3e Mon Sep 17 00:00:00 2001 |
431 |
-From: =?UTF-8?q?X=E2=84=B9=20Ruoyao?= <xry111@×××××××××××.wang> |
432 |
-Date: Fri, 3 Apr 2020 23:47:38 +0800 |
433 |
-Subject: [PATCH 3/5] ensure to use C++14 |
434 |
- |
435 |
---- |
436 |
- buildutil/ax_cxx_compile_stdcxx.m4 | 948 +++++++++++++++++++++++++++++ |
437 |
- configure.ac | 3 +- |
438 |
- 2 files changed, 950 insertions(+), 1 deletion(-) |
439 |
- create mode 100644 buildutil/ax_cxx_compile_stdcxx.m4 |
440 |
- |
441 |
-diff --git a/buildutil/ax_cxx_compile_stdcxx.m4 b/buildutil/ax_cxx_compile_stdcxx.m4 |
442 |
-new file mode 100644 |
443 |
-index 00000000..9e9eaeda |
444 |
---- /dev/null |
445 |
-+++ b/buildutil/ax_cxx_compile_stdcxx.m4 |
446 |
-@@ -0,0 +1,948 @@ |
447 |
-+# =========================================================================== |
448 |
-+# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html |
449 |
-+# =========================================================================== |
450 |
-+# |
451 |
-+# SYNOPSIS |
452 |
-+# |
453 |
-+# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional]) |
454 |
-+# |
455 |
-+# DESCRIPTION |
456 |
-+# |
457 |
-+# Check for baseline language coverage in the compiler for the specified |
458 |
-+# version of the C++ standard. If necessary, add switches to CXX and |
459 |
-+# CXXCPP to enable support. VERSION may be '11' (for the C++11 standard) |
460 |
-+# or '14' (for the C++14 standard). |
461 |
-+# |
462 |
-+# The second argument, if specified, indicates whether you insist on an |
463 |
-+# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. |
464 |
-+# -std=c++11). If neither is specified, you get whatever works, with |
465 |
-+# preference for an extended mode. |
466 |
-+# |
467 |
-+# The third argument, if specified 'mandatory' or if left unspecified, |
468 |
-+# indicates that baseline support for the specified C++ standard is |
469 |
-+# required and that the macro should error out if no mode with that |
470 |
-+# support is found. If specified 'optional', then configuration proceeds |
471 |
-+# regardless, after defining HAVE_CXX${VERSION} if and only if a |
472 |
-+# supporting mode is found. |
473 |
-+# |
474 |
-+# LICENSE |
475 |
-+# |
476 |
-+# Copyright (c) 2008 Benjamin Kosnik <bkoz@××××××.com> |
477 |
-+# Copyright (c) 2012 Zack Weinberg <zackw@×××××.com> |
478 |
-+# Copyright (c) 2013 Roy Stogner <roystgnr@×××××××××××.edu> |
479 |
-+# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@××××××.com> |
480 |
-+# Copyright (c) 2015 Paul Norman <penorman@×××.com> |
481 |
-+# Copyright (c) 2015 Moritz Klammler <moritz@××××××××.eu> |
482 |
-+# Copyright (c) 2016, 2018 Krzesimir Nowak <qdlacz@×××××.com> |
483 |
-+# |
484 |
-+# Copying and distribution of this file, with or without modification, are |
485 |
-+# permitted in any medium without royalty provided the copyright notice |
486 |
-+# and this notice are preserved. This file is offered as-is, without any |
487 |
-+# warranty. |
488 |
-+ |
489 |
-+#serial 10 |
490 |
-+ |
491 |
-+dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro |
492 |
-+dnl (serial version number 13). |
493 |
-+ |
494 |
-+AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl |
495 |
-+ m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"], |
496 |
-+ [$1], [14], [ax_cxx_compile_alternatives="14 1y"], |
497 |
-+ [$1], [17], [ax_cxx_compile_alternatives="17 1z"], |
498 |
-+ [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl |
499 |
-+ m4_if([$2], [], [], |
500 |
-+ [$2], [ext], [], |
501 |
-+ [$2], [noext], [], |
502 |
-+ [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl |
503 |
-+ m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true], |
504 |
-+ [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true], |
505 |
-+ [$3], [optional], [ax_cxx_compile_cxx$1_required=false], |
506 |
-+ [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])]) |
507 |
-+ AC_LANG_PUSH([C++])dnl |
508 |
-+ ac_success=no |
509 |
-+ |
510 |
-+ m4_if([$2], [noext], [], [dnl |
511 |
-+ if test x$ac_success = xno; then |
512 |
-+ for alternative in ${ax_cxx_compile_alternatives}; do |
513 |
-+ switch="-std=gnu++${alternative}" |
514 |
-+ cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) |
515 |
-+ AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, |
516 |
-+ $cachevar, |
517 |
-+ [ac_save_CXX="$CXX" |
518 |
-+ CXX="$CXX $switch" |
519 |
-+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], |
520 |
-+ [eval $cachevar=yes], |
521 |
-+ [eval $cachevar=no]) |
522 |
-+ CXX="$ac_save_CXX"]) |
523 |
-+ if eval test x\$$cachevar = xyes; then |
524 |
-+ CXX="$CXX $switch" |
525 |
-+ if test -n "$CXXCPP" ; then |
526 |
-+ CXXCPP="$CXXCPP $switch" |
527 |
-+ fi |
528 |
-+ ac_success=yes |
529 |
-+ break |
530 |
-+ fi |
531 |
-+ done |
532 |
-+ fi]) |
533 |
-+ |
534 |
-+ m4_if([$2], [ext], [], [dnl |
535 |
-+ if test x$ac_success = xno; then |
536 |
-+ dnl HP's aCC needs +std=c++11 according to: |
537 |
-+ dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf |
538 |
-+ dnl Cray's crayCC needs "-h std=c++11" |
539 |
-+ for alternative in ${ax_cxx_compile_alternatives}; do |
540 |
-+ for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do |
541 |
-+ cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) |
542 |
-+ AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, |
543 |
-+ $cachevar, |
544 |
-+ [ac_save_CXX="$CXX" |
545 |
-+ CXX="$CXX $switch" |
546 |
-+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], |
547 |
-+ [eval $cachevar=yes], |
548 |
-+ [eval $cachevar=no]) |
549 |
-+ CXX="$ac_save_CXX"]) |
550 |
-+ if eval test x\$$cachevar = xyes; then |
551 |
-+ CXX="$CXX $switch" |
552 |
-+ if test -n "$CXXCPP" ; then |
553 |
-+ CXXCPP="$CXXCPP $switch" |
554 |
-+ fi |
555 |
-+ ac_success=yes |
556 |
-+ break |
557 |
-+ fi |
558 |
-+ done |
559 |
-+ if test x$ac_success = xyes; then |
560 |
-+ break |
561 |
-+ fi |
562 |
-+ done |
563 |
-+ fi]) |
564 |
-+ AC_LANG_POP([C++]) |
565 |
-+ if test x$ax_cxx_compile_cxx$1_required = xtrue; then |
566 |
-+ if test x$ac_success = xno; then |
567 |
-+ AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.]) |
568 |
-+ fi |
569 |
-+ fi |
570 |
-+ if test x$ac_success = xno; then |
571 |
-+ HAVE_CXX$1=0 |
572 |
-+ AC_MSG_NOTICE([No compiler with C++$1 support was found]) |
573 |
-+ else |
574 |
-+ HAVE_CXX$1=1 |
575 |
-+ AC_DEFINE(HAVE_CXX$1,1, |
576 |
-+ [define if the compiler supports basic C++$1 syntax]) |
577 |
-+ fi |
578 |
-+ AC_SUBST(HAVE_CXX$1) |
579 |
-+]) |
580 |
-+ |
581 |
-+ |
582 |
-+dnl Test body for checking C++11 support |
583 |
-+ |
584 |
-+m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], |
585 |
-+ _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 |
586 |
-+) |
587 |
-+ |
588 |
-+ |
589 |
-+dnl Test body for checking C++14 support |
590 |
-+ |
591 |
-+m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], |
592 |
-+ _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 |
593 |
-+ _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 |
594 |
-+) |
595 |
-+ |
596 |
-+m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17], |
597 |
-+ _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 |
598 |
-+ _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 |
599 |
-+ _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 |
600 |
-+) |
601 |
-+ |
602 |
-+dnl Tests for new features in C++11 |
603 |
-+ |
604 |
-+m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ |
605 |
-+ |
606 |
-+// If the compiler admits that it is not ready for C++11, why torture it? |
607 |
-+// Hopefully, this will speed up the test. |
608 |
-+ |
609 |
-+#ifndef __cplusplus |
610 |
-+ |
611 |
-+#error "This is not a C++ compiler" |
612 |
-+ |
613 |
-+#elif __cplusplus < 201103L |
614 |
-+ |
615 |
-+#error "This is not a C++11 compiler" |
616 |
-+ |
617 |
-+#else |
618 |
-+ |
619 |
-+namespace cxx11 |
620 |
-+{ |
621 |
-+ |
622 |
-+ namespace test_static_assert |
623 |
-+ { |
624 |
-+ |
625 |
-+ template <typename T> |
626 |
-+ struct check |
627 |
-+ { |
628 |
-+ static_assert(sizeof(int) <= sizeof(T), "not big enough"); |
629 |
-+ }; |
630 |
-+ |
631 |
-+ } |
632 |
-+ |
633 |
-+ namespace test_final_override |
634 |
-+ { |
635 |
-+ |
636 |
-+ struct Base |
637 |
-+ { |
638 |
-+ virtual void f() {} |
639 |
-+ }; |
640 |
-+ |
641 |
-+ struct Derived : public Base |
642 |
-+ { |
643 |
-+ virtual void f() override {} |
644 |
-+ }; |
645 |
-+ |
646 |
-+ } |
647 |
-+ |
648 |
-+ namespace test_double_right_angle_brackets |
649 |
-+ { |
650 |
-+ |
651 |
-+ template < typename T > |
652 |
-+ struct check {}; |
653 |
-+ |
654 |
-+ typedef check<void> single_type; |
655 |
-+ typedef check<check<void>> double_type; |
656 |
-+ typedef check<check<check<void>>> triple_type; |
657 |
-+ typedef check<check<check<check<void>>>> quadruple_type; |
658 |
-+ |
659 |
-+ } |
660 |
-+ |
661 |
-+ namespace test_decltype |
662 |
-+ { |
663 |
-+ |
664 |
-+ int |
665 |
-+ f() |
666 |
-+ { |
667 |
-+ int a = 1; |
668 |
-+ decltype(a) b = 2; |
669 |
-+ return a + b; |
670 |
-+ } |
671 |
-+ |
672 |
-+ } |
673 |
-+ |
674 |
-+ namespace test_type_deduction |
675 |
-+ { |
676 |
-+ |
677 |
-+ template < typename T1, typename T2 > |
678 |
-+ struct is_same |
679 |
-+ { |
680 |
-+ static const bool value = false; |
681 |
-+ }; |
682 |
-+ |
683 |
-+ template < typename T > |
684 |
-+ struct is_same<T, T> |
685 |
-+ { |
686 |
-+ static const bool value = true; |
687 |
-+ }; |
688 |
-+ |
689 |
-+ template < typename T1, typename T2 > |
690 |
-+ auto |
691 |
-+ add(T1 a1, T2 a2) -> decltype(a1 + a2) |
692 |
-+ { |
693 |
-+ return a1 + a2; |
694 |
-+ } |
695 |
-+ |
696 |
-+ int |
697 |
-+ test(const int c, volatile int v) |
698 |
-+ { |
699 |
-+ static_assert(is_same<int, decltype(0)>::value == true, ""); |
700 |
-+ static_assert(is_same<int, decltype(c)>::value == false, ""); |
701 |
-+ static_assert(is_same<int, decltype(v)>::value == false, ""); |
702 |
-+ auto ac = c; |
703 |
-+ auto av = v; |
704 |
-+ auto sumi = ac + av + 'x'; |
705 |
-+ auto sumf = ac + av + 1.0; |
706 |
-+ static_assert(is_same<int, decltype(ac)>::value == true, ""); |
707 |
-+ static_assert(is_same<int, decltype(av)>::value == true, ""); |
708 |
-+ static_assert(is_same<int, decltype(sumi)>::value == true, ""); |
709 |
-+ static_assert(is_same<int, decltype(sumf)>::value == false, ""); |
710 |
-+ static_assert(is_same<int, decltype(add(c, v))>::value == true, ""); |
711 |
-+ return (sumf > 0.0) ? sumi : add(c, v); |
712 |
-+ } |
713 |
-+ |
714 |
-+ } |
715 |
-+ |
716 |
-+ namespace test_noexcept |
717 |
-+ { |
718 |
-+ |
719 |
-+ int f() { return 0; } |
720 |
-+ int g() noexcept { return 0; } |
721 |
-+ |
722 |
-+ static_assert(noexcept(f()) == false, ""); |
723 |
-+ static_assert(noexcept(g()) == true, ""); |
724 |
-+ |
725 |
-+ } |
726 |
-+ |
727 |
-+ namespace test_constexpr |
728 |
-+ { |
729 |
-+ |
730 |
-+ template < typename CharT > |
731 |
-+ unsigned long constexpr |
732 |
-+ strlen_c_r(const CharT *const s, const unsigned long acc) noexcept |
733 |
-+ { |
734 |
-+ return *s ? strlen_c_r(s + 1, acc + 1) : acc; |
735 |
-+ } |
736 |
-+ |
737 |
-+ template < typename CharT > |
738 |
-+ unsigned long constexpr |
739 |
-+ strlen_c(const CharT *const s) noexcept |
740 |
-+ { |
741 |
-+ return strlen_c_r(s, 0UL); |
742 |
-+ } |
743 |
-+ |
744 |
-+ static_assert(strlen_c("") == 0UL, ""); |
745 |
-+ static_assert(strlen_c("1") == 1UL, ""); |
746 |
-+ static_assert(strlen_c("example") == 7UL, ""); |
747 |
-+ static_assert(strlen_c("another\0example") == 7UL, ""); |
748 |
-+ |
749 |
-+ } |
750 |
-+ |
751 |
-+ namespace test_rvalue_references |
752 |
-+ { |
753 |
-+ |
754 |
-+ template < int N > |
755 |
-+ struct answer |
756 |
-+ { |
757 |
-+ static constexpr int value = N; |
758 |
-+ }; |
759 |
-+ |
760 |
-+ answer<1> f(int&) { return answer<1>(); } |
761 |
-+ answer<2> f(const int&) { return answer<2>(); } |
762 |
-+ answer<3> f(int&&) { return answer<3>(); } |
763 |
-+ |
764 |
-+ void |
765 |
-+ test() |
766 |
-+ { |
767 |
-+ int i = 0; |
768 |
-+ const int c = 0; |
769 |
-+ static_assert(decltype(f(i))::value == 1, ""); |
770 |
-+ static_assert(decltype(f(c))::value == 2, ""); |
771 |
-+ static_assert(decltype(f(0))::value == 3, ""); |
772 |
-+ } |
773 |
-+ |
774 |
-+ } |
775 |
-+ |
776 |
-+ namespace test_uniform_initialization |
777 |
-+ { |
778 |
-+ |
779 |
-+ struct test |
780 |
-+ { |
781 |
-+ static const int zero {}; |
782 |
-+ static const int one {1}; |
783 |
-+ }; |
784 |
-+ |
785 |
-+ static_assert(test::zero == 0, ""); |
786 |
-+ static_assert(test::one == 1, ""); |
787 |
-+ |
788 |
-+ } |
789 |
-+ |
790 |
-+ namespace test_lambdas |
791 |
-+ { |
792 |
-+ |
793 |
-+ void |
794 |
-+ test1() |
795 |
-+ { |
796 |
-+ auto lambda1 = [](){}; |
797 |
-+ auto lambda2 = lambda1; |
798 |
-+ lambda1(); |
799 |
-+ lambda2(); |
800 |
-+ } |
801 |
-+ |
802 |
-+ int |
803 |
-+ test2() |
804 |
-+ { |
805 |
-+ auto a = [](int i, int j){ return i + j; }(1, 2); |
806 |
-+ auto b = []() -> int { return '0'; }(); |
807 |
-+ auto c = [=](){ return a + b; }(); |
808 |
-+ auto d = [&](){ return c; }(); |
809 |
-+ auto e = [a, &b](int x) mutable { |
810 |
-+ const auto identity = [](int y){ return y; }; |
811 |
-+ for (auto i = 0; i < a; ++i) |
812 |
-+ a += b--; |
813 |
-+ return x + identity(a + b); |
814 |
-+ }(0); |
815 |
-+ return a + b + c + d + e; |
816 |
-+ } |
817 |
-+ |
818 |
-+ int |
819 |
-+ test3() |
820 |
-+ { |
821 |
-+ const auto nullary = [](){ return 0; }; |
822 |
-+ const auto unary = [](int x){ return x; }; |
823 |
-+ using nullary_t = decltype(nullary); |
824 |
-+ using unary_t = decltype(unary); |
825 |
-+ const auto higher1st = [](nullary_t f){ return f(); }; |
826 |
-+ const auto higher2nd = [unary](nullary_t f1){ |
827 |
-+ return [unary, f1](unary_t f2){ return f2(unary(f1())); }; |
828 |
-+ }; |
829 |
-+ return higher1st(nullary) + higher2nd(nullary)(unary); |
830 |
-+ } |
831 |
-+ |
832 |
-+ } |
833 |
-+ |
834 |
-+ namespace test_variadic_templates |
835 |
-+ { |
836 |
-+ |
837 |
-+ template <int...> |
838 |
-+ struct sum; |
839 |
-+ |
840 |
-+ template <int N0, int... N1toN> |
841 |
-+ struct sum<N0, N1toN...> |
842 |
-+ { |
843 |
-+ static constexpr auto value = N0 + sum<N1toN...>::value; |
844 |
-+ }; |
845 |
-+ |
846 |
-+ template <> |
847 |
-+ struct sum<> |
848 |
-+ { |
849 |
-+ static constexpr auto value = 0; |
850 |
-+ }; |
851 |
-+ |
852 |
-+ static_assert(sum<>::value == 0, ""); |
853 |
-+ static_assert(sum<1>::value == 1, ""); |
854 |
-+ static_assert(sum<23>::value == 23, ""); |
855 |
-+ static_assert(sum<1, 2>::value == 3, ""); |
856 |
-+ static_assert(sum<5, 5, 11>::value == 21, ""); |
857 |
-+ static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); |
858 |
-+ |
859 |
-+ } |
860 |
-+ |
861 |
-+ // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae |
862 |
-+ // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function |
863 |
-+ // because of this. |
864 |
-+ namespace test_template_alias_sfinae |
865 |
-+ { |
866 |
-+ |
867 |
-+ struct foo {}; |
868 |
-+ |
869 |
-+ template<typename T> |
870 |
-+ using member = typename T::member_type; |
871 |
-+ |
872 |
-+ template<typename T> |
873 |
-+ void func(...) {} |
874 |
-+ |
875 |
-+ template<typename T> |
876 |
-+ void func(member<T>*) {} |
877 |
-+ |
878 |
-+ void test(); |
879 |
-+ |
880 |
-+ void test() { func<foo>(0); } |
881 |
-+ |
882 |
-+ } |
883 |
-+ |
884 |
-+} // namespace cxx11 |
885 |
-+ |
886 |
-+#endif // __cplusplus >= 201103L |
887 |
-+ |
888 |
-+]]) |
889 |
-+ |
890 |
-+ |
891 |
-+dnl Tests for new features in C++14 |
892 |
-+ |
893 |
-+m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[ |
894 |
-+ |
895 |
-+// If the compiler admits that it is not ready for C++14, why torture it? |
896 |
-+// Hopefully, this will speed up the test. |
897 |
-+ |
898 |
-+#ifndef __cplusplus |
899 |
-+ |
900 |
-+#error "This is not a C++ compiler" |
901 |
-+ |
902 |
-+#elif __cplusplus < 201402L |
903 |
-+ |
904 |
-+#error "This is not a C++14 compiler" |
905 |
-+ |
906 |
-+#else |
907 |
-+ |
908 |
-+namespace cxx14 |
909 |
-+{ |
910 |
-+ |
911 |
-+ namespace test_polymorphic_lambdas |
912 |
-+ { |
913 |
-+ |
914 |
-+ int |
915 |
-+ test() |
916 |
-+ { |
917 |
-+ const auto lambda = [](auto&&... args){ |
918 |
-+ const auto istiny = [](auto x){ |
919 |
-+ return (sizeof(x) == 1UL) ? 1 : 0; |
920 |
-+ }; |
921 |
-+ const int aretiny[] = { istiny(args)... }; |
922 |
-+ return aretiny[0]; |
923 |
-+ }; |
924 |
-+ return lambda(1, 1L, 1.0f, '1'); |
925 |
-+ } |
926 |
-+ |
927 |
-+ } |
928 |
-+ |
929 |
-+ namespace test_binary_literals |
930 |
-+ { |
931 |
-+ |
932 |
-+ constexpr auto ivii = 0b0000000000101010; |
933 |
-+ static_assert(ivii == 42, "wrong value"); |
934 |
-+ |
935 |
-+ } |
936 |
-+ |
937 |
-+ namespace test_generalized_constexpr |
938 |
-+ { |
939 |
-+ |
940 |
-+ template < typename CharT > |
941 |
-+ constexpr unsigned long |
942 |
-+ strlen_c(const CharT *const s) noexcept |
943 |
-+ { |
944 |
-+ auto length = 0UL; |
945 |
-+ for (auto p = s; *p; ++p) |
946 |
-+ ++length; |
947 |
-+ return length; |
948 |
-+ } |
949 |
-+ |
950 |
-+ static_assert(strlen_c("") == 0UL, ""); |
951 |
-+ static_assert(strlen_c("x") == 1UL, ""); |
952 |
-+ static_assert(strlen_c("test") == 4UL, ""); |
953 |
-+ static_assert(strlen_c("another\0test") == 7UL, ""); |
954 |
-+ |
955 |
-+ } |
956 |
-+ |
957 |
-+ namespace test_lambda_init_capture |
958 |
-+ { |
959 |
-+ |
960 |
-+ int |
961 |
-+ test() |
962 |
-+ { |
963 |
-+ auto x = 0; |
964 |
-+ const auto lambda1 = [a = x](int b){ return a + b; }; |
965 |
-+ const auto lambda2 = [a = lambda1(x)](){ return a; }; |
966 |
-+ return lambda2(); |
967 |
-+ } |
968 |
-+ |
969 |
-+ } |
970 |
-+ |
971 |
-+ namespace test_digit_separators |
972 |
-+ { |
973 |
-+ |
974 |
-+ constexpr auto ten_million = 100'000'000; |
975 |
-+ static_assert(ten_million == 100000000, ""); |
976 |
-+ |
977 |
-+ } |
978 |
-+ |
979 |
-+ namespace test_return_type_deduction |
980 |
-+ { |
981 |
-+ |
982 |
-+ auto f(int& x) { return x; } |
983 |
-+ decltype(auto) g(int& x) { return x; } |
984 |
-+ |
985 |
-+ template < typename T1, typename T2 > |
986 |
-+ struct is_same |
987 |
-+ { |
988 |
-+ static constexpr auto value = false; |
989 |
-+ }; |
990 |
-+ |
991 |
-+ template < typename T > |
992 |
-+ struct is_same<T, T> |
993 |
-+ { |
994 |
-+ static constexpr auto value = true; |
995 |
-+ }; |
996 |
-+ |
997 |
-+ int |
998 |
-+ test() |
999 |
-+ { |
1000 |
-+ auto x = 0; |
1001 |
-+ static_assert(is_same<int, decltype(f(x))>::value, ""); |
1002 |
-+ static_assert(is_same<int&, decltype(g(x))>::value, ""); |
1003 |
-+ return x; |
1004 |
-+ } |
1005 |
-+ |
1006 |
-+ } |
1007 |
-+ |
1008 |
-+} // namespace cxx14 |
1009 |
-+ |
1010 |
-+#endif // __cplusplus >= 201402L |
1011 |
-+ |
1012 |
-+]]) |
1013 |
-+ |
1014 |
-+ |
1015 |
-+dnl Tests for new features in C++17 |
1016 |
-+ |
1017 |
-+m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[ |
1018 |
-+ |
1019 |
-+// If the compiler admits that it is not ready for C++17, why torture it? |
1020 |
-+// Hopefully, this will speed up the test. |
1021 |
-+ |
1022 |
-+#ifndef __cplusplus |
1023 |
-+ |
1024 |
-+#error "This is not a C++ compiler" |
1025 |
-+ |
1026 |
-+#elif __cplusplus < 201703L |
1027 |
-+ |
1028 |
-+#error "This is not a C++17 compiler" |
1029 |
-+ |
1030 |
-+#else |
1031 |
-+ |
1032 |
-+#include <initializer_list> |
1033 |
-+#include <utility> |
1034 |
-+#include <type_traits> |
1035 |
-+ |
1036 |
-+namespace cxx17 |
1037 |
-+{ |
1038 |
-+ |
1039 |
-+ namespace test_constexpr_lambdas |
1040 |
-+ { |
1041 |
-+ |
1042 |
-+ constexpr int foo = [](){return 42;}(); |
1043 |
-+ |
1044 |
-+ } |
1045 |
-+ |
1046 |
-+ namespace test::nested_namespace::definitions |
1047 |
-+ { |
1048 |
-+ |
1049 |
-+ } |
1050 |
-+ |
1051 |
-+ namespace test_fold_expression |
1052 |
-+ { |
1053 |
-+ |
1054 |
-+ template<typename... Args> |
1055 |
-+ int multiply(Args... args) |
1056 |
-+ { |
1057 |
-+ return (args * ... * 1); |
1058 |
-+ } |
1059 |
-+ |
1060 |
-+ template<typename... Args> |
1061 |
-+ bool all(Args... args) |
1062 |
-+ { |
1063 |
-+ return (args && ...); |
1064 |
-+ } |
1065 |
-+ |
1066 |
-+ } |
1067 |
-+ |
1068 |
-+ namespace test_extended_static_assert |
1069 |
-+ { |
1070 |
-+ |
1071 |
-+ static_assert (true); |
1072 |
-+ |
1073 |
-+ } |
1074 |
-+ |
1075 |
-+ namespace test_auto_brace_init_list |
1076 |
-+ { |
1077 |
-+ |
1078 |
-+ auto foo = {5}; |
1079 |
-+ auto bar {5}; |
1080 |
-+ |
1081 |
-+ static_assert(std::is_same<std::initializer_list<int>, decltype(foo)>::value); |
1082 |
-+ static_assert(std::is_same<int, decltype(bar)>::value); |
1083 |
-+ } |
1084 |
-+ |
1085 |
-+ namespace test_typename_in_template_template_parameter |
1086 |
-+ { |
1087 |
-+ |
1088 |
-+ template<template<typename> typename X> struct D; |
1089 |
-+ |
1090 |
-+ } |
1091 |
-+ |
1092 |
-+ namespace test_fallthrough_nodiscard_maybe_unused_attributes |
1093 |
-+ { |
1094 |
-+ |
1095 |
-+ int f1() |
1096 |
-+ { |
1097 |
-+ return 42; |
1098 |
-+ } |
1099 |
-+ |
1100 |
-+ [[nodiscard]] int f2() |
1101 |
-+ { |
1102 |
-+ [[maybe_unused]] auto unused = f1(); |
1103 |
-+ |
1104 |
-+ switch (f1()) |
1105 |
-+ { |
1106 |
-+ case 17: |
1107 |
-+ f1(); |
1108 |
-+ [[fallthrough]]; |
1109 |
-+ case 42: |
1110 |
-+ f1(); |
1111 |
-+ } |
1112 |
-+ return f1(); |
1113 |
-+ } |
1114 |
-+ |
1115 |
-+ } |
1116 |
-+ |
1117 |
-+ namespace test_extended_aggregate_initialization |
1118 |
-+ { |
1119 |
-+ |
1120 |
-+ struct base1 |
1121 |
-+ { |
1122 |
-+ int b1, b2 = 42; |
1123 |
-+ }; |
1124 |
-+ |
1125 |
-+ struct base2 |
1126 |
-+ { |
1127 |
-+ base2() { |
1128 |
-+ b3 = 42; |
1129 |
-+ } |
1130 |
-+ int b3; |
1131 |
-+ }; |
1132 |
-+ |
1133 |
-+ struct derived : base1, base2 |
1134 |
-+ { |
1135 |
-+ int d; |
1136 |
-+ }; |
1137 |
-+ |
1138 |
-+ derived d1 {{1, 2}, {}, 4}; // full initialization |
1139 |
-+ derived d2 {{}, {}, 4}; // value-initialized bases |
1140 |
-+ |
1141 |
-+ } |
1142 |
-+ |
1143 |
-+ namespace test_general_range_based_for_loop |
1144 |
-+ { |
1145 |
-+ |
1146 |
-+ struct iter |
1147 |
-+ { |
1148 |
-+ int i; |
1149 |
-+ |
1150 |
-+ int& operator* () |
1151 |
-+ { |
1152 |
-+ return i; |
1153 |
-+ } |
1154 |
-+ |
1155 |
-+ const int& operator* () const |
1156 |
-+ { |
1157 |
-+ return i; |
1158 |
-+ } |
1159 |
-+ |
1160 |
-+ iter& operator++() |
1161 |
-+ { |
1162 |
-+ ++i; |
1163 |
-+ return *this; |
1164 |
-+ } |
1165 |
-+ }; |
1166 |
-+ |
1167 |
-+ struct sentinel |
1168 |
-+ { |
1169 |
-+ int i; |
1170 |
-+ }; |
1171 |
-+ |
1172 |
-+ bool operator== (const iter& i, const sentinel& s) |
1173 |
-+ { |
1174 |
-+ return i.i == s.i; |
1175 |
-+ } |
1176 |
-+ |
1177 |
-+ bool operator!= (const iter& i, const sentinel& s) |
1178 |
-+ { |
1179 |
-+ return !(i == s); |
1180 |
-+ } |
1181 |
-+ |
1182 |
-+ struct range |
1183 |
-+ { |
1184 |
-+ iter begin() const |
1185 |
-+ { |
1186 |
-+ return {0}; |
1187 |
-+ } |
1188 |
-+ |
1189 |
-+ sentinel end() const |
1190 |
-+ { |
1191 |
-+ return {5}; |
1192 |
-+ } |
1193 |
-+ }; |
1194 |
-+ |
1195 |
-+ void f() |
1196 |
-+ { |
1197 |
-+ range r {}; |
1198 |
-+ |
1199 |
-+ for (auto i : r) |
1200 |
-+ { |
1201 |
-+ [[maybe_unused]] auto v = i; |
1202 |
-+ } |
1203 |
-+ } |
1204 |
-+ |
1205 |
-+ } |
1206 |
-+ |
1207 |
-+ namespace test_lambda_capture_asterisk_this_by_value |
1208 |
-+ { |
1209 |
-+ |
1210 |
-+ struct t |
1211 |
-+ { |
1212 |
-+ int i; |
1213 |
-+ int foo() |
1214 |
-+ { |
1215 |
-+ return [*this]() |
1216 |
-+ { |
1217 |
-+ return i; |
1218 |
-+ }(); |
1219 |
-+ } |
1220 |
-+ }; |
1221 |
-+ |
1222 |
-+ } |
1223 |
-+ |
1224 |
-+ namespace test_enum_class_construction |
1225 |
-+ { |
1226 |
-+ |
1227 |
-+ enum class byte : unsigned char |
1228 |
-+ {}; |
1229 |
-+ |
1230 |
-+ byte foo {42}; |
1231 |
-+ |
1232 |
-+ } |
1233 |
-+ |
1234 |
-+ namespace test_constexpr_if |
1235 |
-+ { |
1236 |
-+ |
1237 |
-+ template <bool cond> |
1238 |
-+ int f () |
1239 |
-+ { |
1240 |
-+ if constexpr(cond) |
1241 |
-+ { |
1242 |
-+ return 13; |
1243 |
-+ } |
1244 |
-+ else |
1245 |
-+ { |
1246 |
-+ return 42; |
1247 |
-+ } |
1248 |
-+ } |
1249 |
-+ |
1250 |
-+ } |
1251 |
-+ |
1252 |
-+ namespace test_selection_statement_with_initializer |
1253 |
-+ { |
1254 |
-+ |
1255 |
-+ int f() |
1256 |
-+ { |
1257 |
-+ return 13; |
1258 |
-+ } |
1259 |
-+ |
1260 |
-+ int f2() |
1261 |
-+ { |
1262 |
-+ if (auto i = f(); i > 0) |
1263 |
-+ { |
1264 |
-+ return 3; |
1265 |
-+ } |
1266 |
-+ |
1267 |
-+ switch (auto i = f(); i + 4) |
1268 |
-+ { |
1269 |
-+ case 17: |
1270 |
-+ return 2; |
1271 |
-+ |
1272 |
-+ default: |
1273 |
-+ return 1; |
1274 |
-+ } |
1275 |
-+ } |
1276 |
-+ |
1277 |
-+ } |
1278 |
-+ |
1279 |
-+ namespace test_template_argument_deduction_for_class_templates |
1280 |
-+ { |
1281 |
-+ |
1282 |
-+ template <typename T1, typename T2> |
1283 |
-+ struct pair |
1284 |
-+ { |
1285 |
-+ pair (T1 p1, T2 p2) |
1286 |
-+ : m1 {p1}, |
1287 |
-+ m2 {p2} |
1288 |
-+ {} |
1289 |
-+ |
1290 |
-+ T1 m1; |
1291 |
-+ T2 m2; |
1292 |
-+ }; |
1293 |
-+ |
1294 |
-+ void f() |
1295 |
-+ { |
1296 |
-+ [[maybe_unused]] auto p = pair{13, 42u}; |
1297 |
-+ } |
1298 |
-+ |
1299 |
-+ } |
1300 |
-+ |
1301 |
-+ namespace test_non_type_auto_template_parameters |
1302 |
-+ { |
1303 |
-+ |
1304 |
-+ template <auto n> |
1305 |
-+ struct B |
1306 |
-+ {}; |
1307 |
-+ |
1308 |
-+ B<5> b1; |
1309 |
-+ B<'a'> b2; |
1310 |
-+ |
1311 |
-+ } |
1312 |
-+ |
1313 |
-+ namespace test_structured_bindings |
1314 |
-+ { |
1315 |
-+ |
1316 |
-+ int arr[2] = { 1, 2 }; |
1317 |
-+ std::pair<int, int> pr = { 1, 2 }; |
1318 |
-+ |
1319 |
-+ auto f1() -> int(&)[2] |
1320 |
-+ { |
1321 |
-+ return arr; |
1322 |
-+ } |
1323 |
-+ |
1324 |
-+ auto f2() -> std::pair<int, int>& |
1325 |
-+ { |
1326 |
-+ return pr; |
1327 |
-+ } |
1328 |
-+ |
1329 |
-+ struct S |
1330 |
-+ { |
1331 |
-+ int x1 : 2; |
1332 |
-+ volatile double y1; |
1333 |
-+ }; |
1334 |
-+ |
1335 |
-+ S f3() |
1336 |
-+ { |
1337 |
-+ return {}; |
1338 |
-+ } |
1339 |
-+ |
1340 |
-+ auto [ x1, y1 ] = f1(); |
1341 |
-+ auto& [ xr1, yr1 ] = f1(); |
1342 |
-+ auto [ x2, y2 ] = f2(); |
1343 |
-+ auto& [ xr2, yr2 ] = f2(); |
1344 |
-+ const auto [ x3, y3 ] = f3(); |
1345 |
-+ |
1346 |
-+ } |
1347 |
-+ |
1348 |
-+ namespace test_exception_spec_type_system |
1349 |
-+ { |
1350 |
-+ |
1351 |
-+ struct Good {}; |
1352 |
-+ struct Bad {}; |
1353 |
-+ |
1354 |
-+ void g1() noexcept; |
1355 |
-+ void g2(); |
1356 |
-+ |
1357 |
-+ template<typename T> |
1358 |
-+ Bad |
1359 |
-+ f(T*, T*); |
1360 |
-+ |
1361 |
-+ template<typename T1, typename T2> |
1362 |
-+ Good |
1363 |
-+ f(T1*, T2*); |
1364 |
-+ |
1365 |
-+ static_assert (std::is_same_v<Good, decltype(f(g1, g2))>); |
1366 |
-+ |
1367 |
-+ } |
1368 |
-+ |
1369 |
-+ namespace test_inline_variables |
1370 |
-+ { |
1371 |
-+ |
1372 |
-+ template<class T> void f(T) |
1373 |
-+ {} |
1374 |
-+ |
1375 |
-+ template<class T> inline T g(T) |
1376 |
-+ { |
1377 |
-+ return T{}; |
1378 |
-+ } |
1379 |
-+ |
1380 |
-+ template<> inline void f<>(int) |
1381 |
-+ {} |
1382 |
-+ |
1383 |
-+ template<> int g<>(int) |
1384 |
-+ { |
1385 |
-+ return 5; |
1386 |
-+ } |
1387 |
-+ |
1388 |
-+ } |
1389 |
-+ |
1390 |
-+} // namespace cxx17 |
1391 |
-+ |
1392 |
-+#endif // __cplusplus < 201703L |
1393 |
-+ |
1394 |
-+]]) |
1395 |
-diff --git a/configure.ac b/configure.ac |
1396 |
-index cd678f1c..3d50641e 100644 |
1397 |
---- a/configure.ac |
1398 |
-+++ b/configure.ac |
1399 |
-@@ -5,6 +5,7 @@ AC_INIT([polkit], [0.116], [http://lists.freedesktop.org/mailman/listinfo/polkit |
1400 |
- AM_INIT_AUTOMAKE([]) |
1401 |
- AC_CONFIG_HEADERS(config.h) |
1402 |
- AC_CONFIG_MACRO_DIR([buildutil]) |
1403 |
-+m4_include([buildutil/ax_cxx_compile_stdcxx.m4]) |
1404 |
- AM_MAINTAINER_MODE |
1405 |
- |
1406 |
- m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
1407 |
-@@ -33,7 +34,7 @@ AC_PROG_LN_S |
1408 |
- AC_SYS_LARGEFILE |
1409 |
- AM_PROG_CC_C_O |
1410 |
- AC_PROG_CXX |
1411 |
--AX_CXX_COMPILE_STDCXX_11() |
1412 |
-+AX_CXX_COMPILE_STDCXX([14], [], [mandatory]) |
1413 |
- |
1414 |
- # Taken from dbus |
1415 |
- AC_ARG_ENABLE(ansi, [ --enable-ansi enable -ansi -pedantic gcc flags],enable_ansi=$enableval,enable_ansi=no) |
1416 |
--- |
1417 |
-GitLab |
1418 |
- |
1419 |
- |
1420 |
-From 14444004e60755d9aa362d30c8909460b8f9b824 Mon Sep 17 00:00:00 2001 |
1421 |
-From: =?UTF-8?q?X=E2=84=B9=20Ruoyao?= <xry111@×××××××××××.wang> |
1422 |
-Date: Mon, 8 Jun 2020 20:46:43 +0800 |
1423 |
-Subject: [PATCH 4/5] remove an unused variable |
1424 |
- |
1425 |
---- |
1426 |
- src/polkitbackend/polkitbackendjsauthority.cpp | 3 --- |
1427 |
- 1 file changed, 3 deletions(-) |
1428 |
- |
1429 |
-diff --git a/src/polkitbackend/polkitbackendjsauthority.cpp b/src/polkitbackend/polkitbackendjsauthority.cpp |
1430 |
-index d5113cb0..61088a1d 100644 |
1431 |
---- a/src/polkitbackend/polkitbackendjsauthority.cpp |
1432 |
-+++ b/src/polkitbackend/polkitbackendjsauthority.cpp |
1433 |
-@@ -470,7 +470,6 @@ static void |
1434 |
- polkit_backend_js_authority_constructed (GObject *object) |
1435 |
- { |
1436 |
- PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (object); |
1437 |
-- gboolean entered_request = FALSE; |
1438 |
- |
1439 |
- authority->priv->cx = JS_NewContext (8L * 1024L * 1024L); |
1440 |
- if (authority->priv->cx == NULL) |
1441 |
-@@ -486,7 +485,6 @@ polkit_backend_js_authority_constructed (GObject *object) |
1442 |
- JS::SetWarningReporter(authority->priv->cx, report_error); |
1443 |
- JS_SetContextPrivate (authority->priv->cx, authority); |
1444 |
- |
1445 |
-- entered_request = TRUE; |
1446 |
- |
1447 |
- { |
1448 |
- JS::RealmOptions compart_opts; |
1449 |
-@@ -552,7 +550,6 @@ polkit_backend_js_authority_constructed (GObject *object) |
1450 |
- setup_file_monitors (authority); |
1451 |
- load_scripts (authority); |
1452 |
- } |
1453 |
-- entered_request = FALSE; |
1454 |
- |
1455 |
- G_OBJECT_CLASS (polkit_backend_js_authority_parent_class)->constructed (object); |
1456 |
- |
1457 |
--- |
1458 |
-GitLab |
1459 |
- |
1460 |
- |
1461 |
-From 3245061595a10644f8d32e48eeaaf6fbf0364c70 Mon Sep 17 00:00:00 2001 |
1462 |
-From: =?UTF-8?q?X=E2=84=B9=20Ruoyao?= <xry111@×××××××××××.wang> |
1463 |
-Date: Mon, 8 Jun 2020 21:25:33 +0800 |
1464 |
-Subject: [PATCH 5/5] do not leak GFile |
1465 |
- |
1466 |
---- |
1467 |
- src/polkitbackend/polkitbackendjsauthority.cpp | 4 ++++ |
1468 |
- 1 file changed, 4 insertions(+) |
1469 |
- |
1470 |
-diff --git a/src/polkitbackend/polkitbackendjsauthority.cpp b/src/polkitbackend/polkitbackendjsauthority.cpp |
1471 |
-index 61088a1d..25bd1f93 100644 |
1472 |
---- a/src/polkitbackend/polkitbackendjsauthority.cpp |
1473 |
-+++ b/src/polkitbackend/polkitbackendjsauthority.cpp |
1474 |
-@@ -311,8 +311,12 @@ load_scripts (PolkitBackendJsAuthority *authority) |
1475 |
- polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), |
1476 |
- "Error compiling script %s", |
1477 |
- filename); |
1478 |
-+ g_object_unref (file); |
1479 |
- continue; |
1480 |
- } |
1481 |
-+ |
1482 |
-+ g_object_unref (file); |
1483 |
-+ |
1484 |
- JS::SourceText<mozilla::Utf8Unit> source; |
1485 |
- if (!source.init (authority->priv->cx, contents, len, |
1486 |
- JS::SourceOwnership::Borrowed)) |
1487 |
--- |
1488 |
-GitLab |
1489 |
- |
1490 |
- |
1491 |
|
1492 |
diff --git a/sys-auth/polkit/polkit-0.116-r2.ebuild b/sys-auth/polkit/polkit-0.117.ebuild |
1493 |
similarity index 94% |
1494 |
rename from sys-auth/polkit/polkit-0.116-r2.ebuild |
1495 |
rename to sys-auth/polkit/polkit-0.117.ebuild |
1496 |
index e1900bb..3fee33e 100644 |
1497 |
--- a/sys-auth/polkit/polkit-0.116-r2.ebuild |
1498 |
+++ b/sys-auth/polkit/polkit-0.117.ebuild |
1499 |
@@ -11,7 +11,7 @@ SRC_URI="https://www.freedesktop.org/software/${PN}/releases/${P}.tar.gz" |
1500 |
|
1501 |
LICENSE="LGPL-2" |
1502 |
SLOT="0" |
1503 |
-#KEYWORDS="amd64 arm arm64 ~mips ppc ppc64 x86" |
1504 |
+KEYWORDS="~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 x86" |
1505 |
IUSE="consolekit elogind examples gtk +introspection jit kde nls pam selinux systemd test" |
1506 |
RESTRICT="!test? ( test )" |
1507 |
|
1508 |
@@ -60,9 +60,6 @@ PATCHES=( |
1509 |
# bug 660880 |
1510 |
"${FILESDIR}"/polkit-0.115-elogind.patch |
1511 |
|
1512 |
- # upstream patch from https://gitlab.freedesktop.org/polkit/polkit/-/merge_requests/48 |
1513 |
- "${FILESDIR}"/polkit-0.116-spidermonkey-68.patch |
1514 |
- |
1515 |
# locally rebased patch |
1516 |
"${FILESDIR}"/polkit-0.116-make-netgroup-support-optional-2.patch |
1517 |
) |