diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-08-09 11:31:53 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-08-12 17:04:22 +0200 |
commit | 9fa5f73d00905568e8979d0c93ec4a8f645c81d5 (patch) | |
tree | f2bf937fa256c0ef2c9bbe05d3655d1985719405 /build2/algorithm.txx | |
parent | a1b2319ff2ddc8a6f139ee364cabe236ca62e23e (diff) |
Implement support for C compilation
We now have two new modules: cc (c-common) and c.
Diffstat (limited to 'build2/algorithm.txx')
-rw-r--r-- | build2/algorithm.txx | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/build2/algorithm.txx b/build2/algorithm.txx deleted file mode 100644 index 1431d32..0000000 --- a/build2/algorithm.txx +++ /dev/null @@ -1,58 +0,0 @@ -// file : build2/algorithm.txx -*- C++ -*- -// copyright : Copyright (c) 2014-2016 Code Synthesis Ltd -// license : MIT; see accompanying LICENSE file - -namespace build2 -{ - template <typename T> - T* - execute_prerequisites (action a, target& t, const timestamp& mt) - { - //@@ Can factor the bulk of it into a non-template code. Can - // either do a function template that will do dynamic_cast check - // or can scan the target type info myself. I think latter. - // - bool e (mt == timestamp_nonexistent); - T* r (nullptr); - - for (target* pt: t.prerequisite_targets) - { - if (pt == nullptr) // Skip ignored. - continue; - - target_state ts (execute (a, *pt)); - - if (!e) - { - // If this is an mtime-based target, then compare timestamps. - // - if (auto mpt = dynamic_cast<const mtime_target*> (pt)) - { - timestamp mp (mpt->mtime ()); - - // What do we do if timestamps are equal? This can happen, for - // example, on filesystems that don't have subsecond resolution. - // There is not much we can do here except detect the case where - // the prerequisite was changed in this run which means the - // action must be executed on the target as well. - // - if (mt < mp || (mt == mp && ts == target_state::changed)) - e = true; - } - else - { - // Otherwise we assume the prerequisite is newer if it was changed. - // - if (ts == target_state::changed) - e = true; - } - } - - if (T* tmp = dynamic_cast<T*> (pt)) - r = tmp; - } - - assert (r != nullptr); - return e ? r : nullptr; - } -} |