aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2023-11-22 11:21:52 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2023-11-22 11:21:52 +0200
commita244bdcd7e9b246ec9baefd225fc56f2ebf5221f (patch)
treeb6273e3e53b69817cff3939ce7b95a491236da5e /libbuild2
parent45c81c3c0fdc3da7a31910bdb657ad4ebbfa8663 (diff)
Fix cc::link_rule and cc::install_rule to recognize S{} even in C++
Failed that, a C++ link rule cannot match a dependency with S{} prerequisites.
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/cc/install-rule.cxx24
-rw-r--r--libbuild2/cc/link-rule.cxx16
2 files changed, 20 insertions, 20 deletions
diff --git a/libbuild2/cc/install-rule.cxx b/libbuild2/cc/install-rule.cxx
index 28d1a58..6758e03 100644
--- a/libbuild2/cc/install-rule.cxx
+++ b/libbuild2/cc/install-rule.cxx
@@ -228,11 +228,13 @@ namespace build2
//
auto header_source = [this] (const auto& p)
{
- return (x_header (p) ||
- p.is_a (x_src) ||
- (x_mod != nullptr && p.is_a (*x_mod)) ||
- (x_asp != nullptr && p.is_a (*x_asp)) ||
- (x_obj != nullptr && p.is_a (*x_obj)));
+ return (x_header (p) ||
+ p.is_a (x_src) ||
+ p.is_a (c::static_type) ||
+ p.is_a (S::static_type) ||
+ (x_mod != nullptr && p.is_a (*x_mod)) ||
+ (x_obj != nullptr && (p.is_a (*x_obj) ||
+ p.is_a (m::static_type))));
};
if (t.is_a<exe> () ||
@@ -643,11 +645,13 @@ namespace build2
auto header_source = [this] (const auto& p)
{
- return (x_header (p) ||
- p.is_a (x_src) ||
- (x_mod != nullptr && p.is_a (*x_mod)) ||
- (x_asp != nullptr && p.is_a (*x_asp)) ||
- (x_obj != nullptr && p.is_a (*x_obj)));
+ return (x_header (p) ||
+ p.is_a (x_src) ||
+ p.is_a (c::static_type) ||
+ p.is_a (S::static_type) ||
+ (x_mod != nullptr && p.is_a (*x_mod)) ||
+ (x_obj != nullptr && (p.is_a (*x_obj) ||
+ p.is_a (m::static_type))));
};
if (t.is_a<libue> () ||
diff --git a/libbuild2/cc/link-rule.cxx b/libbuild2/cc/link-rule.cxx
index 9fa38f7..e3e89b6 100644
--- a/libbuild2/cc/link-rule.cxx
+++ b/libbuild2/cc/link-rule.cxx
@@ -299,7 +299,7 @@ namespace build2
{
r.seen_x = true;
}
- else if (p.is_a<c> () ||
+ else if (p.is_a<c> () || p.is_a<S> () ||
(x_obj != nullptr && p.is_a<m> ()) ||
// Header-only C library.
(library && p.is_a<h> ()))
@@ -1008,9 +1008,8 @@ namespace build2
//
#if 1
if (!um)
- um = (p.is_a (x_src) || p.is_a<c> () ||
+ um = (p.is_a (x_src) || p.is_a<c> () || p.is_a<S> () ||
(x_mod != nullptr && p.is_a (*x_mod)) ||
- (x_asp != nullptr && p.is_a (*x_asp)) ||
(x_obj != nullptr && (p.is_a (*x_obj) || p.is_a<m> ())) ||
x_header (p, true));
#endif
@@ -1041,8 +1040,7 @@ namespace build2
bool hdr (false);
if (mod ||
- p.is_a (x_src) || p.is_a<c> () ||
- (x_asp != nullptr && p.is_a (*x_asp)) ||
+ p.is_a (x_src) || p.is_a<c> () || p.is_a<S> () ||
(x_obj != nullptr && (p.is_a (*x_obj) || p.is_a<m> ())))
{
binless = binless && (mod ? user_binless : false);
@@ -1911,8 +1909,7 @@ namespace build2
//
if (mod
? p1.is_a (*x_mod)
- : (p1.is_a (x_src) || p1.is_a<c> () ||
- (x_asp != nullptr && p1.is_a (*x_asp)) ||
+ : (p1.is_a (x_src) || p1.is_a<c> () || p1.is_a<S> () ||
(x_obj != nullptr && (p1.is_a (*x_obj) || p1.is_a<m> ()))))
{
src = true;
@@ -1930,7 +1927,7 @@ namespace build2
p.is_a (x_src) ||
(x_asp != nullptr && p.is_a (*x_asp)) ||
(x_obj != nullptr && p.is_a (*x_obj))) && x_header (p1)) ||
- ((p.is_a<c> () ||
+ ((p.is_a<c> () || p.is_a<S> () ||
(x_obj != nullptr && p.is_a<m> ())) && p1.is_a<h> ()))
continue;
@@ -2073,8 +2070,7 @@ namespace build2
{
if (mod
? p1.is_a (*x_mod)
- : (p1.is_a (x_src) || p1.is_a<c> () ||
- (x_asp != nullptr && p1.is_a (*x_asp)) ||
+ : (p1.is_a (x_src) || p1.is_a<c> () || p1.is_a<S> () ||
(x_obj != nullptr && (p1.is_a (*x_obj) || p1.is_a<m> ()))))
{
// Searching our own prerequisite is ok, p1 must already be