aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbuild2/bash/rule.cxx2
-rw-r--r--libbuild2/cc/common.cxx5
-rw-r--r--libbuild2/cc/windows-rpath.cxx4
3 files changed, 6 insertions, 5 deletions
diff --git a/libbuild2/bash/rule.cxx b/libbuild2/bash/rule.cxx
index dd8940a..801f02c 100644
--- a/libbuild2/bash/rule.cxx
+++ b/libbuild2/bash/rule.cxx
@@ -237,7 +237,7 @@ namespace build2
const path* ap (nullptr);
for (const prerequisite_target& pt: t.prerequisite_targets[a])
{
- if (pt.target == nullptr || pt.adhoc)
+ if (pt.adhoc || pt.target == nullptr)
continue;
if (const bash* b = pt.target->is_a<bash> ())
diff --git a/libbuild2/cc/common.cxx b/libbuild2/cc/common.cxx
index 8150cfa..ce80e3f 100644
--- a/libbuild2/cc/common.cxx
+++ b/libbuild2/cc/common.cxx
@@ -240,9 +240,10 @@ namespace build2
for (const prerequisite_target& pt: l.prerequisite_targets[a])
{
// Note: adhoc prerequisites are not part of the library meta-
- // information protocol.
+ // information protocol (and we should check for adhoc first to
+ // avoid races).
//
- if (pt == nullptr || pt.adhoc)
+ if (pt.adhoc || pt == nullptr)
continue;
bool la;
diff --git a/libbuild2/cc/windows-rpath.cxx b/libbuild2/cc/windows-rpath.cxx
index f1d4749..eddb9c4 100644
--- a/libbuild2/cc/windows-rpath.cxx
+++ b/libbuild2/cc/windows-rpath.cxx
@@ -109,7 +109,7 @@ namespace build2
for (const prerequisite_target& pt: t.prerequisite_targets[a])
{
- if (pt == nullptr || pt.adhoc)
+ if (pt.adhoc || pt == nullptr)
continue;
bool la;
@@ -204,7 +204,7 @@ namespace build2
for (const prerequisite_target& pt: t.prerequisite_targets[a])
{
- if (pt == nullptr || pt.adhoc)
+ if (pt.adhoc || pt == nullptr)
continue;
bool la;