]> git.tdb.fi Git - builder.git/commitdiff
Use default member initializers and constructor delegation
authorMikko Rasa <tdb@tdb.fi>
Thu, 22 Dec 2022 12:45:50 +0000 (14:45 +0200)
committerMikko Rasa <tdb@tdb.fi>
Thu, 22 Dec 2022 12:46:33 +0000 (14:46 +0200)
49 files changed:
source/analyzer.cpp
source/analyzer.h
source/androidmanifestfile.cpp
source/androidmanifestfile.h
source/apkbuilder.cpp
source/apkbuilder.h
source/architecture.cpp
source/architecture.h
source/builder.cpp
source/builder.h
source/buildercli.cpp
source/buildercli.h
source/buildinfo.cpp
source/buildinfo.h
source/cache.cpp
source/cache.h
source/chainedtask.cpp
source/chainedtask.h
source/component.cpp
source/component.h
source/config.cpp
source/config.h
source/externaltask.cpp
source/externaltask.h
source/feature.cpp
source/feature.h
source/filetarget.cpp
source/filetarget.h
source/gnulinker.h
source/importlibrary.cpp
source/importlibrary.h
source/internaltask.cpp
source/internaltask.h
source/objectfile.cpp
source/objectfile.h
source/package.cpp
source/package.h
source/packagemanager.cpp
source/packagemanager.h
source/sharedlibrary.cpp
source/sharedlibrary.h
source/sourcepackage.cpp
source/sourcepackage.h
source/target.cpp
source/target.h
source/task.cpp
source/task.h
source/tool.cpp
source/tool.h

index 94f7782e2848632906b78360384ad1ed365295c8..b3b1f217667951ec9df9e739bf8de20eb14f5cd9 100644 (file)
@@ -14,10 +14,7 @@ using namespace std;
 using namespace Msp;
 
 Analyzer::Analyzer(Builder &b):
-       builder(b),
-       mode(DEPS),
-       max_depth(0),
-       full_paths(false)
+       builder(b)
 { }
 
 void Analyzer::analyze()
index 4c9e14641a2fc02af7be622836997804d1c0f3fe..5827480cdd913765a7353e73a97068d20b6f4f27 100644 (file)
@@ -27,10 +27,10 @@ private:
        using TableRow = std::vector<std::string>;
 
        Builder &builder;
-       Mode mode;
+       Mode mode = DEPS;
        std::vector<TableRow> table;
-       unsigned max_depth;
-       bool full_paths;
+       unsigned max_depth = 0;
+       bool full_paths = false;
        std::map<const Target *, std::set<Target *> > rdepends;
 
 public:
index 527bfac874c59a2657d48c3c446d6e8de23b48e6..2dd1c969e54dcc202ab5002f788d5e59d8d20f40 100644 (file)
@@ -8,8 +8,7 @@ using namespace std;
 using namespace Msp;
 
 AndroidManifestFile::AndroidManifestFile(Builder &b, const AndroidApplicationComponent &a):
