From f8961a9113477735724a3a5229b9338bc9c0fe2e Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 1 May 2012 11:33:42 +0300 Subject: [PATCH] Remove the buildable flag and instead check for tool being non-null --- source/binary.cpp | 1 - source/datafile.cpp | 1 - source/filetarget.cpp | 2 +- source/installedfile.cpp | 1 - source/objectfile.cpp | 1 - source/pkgconfig.cpp | 1 - source/staticlibrary.cpp | 1 - source/tarball.cpp | 4 +--- source/target.cpp | 5 +---- source/target.h | 3 +-- 10 files changed, 4 insertions(+), 16 deletions(-) diff --git a/source/binary.cpp b/source/binary.cpp index 709dbd1..b8445c1 100644 --- a/source/binary.cpp +++ b/source/binary.cpp @@ -16,7 +16,6 @@ Binary::Binary(Builder &b, const Component &c, const list &objs): FileTarget(b, &c.get_package(), generate_target_path(c)), comp(c) { - buildable = true; for(list::const_iterator i=objs.begin(); i!=objs.end(); ++i) add_depend(*i); diff --git a/source/datafile.cpp b/source/datafile.cpp index 5457a2b..5566bf4 100644 --- a/source/datafile.cpp +++ b/source/datafile.cpp @@ -8,7 +8,6 @@ DataFile::DataFile(Builder &b, const Component &c, File &s): component(c), source(s) { - buildable = true; add_depend(&source); install_location = "share/"+package->get_name(); diff --git a/source/filetarget.cpp b/source/filetarget.cpp index ad3786c..054be81 100644 --- a/source/filetarget.cpp +++ b/source/filetarget.cpp @@ -30,7 +30,7 @@ void FileTarget::touch() void FileTarget::check_rebuild() { - if(!buildable) + if(!tool) return; if(builder.get_build_all()) diff --git a/source/installedfile.cpp b/source/installedfile.cpp index d0aa832..24ba6e1 100644 --- a/source/installedfile.cpp +++ b/source/installedfile.cpp @@ -16,7 +16,6 @@ InstalledFile::InstalledFile(Builder &b, const SourcePackage &p, FileTarget &s, FileTarget(b, &p, generate_target_path(b.get_prefix(), s, loc)), source(s) { - buildable = true; add_depend(&source); if(const SharedLibrary *shlib = dynamic_cast(&source)) diff --git a/source/objectfile.cpp b/source/objectfile.cpp index e020c1b..f24d028 100644 --- a/source/objectfile.cpp +++ b/source/objectfile.cpp @@ -14,7 +14,6 @@ ObjectFile::ObjectFile(Builder &b, const Component &c, SourceFile &s): comp(c), source(s) { - buildable = true; add_depend(&source); } diff --git a/source/pkgconfig.cpp b/source/pkgconfig.cpp index cfac2cd..9c5b720 100644 --- a/source/pkgconfig.cpp +++ b/source/pkgconfig.cpp @@ -5,7 +5,6 @@ PkgConfig::PkgConfig(Builder &b, const SourcePackage &p): FileTarget(b, &p, p.get_source()/(p.get_name()+".pc")) { - buildable = true; tool = &builder.get_toolchain().get_tool("PCG"); install_location = "lib/pkgconfig"; diff --git a/source/staticlibrary.cpp b/source/staticlibrary.cpp index c7fd781..13c4e67 100644 --- a/source/staticlibrary.cpp +++ b/source/staticlibrary.cpp @@ -10,7 +10,6 @@ StaticLibrary::StaticLibrary(Builder &b, const Component &c, const list::const_iterator i=objs.begin(); i!=objs.end(); ++i) add_depend(*i); diff --git a/source/tarball.cpp b/source/tarball.cpp index 71e1637..825c0ba 100644 --- a/source/tarball.cpp +++ b/source/tarball.cpp @@ -6,9 +6,7 @@ using namespace std; TarBall::TarBall(Builder &b, const SourcePackage &p, const string &n): FileTarget(b, &p, p.get_source()/(n+".tar")) -{ - buildable = true; -} +{ } const SourcePackage *TarBall::get_package() const { diff --git a/source/target.cpp b/source/target.cpp index 6653c11..adde0cd 100644 --- a/source/target.cpp +++ b/source/target.cpp @@ -15,7 +15,6 @@ Target::Target(Builder &b, const Package *p, const string &n): package(p), name(n), tool(0), - buildable(false), building(false), rebuild(false), deps_ready(false), @@ -79,13 +78,11 @@ void Target::prepare() Task *Target::build() { - if(!buildable) + if(!tool) { rebuild = false; return 0; } - if(!tool) - throw logic_error("buildable && !tool"); // XXX Minor breach of OO here if(FileTarget *ft = dynamic_cast(this)) diff --git a/source/target.h b/source/target.h index 891d757..2df56a4 100644 --- a/source/target.h +++ b/source/target.h @@ -29,7 +29,6 @@ protected: std::string name; const Tool *tool; - bool buildable; bool building; bool rebuild; std::string rebuild_reason; @@ -67,7 +66,7 @@ public: void set_tool(const Tool &); const Tool *get_tool() const { return tool; } - bool is_buildable() const { return buildable; } + bool is_buildable() const { return tool!=0; } bool get_rebuild() const { return rebuild; } const std::string &get_rebuild_reason() const { return rebuild_reason; } bool is_installable() const { return !install_location.empty(); } -- 2.43.0