Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-admin/lnav/files/, app-admin/lnav/
Date: Tue, 13 Jul 2021 21:49:28
Message-Id: 1626212946.9a20a3a9e2db20d380c803c01e5f5ec0e19af2ab.sam@gentoo
1 commit: 9a20a3a9e2db20d380c803c01e5f5ec0e19af2ab
2 Author: Randy Barlow <randy <AT> electronsweatshop <DOT> com>
3 AuthorDate: Sun Jun 27 01:31:56 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Tue Jul 13 21:49:06 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9a20a3a9
7
8 app-admin/lnav: Backport to build with gcc-11
9
10 This commit partially[0] backports a patch from upstream[1][2] to
11 allow lnav to build with gcc-11.
12
13 This patch was tested with gcc-10.2.0-r5 and gcc-11.1.0.
14
15 [0] Only the changes to m4/ax_cxx_compile_stdcxx.m4 were necessary
16 to address the gcc-11 fix.
17 [1] https://github.com/tstack/lnav/issues/864
18 [2] https://github.com/tstack/lnav/commit/8f7b08c9c5d1b30ca2b91dbfdb13f4dfa5326f95
19
20 Closes: https://bugs.gentoo.org/786456
21 Package-Manager: Portage-3.0.18, Repoman-3.0.2
22 Signed-off-by: Randy Barlow <randy <AT> electronsweatshop.com>
23 Closes: https://github.com/gentoo/gentoo/pull/20975
24 Signed-off-by: Sam James <sam <AT> gentoo.org>
25
26 app-admin/lnav/files/lnav-0.9.0-bug786456.patch | 561 ++++++++++++++++++++++++
27 app-admin/lnav/lnav-0.9.0-r1.ebuild | 3 +
28 2 files changed, 564 insertions(+)
29
30 diff --git a/app-admin/lnav/files/lnav-0.9.0-bug786456.patch b/app-admin/lnav/files/lnav-0.9.0-bug786456.patch
31 new file mode 100644
32 index 00000000000..e77dd17854e
33 --- /dev/null
34 +++ b/app-admin/lnav/files/lnav-0.9.0-bug786456.patch
35 @@ -0,0 +1,561 @@
36 +From e6d2e2d2b95c27cc85397d4af9528111c5304d02 Mon Sep 17 00:00:00 2001
37 +From: Timothy Stack <timothyshanestack@×××××.com>
38 +Date: Sun, 30 May 2021 13:33:05 -0700
39 +Subject: [PATCH] [logfile] add notes for automatic decisions and fix compile
40 + errors
41 +
42 +Fixes #864
43 +
44 +Signed-off-by: Randy Barlow <randy@×××××××××××××××××.com>
45 +---
46 + m4/ax_cxx_compile_stdcxx.m4 | 462 +++++++++++++++++++++++++++++++++---
47 + src/base/result.h | 1 +
48 + src/logfile.hh | 13 +
49 + src/optional.hpp | 45 +++-
50 + src/pcrepp/pcrepp.hh | 1 +
51 + 5 files changed, 482 insertions(+), 40 deletions(-)
52 +
53 +diff --git a/m4/ax_cxx_compile_stdcxx.m4 b/m4/ax_cxx_compile_stdcxx.m4
54 +index 2c18e49c..9413da62 100644
55 +--- a/m4/ax_cxx_compile_stdcxx.m4
56 ++++ b/m4/ax_cxx_compile_stdcxx.m4
57 +@@ -1,5 +1,5 @@
58 + # ===========================================================================
59 +-# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html
60 ++# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html
61 + # ===========================================================================
62 + #
63 + # SYNOPSIS
64 +@@ -16,7 +16,7 @@
65 + # The second argument, if specified, indicates whether you insist on an
66 + # extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
67 + # -std=c++11). If neither is specified, you get whatever works, with
68 +-# preference for an extended mode.
69 ++# preference for no added switch, and then for an extended mode.
70 + #
71 + # The third argument, if specified 'mandatory' or if left unspecified,
72 + # indicates that baseline support for the specified C++ standard is
73 +@@ -33,21 +33,24 @@
74 + # Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@××××××.com>
75 + # Copyright (c) 2015 Paul Norman <penorman@×××.com>
76 + # Copyright (c) 2015 Moritz Klammler <moritz@××××××××.eu>
77 ++# Copyright (c) 2016, 2018 Krzesimir Nowak <qdlacz@×××××.com>
78 ++# Copyright (c) 2019 Enji Cooper <yaneurabeya@×××××.com>
79 ++# Copyright (c) 2020 Jason Merrill <jason@××××××.com>
80 + #
81 + # Copying and distribution of this file, with or without modification, are
82 + # permitted in any medium without royalty provided the copyright notice
83 + # and this notice are preserved. This file is offered as-is, without any
84 + # warranty.
85 +
86 +-#serial 4
87 ++#serial 12
88 +
89 + dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
90 + dnl (serial version number 13).
91 +
92 + AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
93 +- m4_if([$1], [11], [],
94 +- [$1], [14], [],
95 +- [$1], [17], [m4_fatal([support for C++17 not yet implemented in AX_CXX_COMPILE_STDCXX])],
96 ++ m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"],
97 ++ [$1], [14], [ax_cxx_compile_alternatives="14 1y"],
98 ++ [$1], [17], [ax_cxx_compile_alternatives="17 1z"],
99 + [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl
100 + m4_if([$2], [], [],
101 + [$2], [ext], [],
102 +@@ -59,18 +62,21 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
103 + [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])])
104 + AC_LANG_PUSH([C++])dnl
105 + ac_success=no
106 +- AC_CACHE_CHECK(whether $CXX supports C++$1 features by default,
107 +- ax_cv_cxx_compile_cxx$1,
108 +- [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
109 +- [ax_cv_cxx_compile_cxx$1=yes],
110 +- [ax_cv_cxx_compile_cxx$1=no])])
111 +- if test x$ax_cv_cxx_compile_cxx$1 = xyes; then
112 +- ac_success=yes
113 +- fi
114 ++
115 ++ m4_if([$2], [], [dnl
116 ++ AC_CACHE_CHECK(whether $CXX supports C++$1 features by default,
117 ++ ax_cv_cxx_compile_cxx$1,
118 ++ [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
119 ++ [ax_cv_cxx_compile_cxx$1=yes],
120 ++ [ax_cv_cxx_compile_cxx$1=no])])
121 ++ if test x$ax_cv_cxx_compile_cxx$1 = xyes; then
122 ++ ac_success=yes
123 ++ fi])
124 +
125 + m4_if([$2], [noext], [], [dnl
126 + if test x$ac_success = xno; then
127 +- for switch in -std=gnu++$1 -std=gnu++0x; do
128 ++ for alternative in ${ax_cxx_compile_alternatives}; do
129 ++ switch="-std=gnu++${alternative}"
130 + cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
131 + AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
132 + $cachevar,
133 +@@ -96,22 +102,27 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
134 + dnl HP's aCC needs +std=c++11 according to:
135 + dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf
136 + dnl Cray's crayCC needs "-h std=c++11"
137 +- for switch in -std=c++$1 -std=c++0x +std=c++$1 "-h std=c++$1"; do
138 +- cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
139 +- AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
140 +- $cachevar,
141 +- [ac_save_CXX="$CXX"
142 +- CXX="$CXX $switch"
143 +- AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
144 +- [eval $cachevar=yes],
145 +- [eval $cachevar=no])
146 +- CXX="$ac_save_CXX"])
147 +- if eval test x\$$cachevar = xyes; then
148 +- CXX="$CXX $switch"
149 +- if test -n "$CXXCPP" ; then
150 +- CXXCPP="$CXXCPP $switch"
151 ++ for alternative in ${ax_cxx_compile_alternatives}; do
152 ++ for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do
153 ++ cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
154 ++ AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
155 ++ $cachevar,
156 ++ [ac_save_CXX="$CXX"
157 ++ CXX="$CXX $switch"
158 ++ AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
159 ++ [eval $cachevar=yes],
160 ++ [eval $cachevar=no])
161 ++ CXX="$ac_save_CXX"])
162 ++ if eval test x\$$cachevar = xyes; then
163 ++ CXX="$CXX $switch"
164 ++ if test -n "$CXXCPP" ; then
165 ++ CXXCPP="$CXXCPP $switch"
166 ++ fi
167 ++ ac_success=yes
168 ++ break
169 + fi
170 +- ac_success=yes
171 ++ done
172 ++ if test x$ac_success = xyes; then
173 + break
174 + fi
175 + done
176 +@@ -148,6 +159,11 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14],
177 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_14
178 + )
179 +
180 ++m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17],
181 ++ _AX_CXX_COMPILE_STDCXX_testbody_new_in_11
182 ++ _AX_CXX_COMPILE_STDCXX_testbody_new_in_14
183 ++ _AX_CXX_COMPILE_STDCXX_testbody_new_in_17
184 ++)
185 +
186 + dnl Tests for new features in C++11
187 +
188 +@@ -185,11 +201,13 @@ namespace cxx11
189 +
190 + struct Base
191 + {
192 ++ virtual ~Base() {}
193 + virtual void f() {}
194 + };
195 +
196 + struct Derived : public Base
197 + {
198 ++ virtual ~Derived() override {}
199 + virtual void f() override {}
200 + };
201 +
202 +@@ -518,7 +536,7 @@ namespace cxx14
203 +
204 + }
205 +
206 +- namespace test_digit_seperators
207 ++ namespace test_digit_separators
208 + {
209 +
210 + constexpr auto ten_million = 100'000'000;
211 +@@ -560,3 +578,385 @@ namespace cxx14
212 + #endif // __cplusplus >= 201402L
213 +
214 + ]])
215 ++
216 ++
217 ++dnl Tests for new features in C++17
218 ++
219 ++m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[
220 ++
221 ++// If the compiler admits that it is not ready for C++17, why torture it?
222 ++// Hopefully, this will speed up the test.
223 ++
224 ++#ifndef __cplusplus
225 ++
226 ++#error "This is not a C++ compiler"
227 ++
228 ++#elif __cplusplus < 201703L
229 ++
230 ++#error "This is not a C++17 compiler"
231 ++
232 ++#else
233 ++
234 ++#include <initializer_list>
235 ++#include <utility>
236 ++#include <type_traits>
237 ++
238 ++namespace cxx17
239 ++{
240 ++
241 ++ namespace test_constexpr_lambdas
242 ++ {
243 ++
244 ++ constexpr int foo = [](){return 42;}();
245 ++
246 ++ }
247 ++
248 ++ namespace test::nested_namespace::definitions
249 ++ {
250 ++
251 ++ }
252 ++
253 ++ namespace test_fold_expression
254 ++ {
255 ++
256 ++ template<typename... Args>
257 ++ int multiply(Args... args)
258 ++ {
259 ++ return (args * ... * 1);
260 ++ }
261 ++
262 ++ template<typename... Args>
263 ++ bool all(Args... args)
264 ++ {
265 ++ return (args && ...);
266 ++ }
267 ++
268 ++ }
269 ++
270 ++ namespace test_extended_static_assert
271 ++ {
272 ++
273 ++ static_assert (true);
274 ++
275 ++ }
276 ++
277 ++ namespace test_auto_brace_init_list
278 ++ {
279 ++
280 ++ auto foo = {5};
281 ++ auto bar {5};
282 ++
283 ++ static_assert(std::is_same<std::initializer_list<int>, decltype(foo)>::value);
284 ++ static_assert(std::is_same<int, decltype(bar)>::value);
285 ++ }
286 ++
287 ++ namespace test_typename_in_template_template_parameter
288 ++ {
289 ++
290 ++ template<template<typename> typename X> struct D;
291 ++
292 ++ }
293 ++
294 ++ namespace test_fallthrough_nodiscard_maybe_unused_attributes
295 ++ {
296 ++
297 ++ int f1()
298 ++ {
299 ++ return 42;
300 ++ }
301 ++
302 ++ [[nodiscard]] int f2()
303 ++ {
304 ++ [[maybe_unused]] auto unused = f1();
305 ++
306 ++ switch (f1())
307 ++ {
308 ++ case 17:
309 ++ f1();
310 ++ [[fallthrough]];
311 ++ case 42:
312 ++ f1();
313 ++ }
314 ++ return f1();
315 ++ }
316 ++
317 ++ }
318 ++
319 ++ namespace test_extended_aggregate_initialization
320 ++ {
321 ++
322 ++ struct base1
323 ++ {
324 ++ int b1, b2 = 42;
325 ++ };
326 ++
327 ++ struct base2
328 ++ {
329 ++ base2() {
330 ++ b3 = 42;
331 ++ }
332 ++ int b3;
333 ++ };
334 ++
335 ++ struct derived : base1, base2
336 ++ {
337 ++ int d;
338 ++ };
339 ++
340 ++ derived d1 {{1, 2}, {}, 4}; // full initialization
341 ++ derived d2 {{}, {}, 4}; // value-initialized bases
342 ++
343 ++ }
344 ++
345 ++ namespace test_general_range_based_for_loop
346 ++ {
347 ++
348 ++ struct iter
349 ++ {
350 ++ int i;
351 ++
352 ++ int& operator* ()
353 ++ {
354 ++ return i;
355 ++ }
356 ++
357 ++ const int& operator* () const
358 ++ {
359 ++ return i;
360 ++ }
361 ++
362 ++ iter& operator++()
363 ++ {
364 ++ ++i;
365 ++ return *this;
366 ++ }
367 ++ };
368 ++
369 ++ struct sentinel
370 ++ {
371 ++ int i;
372 ++ };
373 ++
374 ++ bool operator== (const iter& i, const sentinel& s)
375 ++ {
376 ++ return i.i == s.i;
377 ++ }
378 ++
379 ++ bool operator!= (const iter& i, const sentinel& s)
380 ++ {
381 ++ return !(i == s);
382 ++ }
383 ++
384 ++ struct range
385 ++ {
386 ++ iter begin() const
387 ++ {
388 ++ return {0};
389 ++ }
390 ++
391 ++ sentinel end() const
392 ++ {
393 ++ return {5};
394 ++ }
395 ++ };
396 ++
397 ++ void f()
398 ++ {
399 ++ range r {};
400 ++
401 ++ for (auto i : r)
402 ++ {
403 ++ [[maybe_unused]] auto v = i;
404 ++ }
405 ++ }
406 ++
407 ++ }
408 ++
409 ++ namespace test_lambda_capture_asterisk_this_by_value
410 ++ {
411 ++
412 ++ struct t
413 ++ {
414 ++ int i;
415 ++ int foo()
416 ++ {
417 ++ return [*this]()
418 ++ {
419 ++ return i;
420 ++ }();
421 ++ }
422 ++ };
423 ++
424 ++ }
425 ++
426 ++ namespace test_enum_class_construction
427 ++ {
428 ++
429 ++ enum class byte : unsigned char
430 ++ {};
431 ++
432 ++ byte foo {42};
433 ++
434 ++ }
435 ++
436 ++ namespace test_constexpr_if
437 ++ {
438 ++
439 ++ template <bool cond>
440 ++ int f ()
441 ++ {
442 ++ if constexpr(cond)
443 ++ {
444 ++ return 13;
445 ++ }
446 ++ else
447 ++ {
448 ++ return 42;
449 ++ }
450 ++ }
451 ++
452 ++ }
453 ++
454 ++ namespace test_selection_statement_with_initializer
455 ++ {
456 ++
457 ++ int f()
458 ++ {
459 ++ return 13;
460 ++ }
461 ++
462 ++ int f2()
463 ++ {
464 ++ if (auto i = f(); i > 0)
465 ++ {
466 ++ return 3;
467 ++ }
468 ++
469 ++ switch (auto i = f(); i + 4)
470 ++ {
471 ++ case 17:
472 ++ return 2;
473 ++
474 ++ default:
475 ++ return 1;
476 ++ }
477 ++ }
478 ++
479 ++ }
480 ++
481 ++ namespace test_template_argument_deduction_for_class_templates
482 ++ {
483 ++
484 ++ template <typename T1, typename T2>
485 ++ struct pair
486 ++ {
487 ++ pair (T1 p1, T2 p2)
488 ++ : m1 {p1},
489 ++ m2 {p2}
490 ++ {}
491 ++
492 ++ T1 m1;
493 ++ T2 m2;
494 ++ };
495 ++
496 ++ void f()
497 ++ {
498 ++ [[maybe_unused]] auto p = pair{13, 42u};
499 ++ }
500 ++
501 ++ }
502 ++
503 ++ namespace test_non_type_auto_template_parameters
504 ++ {
505 ++
506 ++ template <auto n>
507 ++ struct B
508 ++ {};
509 ++
510 ++ B<5> b1;
511 ++ B<'a'> b2;
512 ++
513 ++ }
514 ++
515 ++ namespace test_structured_bindings
516 ++ {
517 ++
518 ++ int arr[2] = { 1, 2 };
519 ++ std::pair<int, int> pr = { 1, 2 };
520 ++
521 ++ auto f1() -> int(&)[2]
522 ++ {
523 ++ return arr;
524 ++ }
525 ++
526 ++ auto f2() -> std::pair<int, int>&
527 ++ {
528 ++ return pr;
529 ++ }
530 ++
531 ++ struct S
532 ++ {
533 ++ int x1 : 2;
534 ++ volatile double y1;
535 ++ };
536 ++
537 ++ S f3()
538 ++ {
539 ++ return {};
540 ++ }
541 ++
542 ++ auto [ x1, y1 ] = f1();
543 ++ auto& [ xr1, yr1 ] = f1();
544 ++ auto [ x2, y2 ] = f2();
545 ++ auto& [ xr2, yr2 ] = f2();
546 ++ const auto [ x3, y3 ] = f3();
547 ++
548 ++ }
549 ++
550 ++ namespace test_exception_spec_type_system
551 ++ {
552 ++
553 ++ struct Good {};
554 ++ struct Bad {};
555 ++
556 ++ void g1() noexcept;
557 ++ void g2();
558 ++
559 ++ template<typename T>
560 ++ Bad
561 ++ f(T*, T*);
562 ++
563 ++ template<typename T1, typename T2>
564 ++ Good
565 ++ f(T1*, T2*);
566 ++
567 ++ static_assert (std::is_same_v<Good, decltype(f(g1, g2))>);
568 ++
569 ++ }
570 ++
571 ++ namespace test_inline_variables
572 ++ {
573 ++
574 ++ template<class T> void f(T)
575 ++ {}
576 ++
577 ++ template<class T> inline T g(T)
578 ++ {
579 ++ return T{};
580 ++ }
581 ++
582 ++ template<> inline void f<>(int)
583 ++ {}
584 ++
585 ++ template<> int g<>(int)
586 ++ {
587 ++ return 5;
588 ++ }
589 ++
590 ++ }
591 ++
592 ++} // namespace cxx17
593 ++
594 ++#endif // __cplusplus < 201703L
595 ++
596 ++]])
597
598 diff --git a/app-admin/lnav/lnav-0.9.0-r1.ebuild b/app-admin/lnav/lnav-0.9.0-r1.ebuild
599 index dbadbc3f293..3a59325f426 100644
600 --- a/app-admin/lnav/lnav-0.9.0-r1.ebuild
601 +++ b/app-admin/lnav/lnav-0.9.0-r1.ebuild
602 @@ -35,6 +35,9 @@ PATCHES=(
603 # Fix a segfault when using right arrow
604 # bug 792582
605 "${FILESDIR}"/${PN}-0.9.0-bug792582.patch
606 + # Fix a build failure on gcc
607 + # bug 786456
608 + "${FILESDIR}"/${PN}-0.9.0-bug786456.patch
609 )
610
611 src_prepare() {