From daa35c9e4b592f055b42e482fe1398527cfdf90b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 6 Jun 2019 18:00:10 +0200 Subject: Fix cc link rule matching ambiguity wrt to C/C++ sources Considering a C header as C++ source was definitely a bad idea. --- build2/cc/common.hxx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'build2/cc/common.hxx') diff --git a/build2/cc/common.hxx b/build2/cc/common.hxx index 19733cf..3f0f9fb 100644 --- a/build2/cc/common.hxx +++ b/build2/cc/common.hxx @@ -13,7 +13,8 @@ #include #include -#include // compiler_id +#include // compiler_id +#include // h{} namespace build2 { @@ -151,21 +152,21 @@ namespace build2 const target_type& x_src; // Source target type (c{}, cxx{}). const target_type* x_mod; // Module target type (mxx{}), if any. - // Array of target types that are considered headers. Keep them in the - // most likely to appear order with the "real header" first and - // terminated with NULL. + // Array of target types that are considered the X-language headers + // (excluding h{} except for C). Keep them in the most likely to appear + // order with the "real header" first and terminated with NULL. // const target_type* const* x_hdr; template bool - x_header (const T& t) const + x_header (const T& t, bool c_hdr = true) const { for (const target_type* const* ht (x_hdr); *ht != nullptr; ++ht) if (t.is_a (**ht)) return true; - return false; + return c_hdr && t.is_a (h::static_type); } // Array of target types that can be #include'd. Used to reverse-lookup -- cgit v1.1