From a244bdcd7e9b246ec9baefd225fc56f2ebf5221f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 22 Nov 2023 11:21:52 +0200 Subject: 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. --- libbuild2/cc/install-rule.cxx | 24 ++++++++++++++---------- libbuild2/cc/link-rule.cxx | 16 ++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) (limited to 'libbuild2') 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 () || @@ -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 () || 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 () || + else if (p.is_a () || p.is_a () || (x_obj != nullptr && p.is_a ()) || // Header-only C library. (library && p.is_a ())) @@ -1008,9 +1008,8 @@ namespace build2 // #if 1 if (!um) - um = (p.is_a (x_src) || p.is_a () || + um = (p.is_a (x_src) || p.is_a () || p.is_a () || (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 ())) || x_header (p, true)); #endif @@ -1041,8 +1040,7 @@ namespace build2 bool hdr (false); if (mod || - p.is_a (x_src) || p.is_a () || - (x_asp != nullptr && p.is_a (*x_asp)) || + p.is_a (x_src) || p.is_a () || p.is_a () || (x_obj != nullptr && (p.is_a (*x_obj) || p.is_a ()))) { 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 () || - (x_asp != nullptr && p1.is_a (*x_asp)) || + : (p1.is_a (x_src) || p1.is_a () || p1.is_a () || (x_obj != nullptr && (p1.is_a (*x_obj) || p1.is_a ())))) { 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 () || + ((p.is_a () || p.is_a () || (x_obj != nullptr && p.is_a ())) && p1.is_a ())) continue; @@ -2073,8 +2070,7 @@ namespace build2 { if (mod ? p1.is_a (*x_mod) - : (p1.is_a (x_src) || p1.is_a () || - (x_asp != nullptr && p1.is_a (*x_asp)) || + : (p1.is_a (x_src) || p1.is_a () || p1.is_a () || (x_obj != nullptr && (p1.is_a (*x_obj) || p1.is_a ())))) { // Searching our own prerequisite is ok, p1 must already be -- cgit v1.1