blob: 65dffa8f3ef44387c27643fb65b7e13b9e47e38e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
// file : libbuild2/bin/utility.ixx -*- C++ -*-
// license : MIT; see accompanying LICENSE file
namespace build2
{
namespace bin
{
inline ltype
link_type (const target_type& tt)
{
bool u (false);
otype o (
tt.is_a<exe> () || (u = tt.is_a<libue> ()) ? otype::e :
tt.is_a<liba> () || (u = tt.is_a<libua> ()) ? otype::a :
tt.is_a<libs> () || (u = tt.is_a<libus> ()) ? otype::s :
static_cast<otype> (0xFF));
return ltype {o, u};
}
inline pair<otype, bool>
link_member (lmembers lm, lorder lo)
{
bool r (true);
bool s (true);
switch (lo)
{
case lorder::a:
case lorder::a_s:
s = false; // Fall through.
case lorder::s:
case lorder::s_a:
{
if (s ? !lm.s : !lm.a)
{
if (lo == lorder::a_s || lo == lorder::s_a)
s = !s;
else
r = false; // Not available.
}
}
}
return make_pair (s ? otype::s : otype::a, r);
}
}
}
|