Gentoo Archives: gentoo-dev

From: matoro_mailinglist_gentoo-dev@××××××.tk
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] [PATCH] flag-o-matic.eclass: rename _test-compile-PROG, expose externally
Date: Wed, 08 Mar 2023 17:24:22
Message-Id: 20230308172406.28602-1-matoro_mailinglist_gentoo-dev@matoro.tk
1 From: Matoro Mahri <matoro@××××××××××××××××××××.com>
2
3 Rename _test-compile-PROG to test-compile and expose externally for
4 ebuilds to consume if desired.
5
6 Bug: https://bugs.gentoo.org/897976
7 Signed-off-by: Matoro Mahri <matoro@××××××××××××××××××××.com>
8 ---
9 eclass/flag-o-matic.eclass | 15 +++++++--------
10 1 file changed, 7 insertions(+), 8 deletions(-)
11
12 diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
13 index a4e8f19e0071..6bec3df30881 100644
14 --- a/eclass/flag-o-matic.eclass
15 +++ b/eclass/flag-o-matic.eclass
16 @@ -1,4 +1,4 @@
17 -# Copyright 1999-2022 Gentoo Authors
18 +# Copyright 1999-2023 Gentoo Authors
19 # Distributed under the terms of the GNU General Public License v2
20
21 # @ECLASS: flag-o-matic.eclass
22 @@ -888,15 +888,14 @@ no-as-needed() {
23 esac
24 }
25
26 -# @FUNCTION: _test-compile-PROG
27 +# @FUNCTION: test-compile
28 # @USAGE: <language> <code>
29 -# @INTERNAL
30 # @DESCRIPTION:
31 # Attempts to compile (and possibly link) the given program. The first
32 # <language> parameter corresponds to the standard -x compiler argument.
33 # If the program should additionally be attempted to be linked, the string
34 # "+ld" should be added to the <language> parameter.
35 -_test-compile-PROG() {
36 +test-compile() {
37 local lang=$1
38 local code=$2
39 shift 2
40 @@ -982,7 +981,7 @@ append-atomic-flags() {
41 local code
42
43 # first, ensure we can compile a trivial program
44 - # this is because we can't distinguish if _test-compile-PROG
45 + # this is because we can't distinguish if test-compile
46 # fails because -latomic is actually needed or if we have a
47 # broken toolchain (like due to bad FLAGS)
48 read -r -d '' code <<- EOF
49 @@ -996,7 +995,7 @@ append-atomic-flags() {
50 # let other pieces of the build fail later down the line than to
51 # make people think that something to do with atomic support is the
52 # cause of their problems.
53 - _test-compile-PROG "c+ld" "${code}" || return
54 + test-compile "c+ld" "${code}" || return
55
56 local bytesizes
57 [[ "${#}" == "0" ]] && bytesizes=( "1" "2" "4" "8" ) || bytesizes="${@}"
58 @@ -1017,7 +1016,7 @@ append-atomic-flags() {
59 EOF
60
61 # do nothing if test program links fine
62 - _test-compile-PROG "c+ld" "${code}" && continue
63 + test-compile "c+ld" "${code}" && continue
64
65 # ensure that the toolchain supports -latomic
66 test-flags-CCLD "-latomic" &>/dev/null || die "-latomic is required but not supported by $(tc-getCC)"
67 @@ -1025,7 +1024,7 @@ append-atomic-flags() {
68 append-libs "-latomic"
69
70 # verify that this did indeed fix the problem
71 - _test-compile-PROG "c+ld" "${code}" || \
72 + test-compile "c+ld" "${code}" || \
73 die "libatomic does not include an implementation of ${bytesize}-byte atomics for this toolchain"
74
75 # if any of the required bytesizes require -latomic, no need to continue
76 --
77 2.39.2