aboutsummaryrefslogtreecommitdiff
path: root/build2/cc/common.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-06-06 18:00:10 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-06-06 18:00:10 +0200
commitdaa35c9e4b592f055b42e482fe1398527cfdf90b (patch)
treeba6d14f100b58d2d3b38b9d1ff76b553ad84f4a3 /build2/cc/common.hxx
parent6bbdd5e594deb3a7143461fe657ad495e95bbafd (diff)
Fix cc link rule matching ambiguity wrt to C/C++ sources
Considering a C header as C++ source was definitely a bad idea.
Diffstat (limited to 'build2/cc/common.hxx')
-rw-r--r--build2/cc/common.hxx13
1 files changed, 7 insertions, 6 deletions
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 <build2/bin/target.hxx>
#include <build2/cc/types.hxx>
-#include <build2/cc/guess.hxx> // compiler_id
+#include <build2/cc/guess.hxx> // compiler_id
+#include <build2/cc/target.hxx> // 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 <typename T>
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