From a9a8bcf32232a99740d9c23b7c5f8af20de09741 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Fri, 17 Jan 2025 09:49:35 +0100 Subject: Refactor task == std::string comparison --- src/task.cc | 9 +++++---- src/task.h | 2 +- src/task_cc.cc | 5 ----- src/task_cc.h | 1 - 4 files changed, 6 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/task.cc b/src/task.cc index cd03fce..ef7731b 100644 --- a/src/task.cc +++ b/src/task.cc @@ -48,10 +48,11 @@ bool Task::operator==(const std::string& depStr) std::filesystem::path generated_output = sourceDir; generated_output /= target(); return - name() == depStr || - target() == depStr || - generated_output == depStr || - targetFile().string() == depStr + (!derived() && name() == depStr) || // compare to name + (!derived() && config.target == depStr) || // compare to stated target (ex. foo.a) + target() == depStr || // compare to derived (derived to foo.lib on msvc) + generated_output == depStr || // not sure what this is for?! + targetFile().string() == depStr // compare to target output file ; } diff --git a/src/task.h b/src/task.h index e930a54..32d0de3 100644 --- a/src/task.h +++ b/src/task.h @@ -32,7 +32,7 @@ public: bool operator==(const std::string& dep); - virtual std::string name() const; + std::string name() const; bool dirty(); bool ready(); int run(); diff --git a/src/task_cc.cc b/src/task_cc.cc index 9de2657..f4a754f 100644 --- a/src/task_cc.cc +++ b/src/task_cc.cc @@ -90,11 +90,6 @@ int TaskCC::registerDepTasksInner(const std::vector>& task return 0; } -std::string TaskCC::name() const -{ - return {}; -} - bool TaskCC::dirtyInner() { if(!std::filesystem::exists(sourceFile)) diff --git a/src/task_cc.h b/src/task_cc.h index 6c4683a..2299fcd 100644 --- a/src/task_cc.h +++ b/src/task_cc.h @@ -21,7 +21,6 @@ public: int registerDepTasksInner(const std::vector>& tasks) override; - std::string name() const override; bool dirtyInner() override; int runInner() override; -- cgit v1.2.3