Gentoo Archives: gentoo-dev

From: Sergei Trofimovich <slyfox@g.o>
To: Andreas Sturmlechner <asturm@g.o>
Cc: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH v2 3/5] flag-o-matic.eclass: get rid of eutils in <EAPI-8, fix eclassdoc, make some funcs internal
Date: Thu, 01 Apr 2021 18:37:25
Message-Id: 20210401193716.0c3ac7b2@sf
In Reply to: Re: [gentoo-dev] [PATCH v2 3/5] flag-o-matic.eclass: get rid of eutils in by Andreas Sturmlechner
1 On Thu, 01 Apr 2021 11:59:48 +0200
2 Andreas Sturmlechner <asturm@g.o> wrote:
3
4 > From 7b063ec3f4e2a76c43cd5de8a81a0a30c0f87a6d Mon Sep 17 00:00:00 2001
5 > From: Andreas Sturmlechner <asturm@g.o>
6 > Date: Wed, 31 Mar 2021 00:27:27 +0200
7 > Subject: [PATCH 3/5] flag-o-matic.eclass: Make test-flag-PROG() internal
8 >
9 > Signed-off-by: Andreas Sturmlechner <asturm@g.o>
10 > ---
11 > eclass/flag-o-matic.eclass | 28 +++++++++++++++++++++++-----
12 > 1 file changed, 23 insertions(+), 5 deletions(-)
13 >
14 > diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
15 > index d511a140592..e4fdfd0b62d 100644
16 > --- a/eclass/flag-o-matic.eclass
17 > +++ b/eclass/flag-o-matic.eclass
18 > @@ -459,7 +459,25 @@ strip-flags() {
19 > return 0
20 > }
21 >
22 > +# @FUNCTION: test-flag-PROG
23 > +# @USAGE: <compiler> <flag>
24 > +# @INTERNAL
25 > +# @DESCRIPTION:
26 > +# Returns shell true if <flag> is supported by given <compiler>,
27 > +# else returns shell false.
28 > test-flag-PROG() {
29 > + [[ ${EAPI} == [5-7] ]] ||
30 > + die "Internal function ${FUNCNAME} is not available in >=EAPI-8."
31
32 Yeah. Given that we use tc-get$1 in implementation it's not easy to
33 use as is in external code. Patch is ok. We can consider it later.
34
35 > + _test-flag-PROG
36 > +}
37 > +
38 > +# @FUNCTION: _test-flag-PROG
39 > +# @USAGE: <compiler> <flag>
40 > +# @INTERNAL
41 > +# @DESCRIPTION:
42 > +# Returns shell true if <flag> is supported by given <compiler>,
43 > +# else returns shell false.
44 > +_test-flag-PROG() {
45 > local comp=$1
46 > local lang=$2
47 > shift 2
48 > @@ -554,31 +572,31 @@ test-flag-PROG() {
49 > # @USAGE: <flag>
50 > # @DESCRIPTION:
51 > # Returns shell true if <flag> is supported by the C compiler, else returns shell false.
52 > -test-flag-CC() { test-flag-PROG "CC" c "$@"; }
53 > +test-flag-CC() { _test-flag-PROG "CC" c "$@"; }
54 >
55 > # @FUNCTION: test-flag-CXX
56 > # @USAGE: <flag>
57 > # @DESCRIPTION:
58 > # Returns shell true if <flag> is supported by the C++ compiler, else returns shell false.
59 > -test-flag-CXX() { test-flag-PROG "CXX" c++ "$@"; }
60 > +test-flag-CXX() { _test-flag-PROG "CXX" c++ "$@"; }
61 >
62 > # @FUNCTION: test-flag-F77
63 > # @USAGE: <flag>
64 > # @DESCRIPTION:
65 > # Returns shell true if <flag> is supported by the Fortran 77 compiler, else returns shell false.
66 > -test-flag-F77() { test-flag-PROG "F77" f77 "$@"; }
67 > +test-flag-F77() { _test-flag-PROG "F77" f77 "$@"; }
68 >
69 > # @FUNCTION: test-flag-FC
70 > # @USAGE: <flag>
71 > # @DESCRIPTION:
72 > # Returns shell true if <flag> is supported by the Fortran 90 compiler, else returns shell false.
73 > -test-flag-FC() { test-flag-PROG "FC" f95 "$@"; }
74 > +test-flag-FC() { _test-flag-PROG "FC" f95 "$@"; }
75 >
76 > # @FUNCTION: test-flag-CCLD
77 > # @USAGE: <flag>
78 > # @DESCRIPTION:
79 > # Returns shell true if <flag> is supported by the C compiler and linker, else returns shell false.
80 > -test-flag-CCLD() { test-flag-PROG "CC" c+ld "$@"; }
81 > +test-flag-CCLD() { _test-flag-PROG "CC" c+ld "$@"; }
82 >
83 > test-flags-PROG() {
84 > local comp=$1
85 > --
86 > 2.31.0
87 >
88
89
90 --
91
92 Sergei