-       FileTarget(b, a.get_package(), a.get_package().get_temp_directory()/a.get_name()/"AndroidManifest.xml"),
-       native_lib(0)
+       FileTarget(b, a.get_package(), a.get_package().get_temp_directory()/a.get_name()/"AndroidManifest.xml")
 {
        component = &a;
        tool = &builder.get_toolchain().get_tool("AMG");
index cd02df0a452031b259a9d87c837341c076a6a102..9c0ed215e04af29dc8d3ddec613480cb5c4cd00e 100644 (file)
@@ -13,7 +13,7 @@ Metadata file for an Android application.
 class AndroidManifestFile: public FileTarget
 {
 private:
-       SharedLibrary *native_lib;
+       SharedLibrary *native_lib = 0;
        std::vector<std::string> permissions;
        std::string orientation;
 
index 0e141631e7556805fd534e7edb8e5d65ca70252a..d232a6f927ee23827db9eaafacf7a5997e3f999d 100644 (file)
@@ -15,8 +15,7 @@ using namespace Msp;
 // TODO Separate jar into its own tool and have this one just chain the two
 
 ApkBuilder::ApkBuilder(Builder &b):
-       Tool(b, "APK"),
-       jarsigner(0)
+       Tool(b, "APK")
 {
        set_command("jar");
 }
index 7346b759d483b13bdb0fdd0613dcdfba43fe6a55..4a8c16b5e925238c3cb8faa66796f8e5b63f93de 100644 (file)
@@ -6,7 +6,7 @@
 class ApkBuilder: public Tool
 {
 private:
-       Tool *jarsigner;
+       Tool *jarsigner = 0;
 
 public:
        ApkBuilder(Builder &);
index 48c6a204b17fc43220086ca207c68817739c9179..9662bbaa6f08e2dbcaeef2f9a75c9df77818b99d 100644 (file)
@@ -96,9 +96,7 @@ const char *aliases[] =
 }
 
 Architecture::Architecture(Builder &b, const string &spec):
-       builder(b),
-       bits(0),
-       native(false)
+       builder(b)
 {
        if(spec.empty())
        {
index a31ad9fc6fd1c979bac3c8b5502282e573e7d1e6..4642080c59307ab897fabb76d22c81d26ea70aed 100644 (file)
@@ -27,10 +27,10 @@ private:
        std::string cpu;
        std::string fpu;
        std::string system;
-       unsigned bits;
+       unsigned bits = 0;
        std::string toolchain;
        std::string name;
-       bool native;
+       bool native = false;
        std::string cross_prefix;
        std::map<std::string, std::vector<Pattern>> filename_patterns;
 
index 239258196632ca82d8928c0aeceb9d64700b2af0..9968792ac69279dab08731d960912391f77798a0 100644 (file)
@@ -32,13 +32,9 @@ using namespace Msp;
 Builder::Builder():
        package_manager(*this),
        native_arch(*this, string()),
-       current_arch(0),
-       build_type(0),
        vfs(*this),
        build_graph(*this),
-       logger(&default_logger),
-       tempdir("temp"),
-       top_loader(0)
+       logger(&default_logger)
 {
        set_architecture(string());
 }
index 5d62a9a1ec759b1d6d2e06eb91aa363cfcb617a6..331c50ab9a57be2c92fb2ed91a4fab98c598d2b0 100644 (file)
@@ -47,9 +47,9 @@ private:
        PackageManager package_manager;
 
        Architecture native_arch;
-       Architecture *current_arch;
+       Architecture *current_arch = 0;
        std::map<std::string, BuildType> build_types;
-       BuildType *build_type;
+       BuildType *build_type = 0;
        Toolchain toolchain;
        VirtualFileSystem vfs;
        BuildGraph build_graph;
@@ -57,9 +57,9 @@ private:
        const Logger *logger;
 
        Msp::FS::Path prefix;
-       Msp::FS::Path tempdir;
+       Msp::FS::Path tempdir = "temp";
 
-       Loader *top_loader;
+       Loader *top_loader = 0;
 
 public:
        Builder();
index 688a1db1b2df5a898cc1b62262e68e982bdc231d..bc18eed9f37366f4250cc2955d47026cba5f3b33 100644 (file)
@@ -15,19 +15,7 @@ using namespace std;
 using namespace Msp;
 
 BuilderCLI::BuilderCLI(int argc, char **argv):
-       RegisteredApplication<BuilderCLI>("builder"),
-       analyzer(0),
-       build(false),
-       clean(0),
-       dry_run(false),
-       help(false),
-       show_progress(false),
-       build_file("Build"),
-       jobs(1),
-       conf_all(false),
-       conf_only(false),
-       build_all(false),
-       create_makefile(false)
+       RegisteredApplication<BuilderCLI>("builder")
 {
        string analyze_mode;
        string work_dir;
index 4fcdb0395052913b217f529f31b8b66c2e4d494e..3b15541b6e65eed515924db15994bf6fe6bf39ca 100644 (file)
@@ -18,20 +18,20 @@ private:
 
        Builder builder;
        Logger logger;
-       Analyzer *analyzer;
-       bool build;
-       unsigned clean;
-       bool dry_run;
-       bool help;
+       Analyzer *analyzer = 0;
+       bool build = false;
+       unsigned clean = 0;
+       bool dry_run = false;
+       bool help = false;
        std::string helpmsg;
-       bool show_progress;
-       std::string build_file;
-       unsigned jobs;
+       bool show_progress = false;
+       std::string build_file = "Build";
+       unsigned jobs = 1;
        std::vector<std::string> what_if;
-       bool conf_all;
-       bool conf_only;
-       bool build_all;
-       bool create_makefile;
+       bool conf_all = false;
+       bool conf_only = false;
+       bool build_all = false;
+       bool create_makefile = false;
 
 public:
        BuilderCLI(int, char **);
index 8ca9af8dd136dca3812f2f8da9f38fc7c4e0e8f0..8e116709a57a934403d89d947a9cef840e6b4e64 100644 (file)
@@ -26,17 +26,6 @@ void unique(vector<T> &v)
 }
 
 
-BuildInfo::BuildInfo():
-       libmode(DYNAMIC),
-       rpath_mode(NO_RPATH),
-       threads(false),
-       debug(false),
-       optimize(0),
-       strip(false),
-       warning_level(0),
-       fatal_warnings(false)
-{ }
-
 BuildInfo::LibraryMode BuildInfo::get_libmode_for(const string &lib) const
 {
        auto i = libmodes.find(lib);
index 203ba5fe5bfbc844373f82b5d89c3ed02a16d725..26afabffd4db6f323824ddeba99f98954c78c926 100644 (file)
@@ -54,9 +54,9 @@ public:
        struct LanguageStandard
        {
                std::string type;
-               unsigned year;
+               unsigned year = 0;
 
-               LanguageStandard(): year(0) { }
+               LanguageStandard() = default;
                LanguageStandard(const std::string &);
 
                std::string str() const;
@@ -76,13 +76,13 @@ public:
                using LoadType = T;
 
        private:
-               T value;
-               bool set;
+               T value{};
+               bool set = false;
 
        public:
-               Tracked(): value(T()), set(false) { }
-               Tracked(T v): value(v), set(false) { }
-               Tracked(const Tracked &t): value(t.value), set(t.set) { }
+               Tracked() = default;
+               Tracked(T v): value(v) { }
+               Tracked(const Tracked &t) = default;
                Tracked &operator=(const Tracked &v) { if(v.set) { value = v.value; set = true; } return *this; }
 
                Tracked &operator=(const T &v) { value = v; set = true; return *this; }
@@ -95,19 +95,17 @@ public:
        std::vector<Msp::FS::Path> local_incpath;
        std::vector<Msp::FS::Path> libpath;
        std::vector<std::string> libs;
-       Tracked<LibraryMode> libmode;
-       Tracked<RuntimePathMode> rpath_mode;
+       Tracked<LibraryMode> libmode = DYNAMIC;
+       Tracked<RuntimePathMode> rpath_mode = NO_RPATH;
        std::map<std::string, LibraryMode> libmodes;
        std::vector<std::string> keep_symbols;
        std::map<std::string, LanguageStandard> standards;
-       Tracked<bool> threads;
-       Tracked<bool> debug;
-       Tracked<int> optimize;
-       Tracked<bool> strip;
-       Tracked<unsigned> warning_level;
-       Tracked<bool> fatal_warnings;
-
-       BuildInfo();
+       Tracked<bool> threads = false;
+       Tracked<bool> debug = false;
+       Tracked<int> optimize = 0;
+       Tracked<bool> strip = false;
+       Tracked<unsigned> warning_level = 0;
+       Tracked<bool> fatal_warnings = false;
 
        /** Returns the library mode for linking a particular library.  If no mode
        has been specified for that library, the the global library mode is
index 30f3fc33a67141fe996874865828a76dd5ca39eb..6baacce3f4884dd21bc8ced890471f5889c883c2 100644 (file)
@@ -59,8 +59,7 @@ void write_string(IO::Base &out, const string &str)
 
 Cache::Cache(SourcePackage &p):
        package(p),
-       filename(package.get_temp_directory()/"../cache"),
-       changed(false)
+       filename(package.get_temp_directory()/"../cache")
 { }
 
 void Cache::set_value(const Target *tgt, const string &k, const string &v)
index f3a2c13cb003216b92cd500c5096aa2ed4d14829..9193dacec848ae834ac264be6e0bb8ef8bc855a1 100644 (file)
@@ -28,7 +28,7 @@ private:
        Msp::FS::Path filename;
        std::map<Key, Values> data;
        Msp::Time::TimeStamp mtime;
-       mutable bool changed;
+       mutable bool changed = false;
 
 public:
        Cache(SourcePackage &p);
index a5a6d8632d92d81c838fbf0d8c7114c0c2336461..4e0decb67a8f2b25aad18d92baa8f1357cd6ba0d 100644 (file)
@@ -4,9 +4,7 @@
 using namespace std;
 using namespace Msp;
 
-ChainedTask::ChainedTask(Task *t):
-       current(0),
-       final_status(RUNNING)
+ChainedTask::ChainedTask(Task *t)
 {
        add_task(t);
 }
index 4cb677c84aaceb2f6f3934310ecbb038bca0848f..2986e8eae35ec62a28ce7453a652d0ea6e59d61a 100644 (file)
@@ -12,8 +12,8 @@ class ChainedTask: public Task
 {
 private:
        std::vector<Task *> tasks;
-       unsigned current;
-       Status final_status;
+       unsigned current = 0;
+       Status final_status = RUNNING;
 
 public:
        ChainedTask(Task *);
index e3f80fbc95b9becfd93c89ec9968784783d90dbf..0186f3e394c3debe464a1d888ad12594fb941f0b 100644 (file)
@@ -13,9 +13,7 @@ using namespace Msp;
 
 Component::Component(SourcePackage &p, const string &n):
        package(p),
-       name(n),
-       install(false),
-       deflt(true)
+       name(n)
 { }
 
 void Component::prepare()
index bde558d6281facab3d935a0384898c7797eb0dfa..5479cc5a1aa71d86ed163f73ec8e6a5c3c4bfb3b 100644 (file)
@@ -37,10 +37,10 @@ protected:
        std::string name;
        std::vector<Msp::FS::Path> sources;
        std::vector<std::string> overlays;
-       bool install;
+       bool install = false;
        BuildInfo build_info;
        Package::Requirements requires;
-       bool deflt;
+       bool deflt = true;
        InstallMap install_map;
        std::vector<std::string> problems;
 
index 74d582e7017ddd62bd7189b10c89faabe96f5d6f..48864a9fac64f8fb33d7f4143acac3cb1a27c5ba 100644 (file)
@@ -13,8 +13,7 @@ using namespace std;
 using namespace Msp;
 
 Config::Config(SourcePackage &p):
-       package(p),
-       changed(false)
+       package(p)
 { }
 
 const Config::Option &Config::add_option(const Feature &f)
index a82e53685c390b0fdc7e528b1a2ad9a71b3199b2..37508b056ef21f946592334a1078dcb5b7ab4341 100644 (file)
@@ -40,7 +40,7 @@ private:
        std::map<std::string, Option> options;
        InputOptions pending_options;
        Msp::Time::TimeStamp mtime;
-       mutable bool changed;
+       mutable bool changed = false;
 
 public:
        Config(SourcePackage &);
index 33ffcebc4622889eaed085e371cc19fbb8a348df..37a36d39150da641b3a39e91d5c0fb866576af02 100644 (file)
@@ -11,13 +11,7 @@ using namespace Msp;
 
 ExternalTask::ExternalTask(const Arguments &a, const FS::Path &wd):
        argv(a),
-       work_dir(wd),
-       process(0),
-       exit_code(-1),
-       stdin_action(PASSTHROUGH),
-       stdout_action(PASSTHROUGH),
-       stderr_action(PASSTHROUGH),
-       capture_pipe(0)
+       work_dir(wd)
 {
        if(argv.empty())
                throw invalid_argument("ExternalTask::ExternalTask");
index 3de1e4ac139946f26654f1fda57a2dbb65fef2ae..9b9bc438867ce5884241249dedbe6b511af87ed8 100644 (file)
@@ -29,14 +29,14 @@ public:
 private:
        Arguments argv;
        Msp::FS::Path work_dir;
-       Msp::Process *process;
-       int exit_code;
-       StreamAction stdin_action;
+       Msp::Process *process = 0;
+       int exit_code = -1;
+       StreamAction stdin_action = PASSTHROUGH;
        Msp::FS::Path stdin_file;
-       StreamAction stdout_action;
+       StreamAction stdout_action = PASSTHROUGH;
        Msp::FS::Path stdout_file;
-       StreamAction stderr_action;
-       Msp::IO::Pipe *capture_pipe;
+       StreamAction stderr_action = PASSTHROUGH;
+       Msp::IO::Pipe *capture_pipe = 0;
        std::string output;
 
 public:
index 7bf9a578e0344a6321a1b1e9516af565221b3c6a..891ba72c8514452094a3bef79feb14cb08a3be9a 100644 (file)
@@ -4,9 +4,7 @@ using namespace std;
 using namespace Msp;
 
 Feature::Feature(const string &n):
-       name(n),
-       default_value("no"),
-       exported(false)
+       name(n)
 { }
 
 
index 2ab2081ec213e4a9658fa4852de2d87017c71db5..f8ec33471de5995e255e68c048a203e8ade78be2 100644 (file)
@@ -16,9 +16,9 @@ struct Feature
 
        std::string name;
        std::string description;
-       std::string default_value;
+       std::string default_value = "no";
        std::vector<std::string> choices;
-       bool exported;
+       bool exported = false;
 
        Feature(const std::string &);
 };
index 1434372ed3b5bf6c14d6a758e4b9f28433ea7d59..07be2c9fc806ff234fe77cd1292d4159ea44d871 100644 (file)
@@ -14,25 +14,18 @@ using namespace std;
 using namespace Msp;
 
 FileTarget::FileTarget(Builder &b, const FS::Path &a):
-       Target(b, generate_name(b, 0, a)),
-       path(a)
-{
-       init(0);
-}
+       FileTarget(b, 0, a)
+{ }
 
 FileTarget::FileTarget(Builder &b, const SourcePackage &p, const FS::Path &a):
-       Target(b, generate_name(b, &p, a)),
-       path(a)
-{
-       init(&p);
-}
+       FileTarget(b, &p, a)
+{ }
 
-void FileTarget::init(const SourcePackage *p)
+FileTarget::FileTarget(Builder &b, const SourcePackage *p, const FS::Path &a):
+       Target(b, generate_name(b, p, a)),
+       path(a)
 {
-       size = 0;
        package = p;
-       nested_build_sig = false;
-       arch_in_build_sig = false;
 
        builder.get_vfs().register_path(path, this);
 
index 5c11b5cfc4e7de82bb45cd1dabc06b882d5038e8..aff1fb7a4081cad3bddb098281389bbe63d9861f 100644 (file)
@@ -13,16 +13,16 @@ class FileTarget: public Target
 protected:
        Msp::FS::Path path;
        Msp::Time::TimeStamp mtime;
-       unsigned size;
+       unsigned size = 0;
        Msp::FS::Path install_location;
        std::string install_filename;
-       bool nested_build_sig;
-       bool arch_in_build_sig;
+       bool nested_build_sig = false;
+       bool arch_in_build_sig = false;
 
        FileTarget(Builder &, const Msp::FS::Path &);
        FileTarget(Builder &, const SourcePackage &, const Msp::FS::Path &);
 private:
-       void init(const SourcePackage *);
+       FileTarget(Builder &, const SourcePackage *, const Msp::FS::Path &);
        void stat();
        static std::string generate_name(Builder &, const SourcePackage *, const Msp::FS::Path &);
 
index 0644e9474348ba6e228eb71de0124bd7408fa2ca..821f7469f10f41c6d9bf870b464b519f36c81dd6 100644 (file)
@@ -28,8 +28,8 @@ private:
                Task *run(const Target &) const override;
        };
 
-       Linker *default_linker;
-       Linker *cxx_linker;
+       Linker *default_linker = 0;
+       Linker *cxx_linker = 0;
 
 public:
        GnuLinker(Builder &, const Architecture &);
index 3cdc103f8ef190aa0cd6d672f1cf985ea620c1cd..9d2ea8fae42da17f392d6913e0bdd1d8181c4121 100644 (file)
@@ -11,8 +11,7 @@ using namespace std;
 using namespace Msp;
 
 ImportLibrary::ImportLibrary(Builder &b, const FS::Path &p):
-       FileTarget(b, p),
-       shared_lib(0)
+       FileTarget(b, p)
 { }
 
 ImportLibrary::ImportLibrary(Builder &b, const Component &c, SharedLibrary &sl, ExportDefinitions &exp):
index 26c116da5707e880ebf00e9bc96e3031128a92d3..e985be7c54947f0273ed870a6a187d1f1a510372 100644 (file)
@@ -13,7 +13,7 @@ platforms with no true dynamic linking support.
 class ImportLibrary: public FileTarget
 {
 private:
-       SharedLibrary *shared_lib;
+       SharedLibrary *shared_lib = 0;
 
 public:
        ImportLibrary(Builder &, const Msp::FS::Path &);
index 5cbbd09ad0dc787e36cd37f3d729cc2e7c77fdbb..0f3cbc2ba603771d93df9e7a945e8fcc4de447c0 100644 (file)
@@ -30,8 +30,3 @@ Task::Status InternalTask::wait()
        while((result = check())==RUNNING) ;
        return result;
 }
-
-
-InternalTask::Worker::Worker():
-       status(Task::RUNNING)
-{ }
index db3294bcbb10885841e0fe35dc8d0ad04e6697cc..98b76a0bb3a904391ae4643a76104daebf4cbc25 100644 (file)
@@ -17,9 +17,9 @@ public:
                friend class InternalTask;
 
        protected:
-               volatile Status status;
+               volatile Status status = Task::RUNNING;
 
-               Worker();
+               Worker() = default;
 
        public:
                Status get_status() const { return status; }
index a2f80729878630a2e081caca19a818b8e88e8d4b..00fa6792859962e9a1a0b984bdde70b8c86bf3e4 100644 (file)
@@ -11,8 +11,7 @@ using namespace Msp;
 
 ObjectFile::ObjectFile(Builder &b, const Component &c, SourceFile &s):
        FileTarget(b, c.get_package(), generate_target_path(c, s.get_path())),
-       source(s),
-       used_in_shlib(false)
+       source(s)
 {
        component = &c;
        add_dependency(source);
index 4f116e9f2d99e50e044b259bce2656fa3b214beb..9e3ff90a77c227cf157db6d8e646586409576bd1 100644 (file)
@@ -12,7 +12,7 @@ class ObjectFile: public FileTarget
 {
 private:
        SourceFile &source;
-       bool used_in_shlib;
+       bool used_in_shlib = false;
 
 public:
        ObjectFile(Builder &, const Component &, SourceFile &);
index 6e570c8628eb07f5d1bef95190bc1c539b2454d9..10c2db01d307c47a357b790ef3dd73cda87c980e 100644 (file)
@@ -8,9 +8,7 @@ using namespace Msp;
 Package::Package(Builder &b, const string &n):
        builder(b),
        name(n),
-       label(string(1, toupper(n[0]))+n.substr(1)),
-       prepared(false),
-       use_pkgconfig(true)
+       label(string(1, toupper(n[0]))+n.substr(1))
 {
        builder.get_package_manager().add_package(this);
 }
index bb3c809642c42f43aee233389b49723bbb5a33ce..d13aa737b985a71a8a99242445bb5915472c66d3 100644 (file)
@@ -37,10 +37,10 @@ protected:
 
        Requirements requires;
        BuildInfo export_binfo;
-       bool prepared;
+       bool prepared = false;
        std::vector<std::string> problems;
 
-       bool use_pkgconfig;
+       bool use_pkgconfig = true;
 
        Package(Builder &, const std::string &);
 public:
index 31b24613b6f4c468957208ae412c68fa9775d656..9e53bb422034e8714d970493e7de8768ac677f9a 100644 (file)
@@ -17,10 +17,7 @@ using namespace std;
 using namespace Msp;
 
 PackageManager::PackageManager(Builder &b):
-       builder(b),
-       no_externals(false),
-       main_pkg(0),
-       env_set(false)
+       builder(b)
 { }
 
 PackageManager::~PackageManager()
index d5cfb52e51d5b8493e4adc9d2caf7e4e0319b622..22f1eacfbbe6eaf3eabce855ed69aa2350dc4ceb 100644 (file)
@@ -22,11 +22,11 @@ private:
        std::vector<Msp::FS::Path> pkg_dirs;
        std::vector<Msp::FS::Path> binpkg_path;
        std::vector<Msp::FS::Path> binpkg_files;
-       bool no_externals;
+       bool no_externals = false;
        std::map<std::string, Package *> packages;
-       Package *main_pkg;
+       Package *main_pkg = 0;
        std::set<std::string> not_found;
-       bool env_set;
+       bool env_set = false;
 
 public:
        PackageManager(Builder &);
index 4ef9bb6fdf09bfd76ab7820f6cbc4f58515e1d5b..0673a05e09b61b76ba9befbfe61a52bfe635af3c 100644 (file)
@@ -10,8 +10,7 @@ using namespace std;
 using namespace Msp;
 
 SharedLibrary::SharedLibrary(Builder &b, const Msp::FS::Path &p):
-       Binary(b, p),
-       import_lib(0)
+       Binary(b, p)
 {
        libname = FS::basepart(FS::basename(path));
        if(!libname.compare(0, 3, "lib"))
index 54822aadcd0bfd794606a1444a80c06837df38a6..564b2102004d714da37d3042dd682cf37e488b95 100644 (file)
@@ -19,7 +19,7 @@ class SharedLibrary: public Binary
 private:
        std::string libname;
        std::string soname;
-       ImportLibrary *import_lib;
+       ImportLibrary *import_lib = 0;
 
 public:
        SharedLibrary(Builder &, const Msp::FS::Path &);
index 40b098ca10931b4bf31651f80b7dcbb64beded83..2c478a861d9023e9b423cd55a4079e40dfc8fe10 100644 (file)
@@ -27,7 +27,6 @@ using namespace Msp;
 SourcePackage::SourcePackage(Builder &b, const string &n, const FS::Path &f):
        Package(b, n),
        source_dir(FS::dirname(f)),
-       build_type(0),
        config(*this),
        cache(*this)
 {
index 23e8f36320aaf5de5393bffb9ef5ab3268c7ee06..8be8ada63d654f68a963feb55cdec9f8c7544d77 100644 (file)
@@ -53,7 +53,7 @@ private:
 
        FileTarget *build_file;
        Msp::FS::Path source_dir;
-       const BuildType *build_type;
+       const BuildType *build_type = 0;
        Toolchain local_tools;
        std::vector<Feature> features;
        BuildInfo build_info;
index 055abb56982203e6645873d10b428dae8e3e488f..d701859524b19ef662e8e6178ef352a011c2e7cb 100644 (file)
@@ -13,12 +13,7 @@ using namespace Msp;
 
 Target::Target(Builder &b, const string &n):
        builder(b),
-       package(0),
-       component(0),
-       name(n),
-       tool(0),
-       state(INIT),
-       primary_target(0)
+       name(n)
 {
        builder.get_build_graph().add_target(this);
 }
index 2824e2a806589c4ce4c948b90dcf37a89fe18c36..6ef6457a0f5fe73d70ddc31d7f66b561e878b63b 100644 (file)
@@ -46,19 +46,19 @@ public:
 
 protected:
        Builder &builder;
-       const SourcePackage *package;
-       const Component *component;
+       const SourcePackage *package = 0;
+       const Component *component = 0;
        std::string name;
 
-       Tool *tool;
-       State state;
+       Tool *tool = 0;
+       State state = INIT;
        std::string rebuild_reason;
        std::vector<std::string> problems;
 
        Dependencies depends;
        Dependencies trans_depends;
        Dependencies side_effects;
-       Target *primary_target;
+       Target *primary_target = 0;
 
        Target(Builder &, const std::string &);
 public:
index d969a7afa495f4c7076b5a8583b94679b0f25650..e72a7415de285767ee93369051fb384113b8d2a1 100644 (file)
@@ -6,10 +6,6 @@
 using namespace std;
 using namespace Msp;
 
-Task::Task():
-       unlink(false)
-{ }
-
 void Task::add_file(const FS::Path &f)
 {
        files.push_back(f);
index 97cf8d627b1bedaae6c338b64399107047e95e30..915ffe12a9e774f27adc9caede2736b59779492e 100644 (file)
@@ -24,9 +24,9 @@ public:
 
 protected:
        std::vector<Msp::FS::Path> files;
-       bool unlink;
+       bool unlink = false;
 
-       Task();
+       Task() = default;
 public:
        virtual ~Task() { }
 
index da7054abf3fdb5959b880e5772e55cde08863d2b..5d0903a2e3c4eb44902ccd9d178c5aa207655e6a 100644 (file)
@@ -10,21 +10,17 @@ using namespace std;
 using namespace Msp;
 
 Tool::Tool(Builder &b, const string &t):
-       builder(b),
-       architecture(0),
-       tag(t),
-       executable(0),
-       processing_unit(ONE_FILE),
-       prepared(false)
+       Tool(b, 0, t)
 { }
 
 Tool::Tool(Builder &b, const Architecture &a, const string &t):
+       Tool(b, &a, t)
+{ }
+
+Tool::Tool(Builder &b, const Architecture *a, const string &t):
        builder(b),
-       architecture(&a),
-       tag(t),
-       executable(0),
-       processing_unit(ONE_FILE),
-       prepared(false)
+       architecture(a),
+       tag(t)
 { }
 
 void Tool::set_command(const string &cmd, bool cross)
index ce08a00af62aedc0aae64b8d901d579881103797..e1bef2d8652031324338de553b5c46689213a194 100644 (file)
@@ -31,26 +31,28 @@ public:
 
 protected:
        Builder &builder;
-       const Architecture *architecture;
+       const Architecture *architecture = 0;
        std::string tag;
        std::string command;
-       FileTarget *executable;
+       FileTarget *executable = 0;
        std::vector<std::string> input_suffixes;
        std::vector<std::string> aux_suffixes;
-       ProcessingUnit processing_unit;
+       ProcessingUnit processing_unit = ONE_FILE;
        VirtualFileSystem::SearchPath system_path;
        BuildInfo build_info;
-       bool prepared;
+       bool prepared = false;
        std::vector<std::string> problems;
 
        Tool(Builder &, const std::string &);
        Tool(Builder &, const Architecture &, const std::string &);
+private:
+       Tool(Builder &, const Architecture *, const std::string &);
 public:
        virtual ~Tool() { }
 
        const std::string &get_tag() const { return tag; }
 
-       /** Returns the architecture this tool build for.  May return null if the
+       /** Returns the architecture this tool builds for.  May return null if the
        tool is architecture-agnostic. */
        const Architecture *get_architecture() const { return architecture; }