Gentoo Archives: gentoo-dev

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-dev@l.g.o, Sergei Trofimovich <slyfox@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 09:59:56
Message-Id: 3350735.dWV9SEqChM@tuxbook
In Reply to: Re: [gentoo-dev] [PATCH v2 2/5] flag-o-matic.eclass: get rid of eutils in by Andreas Sturmlechner
1 From 7b063ec3f4e2a76c43cd5de8a81a0a30c0f87a6d Mon Sep 17 00:00:00 2001
2 From: Andreas Sturmlechner <asturm@g.o>
3 Date: Wed, 31 Mar 2021 00:27:27 +0200
4 Subject: [PATCH 3/5] flag-o-matic.eclass: Make test-flag-PROG() internal
5
6 Signed-off-by: Andreas Sturmlechner <asturm@g.o>
7 ---
8 eclass/flag-o-matic.eclass | 28 +++++++++++++++++++++++-----
9 1 file changed, 23 insertions(+), 5 deletions(-)
10
11 diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
12 index d511a140592..e4fdfd0b62d 100644
13 --- a/eclass/flag-o-matic.eclass
14 +++ b/eclass/flag-o-matic.eclass
15 @@ -459,7 +459,25 @@ strip-flags() {
16 return 0
17 }
18
19 +# @FUNCTION: test-flag-PROG
20 +# @USAGE: <compiler> <flag>
21 +# @INTERNAL
22 +# @DESCRIPTION:
23 +# Returns shell true if <flag> is supported by given <compiler>,
24 +# else returns shell false.
25 test-flag-PROG() {
26 + [[ ${EAPI} == [5-7] ]] ||
27 + die "Internal function ${FUNCNAME} is not available in >=EAPI-8."
28 + _test-flag-PROG
29 +}
30 +
31 +# @FUNCTION: _test-flag-PROG
32 +# @USAGE: <compiler> <flag>
33 +# @INTERNAL
34 +# @DESCRIPTION:
35 +# Returns shell true if <flag> is supported by given <compiler>,
36 +# else returns shell false.
37 +_test-flag-PROG() {
38 local comp=$1
39 local lang=$2
40 shift 2
41 @@ -554,31 +572,31 @@ test-flag-PROG() {
42 # @USAGE: <flag>
43 # @DESCRIPTION:
44 # Returns shell true if <flag> is supported by the C compiler, else returns shell false.
45 -test-flag-CC() { test-flag-PROG "CC" c "$@"; }
46 +test-flag-CC() { _test-flag-PROG "CC" c "$@"; }
47
48 # @FUNCTION: test-flag-CXX
49 # @USAGE: <flag>
50 # @DESCRIPTION:
51 # Returns shell true if <flag> is supported by the C++ compiler, else returns shell false.
52 -test-flag-CXX() { test-flag-PROG "CXX" c++ "$@"; }
53 +test-flag-CXX() { _test-flag-PROG "CXX" c++ "$@"; }
54
55 # @FUNCTION: test-flag-F77
56 # @USAGE: <flag>
57 # @DESCRIPTION:
58 # Returns shell true if <flag> is supported by the Fortran 77 compiler, else returns shell false.
59 -test-flag-F77() { test-flag-PROG "F77" f77 "$@"; }
60 +test-flag-F77() { _test-flag-PROG "F77" f77 "$@"; }
61
62 # @FUNCTION: test-flag-FC
63 # @USAGE: <flag>
64 # @DESCRIPTION:
65 # Returns shell true if <flag> is supported by the Fortran 90 compiler, else returns shell false.
66 -test-flag-FC() { test-flag-PROG "FC" f95 "$@"; }
67 +test-flag-FC() { _test-flag-PROG "FC" f95 "$@"; }
68
69 # @FUNCTION: test-flag-CCLD
70 # @USAGE: <flag>
71 # @DESCRIPTION:
72 # Returns shell true if <flag> is supported by the C compiler and linker, else returns shell false.
73 -test-flag-CCLD() { test-flag-PROG "CC" c+ld "$@"; }
74 +test-flag-CCLD() { _test-flag-PROG "CC" c+ld "$@"; }
75
76 test-flags-PROG() {
77 local comp=$1
78 --
79 2.31.0

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies