]> git.tdb.fi Git - builder.git/commitdiff
Convert all list containers to vectors
authorMikko Rasa <tdb@tdb.fi>
Wed, 21 Dec 2022 09:23:37 +0000 (11:23 +0200)
committerMikko Rasa <tdb@tdb.fi>
Wed, 21 Dec 2022 09:25:30 +0000 (11:25 +0200)
94 files changed:
source/analyzer.cpp
source/analyzer.h
source/androidapplicationcomponent.cpp
source/androidassetpackagingtool.cpp
source/androidassetpackagingtool.h
source/androidlinker.cpp
source/androidlinker.h
source/androidmanifestgenerator.cpp
source/androidmanifestgenerator.h
source/androidpackagefile.cpp
source/androidpackagefile.h
source/androidresourcebundle.cpp
source/androidresourcebundle.h
source/apkbuilder.cpp
source/apkbuilder.h
source/architecture.h
source/binary.cpp
source/binary.h
source/binarycomponent.cpp
source/binarycomponent.h
source/binarypackage.cpp
source/binarypackage.h
source/builder.cpp
source/builder.h
source/buildercli.cpp
source/buildercli.h
source/buildinfo.cpp
source/buildinfo.h
source/cache.h
source/compilecommandsgenerator.cpp
source/compilecommandsgenerator.h
source/component.cpp
source/component.h
source/copy.cpp
source/copy.h
source/csourcefile.cpp
source/csourcefile.h
source/datapack.cpp
source/datapack.h
source/datapackcomponent.cpp
source/datatool.cpp
source/datatool.h
source/datatransform.cpp
source/executable.cpp
source/executable.h
source/exportdefinitions.cpp
source/exportdefinitions.h
source/feature.h
source/filetarget.cpp
source/gnuarchiver.cpp
source/gnuarchiver.h
source/gnucompiler.cpp
source/gnucompiler.h
source/gnulinker.cpp
source/gnulinker.h
source/installmap.h
source/jarsigner.cpp
source/jarsigner.h
source/mingwdlltool.cpp
source/mingwdlltool.h
source/msvcarchiver.cpp
source/msvcarchiver.h
source/msvccompiler.cpp
source/msvccompiler.h
source/msvclinker.cpp
source/msvclinker.h
source/package.h
source/packagemanager.h
source/pattern.cpp
source/pattern.h
source/pkgconfiggenerator.cpp
source/pkgconfiggenerator.h
source/sharedlibrary.cpp
source/sharedlibrary.h
source/sourcearchivecomponent.cpp
source/sourcegenerator.cpp
source/sourcegenerator.h
source/sourcepackage.cpp
source/sourcepackage.h
source/staticlibrary.cpp
source/staticlibrary.h
source/tar.cpp
source/tar.h
source/target.h
source/task.h
source/tool.cpp
source/tool.h
source/toolchain.h
source/vcxprojectgenerator.cpp
source/vcxprojectgenerator.h
source/virtualfilesystem.cpp
source/virtualfilesystem.h
source/vssolutiongenerator.cpp
source/vssolutiongenerator.h

index 4cebafad175ae6d7cc3a1a2459ffbba4c4d1709e..94f7782e2848632906b78360384ad1ed365295c8 100644 (file)
@@ -1,3 +1,4 @@
+#include <msp/core/algorithm.h>
 #include <msp/fs/utils.h>
 #include <msp/io/print.h>
 #include "analyzer.h"
@@ -114,7 +115,7 @@ void Analyzer::build_depend_table(Target &tgt, unsigned depth)
                        depends.insert(depends.end(), tdeps.begin(), tdeps.end());
                }
 
-               depends.sort(full_paths ? target_order_full : target_order);
+               sort(depends, (full_paths ? target_order_full : target_order));
 
                for(Target *d: depends)
                        build_depend_table(*d, depth+1);
index 373150b847690039a77e402a737e5d57c8bdef9f..4c9e14641a2fc02af7be622836997804d1c0f3fe 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef ANALYZER_H_
 #define ANALYZER_H_
 
-#include <list>
 #include <map>
 #include <set>
 #include <string>
@@ -29,7 +28,7 @@ private:
 
        Builder &builder;
        Mode mode;
-       std::list<TableRow> table;
+       std::vector<TableRow> table;
        unsigned max_depth;
        bool full_paths;
        std::map<const Target *, std::set<Target *> > rdepends;
index 95eb9447dc3fe8bd88e684d1e86a6c876ef3f9a7..212db7d5df08755bdb68a610d22c5ecacfc0095f 100644 (file)
@@ -22,7 +22,7 @@ void AndroidApplicationComponent::create_targets() const
        Builder &builder = package.get_builder();
        BuildGraph &build_graph = builder.get_build_graph();
 
-       list<Target *> contents;
+       vector<Target *> contents;
        for(const auto &kvp: build_graph.get_targets())
                if(kvp.second->get_package()==&package)
                        if(InstalledFile *inst = dynamic_cast<InstalledFile *>(kvp.second))
@@ -33,7 +33,7 @@ void AndroidApplicationComponent::create_targets() const
        for(const string &p: permissions)
                manifest->add_permission(p);
 
-       list<Target *> resource_sources;
+       vector<Target *> resource_sources;
        resource_sources.push_back(manifest);
 
        const Toolchain &toolchain = builder.get_toolchain();
@@ -47,7 +47,8 @@ void AndroidApplicationComponent::create_targets() const
        Tool &aapt = toolchain.get_tool("AAPT");
        Target *resource_bundle = aapt.create_target(resource_sources);
 
-       list<Target *> apk_sources;
+       vector<Target *> apk_sources;
+       apk_sources.reserve(1+contents.size());
        apk_sources.push_back(resource_bundle);
 
        const Architecture &arch = package.get_builder().get_current_arch();
index 0ef99a7dca4ea9d150203b0205aaab8a7f18f356..3d867472d6c2699302623d5edac52df6559642fc 100644 (file)
@@ -25,10 +25,11 @@ AndroidAssetPackagingTool::AndroidAssetPackagingTool(Builder &b, const AndroidSd
                problems.push_back("Android platform not found");
 }
 
-Target *AndroidAssetPackagingTool::create_target(const list<Target *> &sources, const string &)
+Target *AndroidAssetPackagingTool::create_target(const vector<Target *> &sources, const string &)
 {
        AndroidManifestFile *manifest = 0;
-       list<FileTarget *> resources;
+       vector<FileTarget *> resources;
+       resources.reserve(sources.size());
        for(Target *s: sources)
        {
                if(AndroidManifestFile *m = dynamic_cast<AndroidManifestFile *>(s))
@@ -61,7 +62,8 @@ Task *AndroidAssetPackagingTool::run(const Target &tgt) const
        argv.push_back("-F");
        argv.push_back(FS::relative(res.get_path(), work_dir).str());
 
-       list<FS::Path> resource_dirs;
+       vector<FS::Path> resource_dirs;
+       resource_dirs.reserve(res.get_dependencies().size());
        for(Target *d: res.get_dependencies())
        {
                FileTarget *file = dynamic_cast<FileTarget *>(d);
index 639da92359ccd09b958cd838caaad1bd988022f3..8f01e6daadf8e3fc372244c0d060d7fb8a673634 100644 (file)
@@ -13,7 +13,7 @@ private:
 public:
        AndroidAssetPackagingTool(Builder &, const AndroidSdk &);
 
-       Target *create_target(const std::list<Target *> &, const std::string &) override;
+       Target *create_target(const std::vector<Target *> &, const std::string &) override;
        Task *run(const Target &) const override;
 };
 
index 67c76c29fe908ba3a3dea1131f0872e31fbb4744..2cacf38cb2bacd864d35ab73c4b18fe98bee2b01 100644 (file)
@@ -9,7 +9,7 @@ AndroidLinker::AndroidLinker(Builder &b, const Architecture &a, const AndroidNdk
        build_info.sysroot = ndk.get_platform_sysroot();
 }
 
-Target *AndroidLinker::create_target(const list<Target *> &sources, const string &)
+Target *AndroidLinker::create_target(const vector<Target *> &sources, const string &)
 {
        return GnuLinker::create_target(sources, "shared");
 }
index 9d880d274aa0622bf2a4627148c200742bfd3dfe..269d1687d91472016f49f3e555bdd3d9bf385fbd 100644 (file)
@@ -10,7 +10,7 @@ class AndroidLinker: public GnuLinker
 public:
        AndroidLinker(Builder &, const Architecture &, const AndroidNdk &);
 
-       Target *create_target(const std::list<Target *> &, const std::string &) override;
+       Target *create_target(const std::vector<Target *> &, const std::string &) override;
 };
 
 #endif
index 1d2f330da0f6dbf75ea8053c7fc2e3e27e9bceae..b9d67dfb3201dc83317e9fa0cd83e71c4aac86c2 100644 (file)
@@ -13,7 +13,7 @@ AndroidManifestGenerator::AndroidManifestGenerator(Builder &b):
        Tool(b, "AMG")
 { }
 
-Target *AndroidManifestGenerator::create_target(const list<Target *> &, const string &)
+Target *AndroidManifestGenerator::create_target(const vector<Target *> &, const string &)
 {
        throw logic_error("not implemented");
 }
index c2c2a95741a2ea886b82eb2f8b53924da1895ad8..7c6e44c3647958a19f05ca7bdbb5c88b313b3019 100644 (file)
@@ -24,7 +24,7 @@ private:
 public:
        AndroidManifestGenerator(Builder &);
 
-       Target *create_target(const std::list<Target *> &, const std::string &) override;
+       Target *create_target(const std::vector<Target *> &, const std::string &) override;
        Task *run(const Target &) const override;
 };
 
index 22eedec6cca8499d57cfa5ef3fd50bfbfd2d840a..9dee78f3b6717447804bf7dd5dd51662ea635c9c 100644 (file)
@@ -5,7 +5,7 @@
 
 using namespace std;
 
-AndroidPackageFile::AndroidPackageFile(Builder &b, const Component &c, AndroidResourceBundle &resource_bundle, const list<FileTarget *> &other_files):
+AndroidPackageFile::AndroidPackageFile(Builder &b, const Component &c, AndroidResourceBundle &resource_bundle, const vector<FileTarget *> &other_files):
        FileTarget(b, c.get_package(), c.get_package().get_output_directory()/(c.get_name()+".apk"))
 {
        component = &c;
index 644b5d46163fcf30a2579552c62a1b678e9b9222..c5f237acbe1adae1d3ceff054573a1a9e3c202cf 100644 (file)
@@ -8,7 +8,7 @@ class AndroidResourceBundle;
 class AndroidPackageFile: public FileTarget
 {
 public:
-       AndroidPackageFile(Builder &, const Component &, AndroidResourceBundle &, const std::list<FileTarget *> &);
+       AndroidPackageFile(Builder &, const Component &, AndroidResourceBundle &, const std::vector<FileTarget *> &);
 
        const char *get_type() const override { return "AndroidPackageFile"; }
 };
index 2918b0532a11ff84a0238fd193909638e4378422..8113c004ef6e0511d0a1cd034a910007f92faf26 100644 (file)
@@ -5,7 +5,7 @@
 
 using namespace std;
 
-AndroidResourceBundle::AndroidResourceBundle(Builder &b, const Component &c, AndroidManifestFile &manifest, const list<FileTarget *> &resources):
+AndroidResourceBundle::AndroidResourceBundle(Builder &b, const Component &c, AndroidManifestFile &manifest, const vector<FileTarget *> &resources):
        FileTarget(b, c.get_package(), c.get_package().get_temp_directory()/c.get_name()/(c.get_name()+".ap_"))
 {
        component = &c;
index 92fc2b854cbb62dbbc539a341db2baed78a0b6bf..18c07e07900c885b4b47ab1d026f8cf0ee167440 100644 (file)
@@ -8,7 +8,7 @@ class AndroidManifestFile;
 class AndroidResourceBundle: public FileTarget
 {
 public:
-       AndroidResourceBundle(Builder &, const Component &, AndroidManifestFile &, const std::list<FileTarget *> &);
+       AndroidResourceBundle(Builder &, const Component &, AndroidManifestFile &, const std::vector<FileTarget *> &);
 
        const char *get_type() const override { return "AndroidResourceBundle"; }
 };
index 2568f33e081bce17a8852300ca09bf75da758e4f..0e141631e7556805fd534e7edb8e5d65ca70252a 100644 (file)
@@ -21,10 +21,11 @@ ApkBuilder::ApkBuilder(Builder &b):
        set_command("jar");
 }
 
-Target *ApkBuilder::create_target(const list<Target *> &sources, const string &)
+Target *ApkBuilder::create_target(const vector<Target *> &sources, const string &)
 {
        AndroidResourceBundle *resource_bundle = 0;
-       list<FileTarget *> other_files;
+       vector<FileTarget *> other_files;
+       other_files.reserve(sources.size());
        for(Target *s: sources)
        {
                if(AndroidResourceBundle *r = dynamic_cast<AndroidResourceBundle *>(s))
@@ -52,7 +53,8 @@ Task *ApkBuilder::run(const Target &tgt) const
        argv.push_back("u");
 
        FS::Path input_path;
-       list<FS::Path> files;
+       vector<FS::Path> files;
+       files.reserve(apk.get_dependencies().size());
        for(Target *d: apk.get_dependencies())
        {
                FileTarget *file = dynamic_cast<FileTarget *>(d);
index 673063e61287ca202420b71ab7548e71c68cbf95..7346b759d483b13bdb0fdd0613dcdfba43fe6a55 100644 (file)
@@ -11,7 +11,7 @@ private:
 public:
        ApkBuilder(Builder &);
 
-       Target *create_target(const std::list<Target *> &, const std::string &) override;
+       Target *create_target(const std::vector<Target *> &, const std::string &) override;
 protected:
        void do_prepare() override;
 public:
index 776de858b03fcc2b587771e73f9322ab29f1d815..a31ad9fc6fd1c979bac3c8b5502282e573e7d1e6 100644 (file)
@@ -32,7 +32,7 @@ private:
        std::string name;
        bool native;
        std::string cross_prefix;
-       std::map<std::string, std::list<Pattern>> filename_patterns;
+       std::map<std::string, std::vector<Pattern>> filename_patterns;
 
 public:
        Architecture(Builder &b, const std::string &spec);
@@ -52,7 +52,7 @@ public:
        const std::string &get_cross_prefix() const { return cross_prefix; }
 
        template<typename T>
-       const std::list<Pattern> &get_patterns() const;
+       const std::vector<Pattern> &get_patterns() const;
 
        template<typename T>
        std::string create_filename(const std::string &) const;
@@ -67,20 +67,20 @@ private:
 };
 
 template<typename T>
-inline const std::list<Pattern> &Architecture::get_patterns() const
+inline const std::vector<Pattern> &Architecture::get_patterns() const
 {
        auto i = filename_patterns.find(typeid(T).name());
        if(i!=filename_patterns.end())
                return i->second;
 
-       static std::list<Pattern> empty;
+       static std::vector<Pattern> empty;
        return empty;
 }
 
 template<typename T>
 inline std::string Architecture::create_filename(const std::string &base) const
 {
-       const std::list<Pattern> &patterns = get_patterns<T>();
+       const std::vector<Pattern> &patterns = get_patterns<T>();
        return patterns.empty() ? base : patterns.front().apply(base);
 }
 
index 7b5bac8e1b0dae70d977cc68326b94aba438bdcd..ffffaa56feed8a1ad15f9472c86f47d3f748f834 100644 (file)
@@ -18,7 +18,7 @@ Binary::Binary(Builder &b, const FS::Path &p):
        FileTarget(b, p)
 { }
 
-Binary::Binary(Builder &b, const Component &c, const string &p, const list<ObjectFile *> &objs):
+Binary::Binary(Builder &b, const Component &c, const string &p, const vector<ObjectFile *> &objs):
        FileTarget(b, c.get_package(), c.get_package().get_output_directory()/p),
        objects(objs)
 {
index a9e8de1c8e89bb883ee24f1e6032c42836833c8a..16ed1ecf95148b6c028a727dbb40d0af49946216 100644 (file)
@@ -17,10 +17,10 @@ private:
        BuildInfo static_binfo;
 
 protected:
-       std::list<ObjectFile *> objects;
+       std::vector<ObjectFile *> objects;
 
        Binary(Builder &, const Msp::FS::Path &);
-       Binary(Builder &, const Component &, const std::string &, const std::list<ObjectFile *> &);
+       Binary(Builder &, const Component &, const std::string &, const std::vector<ObjectFile *> &);
 
 public:
        void collect_build_info(BuildInfo &) const override;
index f1aaa0eb006b22a5366a1b5bc12766e08806b45e..608ed3f6596b51b13522333358f2214cf6f093c1 100644 (file)
@@ -53,8 +53,9 @@ void BinaryComponent::create_targets() const
        const Toolchain &toolchain = builder.get_toolchain();
        const Toolchain &pkg_tools = package.get_toolchain();
 
-       list<Target *> objs;
-       list<FS::Path> source_filenames = collect_source_files();
+       vector<Target *> objs;
+       vector<FS::Path> source_filenames = collect_source_files();
+       objs.reserve(source_filenames.size());
        for(auto i=source_filenames.begin(); i!=source_filenames.end(); ++i)
        {
                string ext = FS::extpart(FS::basename(*i));
@@ -63,22 +64,21 @@ void BinaryComponent::create_targets() const
                Tool *gen = pkg_tools.get_tool_for_suffix(ext);
                if(gen)
                {
-                       list<Target *> templates;
+                       vector<Target *> templates;
                        templates.push_back(gen->create_source(*this, *i));
 
                        Tool::ProcessingUnit processing_unit = gen->get_processing_unit();
                        if(processing_unit!=Tool::ONE_FILE)
                        {
                                FS::Path source_dir = FS::dirname(*i);
-                               auto j = i;
-                               for(++j; j!=source_filenames.end(); )
+                               for(auto j=next(i); j!=source_filenames.end(); )
                                {
                                        if((processing_unit!=Tool::DIRECTORY || FS::dirname(*j)==source_dir) &&
                                                pkg_tools.get_tool_for_suffix(FS::extpart(FS::basename(*j)))==gen)
                                        {
                                                templates.push_back(gen->create_source(*this, *j));
                                                // Remove additional files so they won't get processed again
-                                               source_filenames.erase(j++);
+                                               j = source_filenames.erase(j);
                                        }
                                        else
                                                ++j;
@@ -117,7 +117,8 @@ void BinaryComponent::create_targets() const
 
        Tool &linker = toolchain.get_tool("LINK");
 
-       list<Target *> results;
+       vector<Target *> results;
+       results.reserve(2);
        if(type==LIBRARY)
        {
                Tool &archiver = toolchain.get_tool("AR");
index c31fff2582eff09ee327ad4021fd3c49b97cea7e..eca9508fd26da06b3fdfbe87486131d7fc2f9e02 100644 (file)
@@ -23,7 +23,7 @@ public:
 
 private:
        Type type;
-       std::list<const Component *> uses;
+       std::vector<const Component *> uses;
 
 public:
        BinaryComponent(SourcePackage &, const std::string &, Type);
index c0d688afdbb45532f7368d0d2bbb8065ac34301e..66d1225f81b0643cea6eb4dd384c53366aa90690 100644 (file)
@@ -60,7 +60,7 @@ void BinaryPackage::do_prepare()
        bool has_relative_paths = any_of(export_binfo.libpath.begin(), export_binfo.libpath.end(), is_relative) ||
                any_of(export_binfo.incpath.begin(), export_binfo.incpath.end(), is_relative);
 
-       list<FS::Path> bases;
+       vector<FS::Path> bases;
 
        /* If we have any relative paths that need resolving, or we have no paths at
        all and are not using pkg-config, look for files in prefix */
index b96015589e04ea45c164ecbb92fae08fc8c109e4..62a8acf3fc6ba70bc2a2d2c215c7359cf8b8a5d9 100644 (file)
@@ -23,7 +23,7 @@ public:
 
 private:
        Msp::FS::Path base_path;
-       std::list<std::string> headers;
+       std::vector<std::string> headers;
        BuildInfo static_binfo;
 
 public:
index 46bc704140690a1678af3f3f8f4f3b06ed218818..1b8ed3c16eb538d17afbc3933089f750bd12e4be 100644 (file)
@@ -1,3 +1,4 @@
+#include <deque>
 #include <set>
 #include <msp/core/except.h>
 #include <msp/core/maputils.h>
@@ -113,9 +114,9 @@ void Builder::set_logger(const Logger *l)
        logger = (l ? l : &default_logger);
 }
 
-list<string> Builder::collect_problems() const
+vector<string> Builder::collect_problems() const
 {
-       list<string> problems;
+       vector<string> problems;
        set<const Package *> broken_packages;
        set<const Component *> broken_components;
        set<const Tool *> broken_tools;
@@ -267,7 +268,7 @@ int Builder::clean(bool all, bool dry_run)
        // Cleaning doesn't care about ordering, so a simpler method can be used
 
        set<Target *> clean_tgts;
-       list<Target *> queue;
+       deque<Target *> queue;
        queue.push_back(&build_graph.get_goals());
 
        while(!queue.empty())
index b7b0b78b407e4445a1f354b74e08d7571f3a9aaf..5d62a9a1ec759b1d6d2e06eb91aa363cfcb617a6 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef BUILDER_H_
 #define BUILDER_H_
 
-#include <list>
 #include <map>
 #include <string>
 #include <msp/datafile/loader.h>
@@ -86,7 +85,7 @@ public:
        void set_logger(const Logger *);
        const Logger &get_logger() const { return *logger; }
 
-       std::list<std::string> collect_problems() const;
+       std::vector<std::string> collect_problems() const;
 
        /** Loads a build file.  If opts is not null, it is used to configure any
        packages loaded from this file.  If all is true, external packages are also
index 8ba8d96bdba0e105ac3f43bf811fbe05af9eddb8..2469f5162862faf199f0931105cede9e0f0b72fa 100644 (file)
@@ -39,7 +39,7 @@ BuilderCLI::BuilderCLI(int argc, char **argv):
        bool no_externals = false;
        unsigned verbose = 1;
        bool silent = false;
-       list<string> log_channels;
+       vector<string> log_channels;
        string build_type;
 
        GetOpt getopt;
@@ -136,7 +136,7 @@ BuilderCLI::BuilderCLI(int argc, char **argv):
 
        builder.set_architecture(tolower(arch));
 
-       list<FS::Path> start_files;
+       vector<FS::Path> start_files;
        start_files.push_back(FS::get_sys_data_dir()/"builderrc");
        start_files.push_back(FS::get_user_data_dir()/"rc");
        for(const FS::Path &f: start_files)
@@ -224,7 +224,7 @@ int BuilderCLI::main()
 
        BuildGraph &build_graph = builder.get_build_graph();
        PackageManager &package_manager = builder.get_package_manager();
-       list<string> package_details;
+       vector<string> package_details;
        for(const auto &kvp: package_manager.get_packages())
        {
                if(!kvp.second->is_prepared())
@@ -265,7 +265,7 @@ int BuilderCLI::main()
 
        if(build_graph.get_goals().is_broken())
        {
-               list<string> problems = builder.collect_problems();
+               vector<string> problems = builder.collect_problems();
                IO::print(IO::cerr, "The following problems were detected:\n");
                for(const string &p: problems)
                        IO::print(IO::cerr, "  %s\n", p);
index 28388a01b169533290db8e8190388b1c934b5905..4fcdb0395052913b217f529f31b8b66c2e4d494e 100644 (file)
@@ -12,7 +12,7 @@ Provides a command-line interface for Builder.
 class BuilderCLI: public Msp::RegisteredApplication<BuilderCLI>
 {
 private:
-       std::list<std::string> cmdline_targets;
+       std::vector<std::string> cmdline_targets;
        Config::InputOptions cmdline_options;
        Msp::FS::Path cwd;
 
@@ -27,7 +27,7 @@ private:
        bool show_progress;
        std::string build_file;
        unsigned jobs;
-       std::list<std::string> what_if;
+       std::vector<std::string> what_if;
        bool conf_all;
        bool conf_only;
        bool build_all;
index 29254489cf5e6c4b8e747e2ad59cd554492c1a0f..43e1427df6a1cc3cea3a6ae1cd1acec6129d2ac5 100644 (file)
@@ -8,18 +8,19 @@ using namespace Msp;
 
 namespace {
 
-/** Removes any duplicate entries from a list, leaving only the first one.  The
-order of other elements is preserved.  O(nlogn) efficiency. */
+/** Removes any duplicate entries from a vector, leaving only the first one.
+The order of other elements is preserved. */
 template<typename T>
-void unique(list<T> &l)
+void unique(vector<T> &v)
 {
-       set<T> seen;
-       for(auto i=l.begin(); i!=l.end(); )
+       vector<T> seen;
+       for(auto i=v.begin(); i!=v.end(); )
        {
-               if(seen.count(*i))
-                       l.erase(i++);
+               auto j = lower_bound(seen, *i);
+               if(j!=seen.end() && *j==*i)
+                       i = v.erase(i);
                else
-                       seen.insert(*i++);
+                       seen.insert(j, *i++);
        }
 }
 
index f84315c74369b7b73f6f4e839ff0a8701193627f..203ba5fe5bfbc844373f82b5d89c3ed02a16d725 100644 (file)
@@ -1,8 +1,8 @@
 #ifndef BUILDINFO_H_
 #define BUILDINFO_H_
 
-#include <list>
 #include <string>
+#include <vector>
 #include <msp/datafile/objectloader.h>
 #include <msp/fs/path.h>
 
@@ -91,14 +91,14 @@ public:
 
        Tracked<Msp::FS::Path> sysroot;
        std::map<std::string, std::string> defines;
-       std::list<Msp::FS::Path> incpath;
-       std::list<Msp::FS::Path> local_incpath;
-       std::list<Msp::FS::Path> libpath;
-       std::list<std::string> libs;
+       std::vector<Msp::FS::Path> incpath;
+       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;
        std::map<std::string, LibraryMode> libmodes;
-       std::list<std::string> keep_symbols;
+       std::vector<std::string> keep_symbols;
        std::map<std::string, LanguageStandard> standards;
        Tracked<bool> threads;
        Tracked<bool> debug;
index cf7253f717586982f98699d15485dd54d4272766..f3a2c13cb003216b92cd500c5096aa2ed4d14829 100644 (file)
@@ -1,8 +1,8 @@
 #ifndef CACHE_H_
 #define CACHE_H_
 
-#include <list>
 #include <map>
+#include <vector>
 #include <msp/fs/path.h>
 #include <msp/time/timestamp.h>
 
@@ -20,7 +20,7 @@ unprintable characters or nuls.
 class Cache
 {
 public:
-       using Values = std::list<std::string>;
+       using Values = std::vector<std::string>;
 private:
        using Key = std::pair<std::string, std::string>;
 
index 2f4e07b4c2dccdc2d6b62f4d07df9999f7ee7380..82221e7a1c3d37950bd3d70dc7d6973ddcf933dc 100644 (file)
@@ -14,7 +14,7 @@ CompileCommandsGenerator::CompileCommandsGenerator(Builder &b):
        Tool(b, "CCJG")
 { }
 
-Target *CompileCommandsGenerator::create_target(const list<Target *> &, const string &)
+Target *CompileCommandsGenerator::create_target(const vector<Target *> &, const string &)
 {
        throw logic_error("Not implemented");
 }
index 29bb0432ec53afd76280d8203a6f3d5e227269fb..519cad03e7f58f8ebbf479b0910f6e24c9bea5d7 100644 (file)
@@ -24,7 +24,7 @@ private:
 public:
        CompileCommandsGenerator(Builder &);
 
-       Target *create_target(const std::list<Target *> &, const std::string &) override;
+       Target *create_target(const std::vector<Target *> &, const std::string &) override;
        Task *run(const Target &) const override;
 };
 
index 6545b28b95c460ed9b1f34b8ca679cd8aa77e677..a571933bd04eb4d299d4bcac1e09b303390322c3 100644 (file)
@@ -94,14 +94,15 @@ BuildInfo Component::get_build_info_for_path(const FS::Path &path) const
        return binfo;
 }
 
-list<FS::Path> Component::collect_source_files() const
+vector<FS::Path> Component::collect_source_files() const
 {
-       list<FS::Path> files;
+       vector<FS::Path> files;
        for(const FS::Path &p: sources)
        {
                if(FS::is_dir(p))
                {
-                       list<FS::Path> dirs;
+                       vector<FS::Path> dirs;
+                       dirs.reserve(1+overlays.size());
                        dirs.push_back(p);
                        for(const string &o: overlays)
                        {
index 1db925928a9a88cea2221bf98fbc7736cfd0a412..bde558d6281facab3d935a0384898c7797eb0dfa 100644 (file)
@@ -35,14 +35,14 @@ public:
 protected:
        SourcePackage &package;
        std::string name;
-       std::list<Msp::FS::Path> sources;
-       std::list<std::string> overlays;
+       std::vector<Msp::FS::Path> sources;
+       std::vector<std::string> overlays;
        bool install;
        BuildInfo build_info;
        Package::Requirements requires;
        bool deflt;
        InstallMap install_map;
-       std::list<std::string> problems;
+       std::vector<std::string> problems;
 
        Component(SourcePackage &, const std::string &);
 public:
@@ -53,20 +53,20 @@ public:
 
        /** Returns a list of sources for the component.  They may refer to
        directories or individual files. */
-       const std::list<Msp::FS::Path> &get_sources() const { return sources; }
+       const std::vector<Msp::FS::Path> &get_sources() const { return sources; }
 
-       const std::list<std::string> &get_overlays() const { return overlays; }
+       const std::vector<std::string> &get_overlays() const { return overlays; }
 
 protected:
        /** Returns a list of all source files for the component. */
-       std::list<Msp::FS::Path> collect_source_files() const;
+       std::vector<Msp::FS::Path> collect_source_files() const;
 
 public:
        bool get_install() const { return install; }
        const InstallMap &get_install_map() const { return install_map; }
        const Package::Requirements &get_required_packages() const { return requires; }
        bool is_default() const { return deflt; }
-       const std::list<std::string> &get_problems() const { return problems; }
+       const std::vector<std::string> &get_problems() const { return problems; }
 
        /** Prepares any required packages. */
        void prepare();
index 53118de754963dc04095c11be4107a49c0ca9ab2..f7dab415920d09b2bf41374d7e9de6b7ef730588 100644 (file)
@@ -18,7 +18,7 @@ Copy::Copy(Builder &b):
        Tool(b, "CP")
 { }
 
-Target *Copy::create_target(const list<Target *> &sources, const string &arg)
+Target *Copy::create_target(const vector<Target *> &sources, const string &arg)
 {
        FileTarget &file_tgt = dynamic_cast<FileTarget &>(*sources.front());
        InstalledFile *inst = new InstalledFile(builder, *file_tgt.get_package(), file_tgt, arg);
index 6353ab166b27412192c42ec0898b32cc1a3cfdc3..5f20c161126752d0cf34194c857baa8306b53bab 100644 (file)
@@ -31,7 +31,7 @@ private:
 public:
        Copy(Builder &);
 
-       Target *create_target(const std::list<Target *> &, const std::string &) override;
+       Target *create_target(const std::vector<Target *> &, const std::string &) override;
        Task *run(const Target &) const override;
 };
 
index 41dbd437cc836b75697342381f590b1c09f89fc4..e9b0bc8dca7d9c67a7e10d251120de4ac9e593b9 100644 (file)
@@ -55,9 +55,11 @@ void CSourceFile::find_dependencies()
 
        const BuildInfo &build_info = component->get_build_info_for_path(path);
        const auto &incpath = build_info.incpath;
-       VirtualFileSystem::SearchPath local_incpath = incpath;
-       local_incpath.insert(local_incpath.begin(), build_info.local_incpath.begin(), build_info.local_incpath.end());
-       local_incpath.push_front(FS::dirname(path).str());
+       VirtualFileSystem::SearchPath local_incpath;
+       local_incpath.reserve(1+build_info.local_incpath.size()+incpath.size());
+       local_incpath.push_back(FS::dirname(path).str());
+       local_incpath.insert(local_incpath.end(), build_info.local_incpath.begin(), build_info.local_incpath.end());
+       local_incpath.insert(local_incpath.end(), incpath.begin(), incpath.end());
 
        Tool *compiler = builder.get_toolchain().get_tool_for_suffix(FS::extpart(FS::basename(path)), true);
        if(compiler)
index e585721892d0ae16f793333d70aafacaaa6fa42f..da966eb68ae33faae233e0abf344370cfe4a33e2 100644 (file)
@@ -10,14 +10,14 @@ Represents a C or C++ source file.
 class CSourceFile: public SourceFile
 {
 protected:
-       std::list<std::string> includes;
+       std::vector<std::string> includes;
 
 public:
        CSourceFile(Builder &, const Msp::FS::Path &);
        CSourceFile(Builder &, const Component &, const Msp::FS::Path &);
 
        const char *get_type() const override { return "CSourceFile"; }
-       const std::list<std::string> &get_includes() const { return includes; }
+       const std::vector<std::string> &get_includes() const { return includes; }
 protected:
        virtual void parse_includes(Msp::IO::Base &);
        void find_dependencies() override;
index cb207d44064bd7d727267bf036cf44f5ba373edd..713120f455eb71ef6038d3ace35e02dc987ed9e5 100644 (file)
@@ -4,7 +4,7 @@
 
 using namespace std;
 
-DataPack::DataPack(Builder &b, const Component &c, const list<FileTarget *> &f):
+DataPack::DataPack(Builder &b, const Component &c, const vector<FileTarget *> &f):
        FileTarget(b, c.get_package(), generate_target_path(c)),
        files(f)
 {
index f676f4acb10c961d83f32fb0cca10f126131fdfe..b02922fe373edf6a21098a6e49f4bfed9bcdde6d 100644 (file)
@@ -6,17 +6,17 @@
 class DataPack: public FileTarget
 {
 private:
-       std::list<FileTarget *> files;
+       std::vector<FileTarget *> files;
 
 public:
-       DataPack(Builder &, const Component &, const std::list<FileTarget *> &);
+       DataPack(Builder &, const Component &, const std::vector<FileTarget *> &);
 private:
        static Msp::FS::Path generate_target_path(const Component &);
 
 public:
        const char *get_type() const override { return "DataPack"; }
 
-       const std::list<FileTarget *> &get_files() const { return files; }
+       const std::vector<FileTarget *> &get_files() const { return files; }
 };
 
 #endif
index b95770f4e432891b34c303a375d929042c4d4ece..5750287fefe39a3b024f6cbf8630fa271faf8db6 100644 (file)
@@ -17,7 +17,7 @@ void DataPackComponent::create_targets() const
        Builder &builder = package.get_builder();
        Tool &dcomp = builder.get_toolchain().get_tool("DATA");
 
-       list<Target *> files;
+       vector<Target *> files;
        for(const FS::Path &s: collect_source_files())
        {
                string ext = FS::extpart(FS::basename(s));
index 75d52aaac8506d23007cd343acee69ce08ba122a..b24de1396c22381ca279b9a27194f1cdc99e8541 100644 (file)
@@ -24,7 +24,7 @@ Target *DataTool::create_source(const Component &comp, const FS::Path &path) con
        return new DataTransform(builder, comp, path);
 }
 
-Target *DataTool::create_target(const list<Target *> &sources, const string &arg)
+Target *DataTool::create_target(const vector<Target *> &sources, const string &arg)
 {
        if(arg=="collection")
        {
@@ -39,7 +39,8 @@ Target *DataTool::create_target(const list<Target *> &sources, const string &arg
        {
                if(sources.empty())
                        throw invalid_argument("DataTool::create_target");
-               list<FileTarget *> files;
+               vector<FileTarget *> files;
+               files.reserve(sources.size());
                for(Target *t: sources)
                        files.push_back(&dynamic_cast<FileTarget &>(*t));
                DataPack *pack = new DataPack(builder, *files.front()->get_component(), files);
index 7996ab57b36c96e3f8016a8fbc328c9be8be3e5b..128f8338eff0ccc744207d2fc23aeff6049ec69a 100644 (file)
@@ -9,7 +9,7 @@ public:
        DataTool(Builder &);
 
        Target *create_source(const Component &, const Msp::FS::Path &) const override;
-       Target *create_target(const std::list<Target *> &, const std::string &) override;
+       Target *create_target(const std::vector<Target *> &, const std::string &) override;
        std::string create_build_signature(const BuildInfo &) const override;
        Task *run(const Target &) const override;
 };
index 4f5806c4bf79aa2bae99410c2287c38d4897e57e..055587a71bc7d290343f4674173dc625f087a3f8 100644 (file)
@@ -24,7 +24,7 @@ DataTransform::DataTransform(Builder &b, const Component &c, const FS::Path &p):
 
 void DataTransform::find_dependencies()
 {
-       list<string> files;
+       vector<string> files;
        Cache &cache = component->get_package().get_cache();
        const Time::TimeStamp &cache_mtime = cache.get_mtime();
        if(mtime<cache_mtime && dir_mtime<cache_mtime && cache.has_key(this, "files"))
index 9cd493d01c440935050cd51a6f70be65e9b8a5f0..488b6df513b5158206b59e72a8e532ec06d3cb44 100644 (file)
@@ -10,7 +10,7 @@ Executable::Executable(Builder &b, const FS::Path &p):
        Binary(b, p)
 { }
 
-Executable::Executable(Builder &b, const Component &c, const list<ObjectFile *> &objs):
+Executable::Executable(Builder &b, const Component &c, const vector<ObjectFile *> &objs):
        Binary(b, c, b.get_current_arch().create_filename<Executable>(c.get_name()), objs)
 {
        install_location = "bin";
index e9c99abf5d63e1998df28b78a4024d8ce6131194..a75e26eda45fd661631c1f63b5641ab377319957 100644 (file)
@@ -7,7 +7,7 @@ class Executable: public Binary
 {
 public:
        Executable(Builder &, const Msp::FS::Path &);
-       Executable(Builder &, const Component &, const std::list<ObjectFile *> &);
+       Executable(Builder &, const Component &, const std::vector<ObjectFile *> &);
 
        const char *get_type() const override { return "Executable"; }
 };
index 1af76034e5e8c9a4d0be81c9c434c0c050cb7a26..7edf7596288a9996d31a1c744e6a9abab26573aa 100644 (file)
@@ -6,7 +6,7 @@
 using namespace std;
 using namespace Msp;
 
-ExportDefinitions::ExportDefinitions(Builder &b, const Component &c, const list<ObjectFile *> &objs):
+ExportDefinitions::ExportDefinitions(Builder &b, const Component &c, const vector<ObjectFile *> &objs):
        FileTarget(b, c.get_package(), generate_target_path(c))
 {
        component = &c;
index 3e7a9943fe8afe46e8aae1d0e10d944efeb17a70..b8631ee2560530ba43ae38867f8401c95325e95f 100644 (file)
@@ -11,7 +11,7 @@ An export definition file for a shared library.  Only used on Windows.
 class ExportDefinitions: public FileTarget
 {
 public:
-       ExportDefinitions(Builder &, const Component &, const std::list<ObjectFile *> &);
+       ExportDefinitions(Builder &, const Component &, const std::vector<ObjectFile *> &);
 private:
        static Msp::FS::Path generate_target_path(const Component &);
 
index f0134db8dbdb712d9b276d57addd4203a96359db..2ab2081ec213e4a9658fa4852de2d87017c71db5 100644 (file)
@@ -17,7 +17,7 @@ struct Feature
        std::string name;
        std::string description;
        std::string default_value;
-       std::list<std::string> choices;
+       std::vector<std::string> choices;
        bool exported;
 
        Feature(const std::string &);
index 493f0203ee4f155a6e31a5e821a1a1a72c510c35..1434372ed3b5bf6c14d6a758e4b9f28433ea7d59 100644 (file)
@@ -123,25 +123,29 @@ string FileTarget::create_build_signature() const
                return string();
 
        const BuildInfo &binfo = (component ? component->get_build_info() : package->get_build_info());
-       list<string> sigs;
+       vector<string> sigs;
+
+       if(arch_in_build_sig)
+               if(const Architecture *arch = tool->get_architecture())
+                       sigs.push_back(arch->get_name());
+
+       sigs.push_back(tool->create_build_signature(binfo));
+
        if(nested_build_sig && component)
        {
-               set<const Tool *> depend_tools;
+               vector<const Tool *> seen_tools;
+               vector<string> tool_sigs;
                for(Target *d: depends)
-                       if(d->get_component()==component && d->get_tool())
-                               depend_tools.insert(d->get_tool());
-
-               for(const Tool *t: depend_tools)
-                       sigs.push_back(t->create_build_signature(binfo));
-               sigs.sort();
-               sigs.push_front(tool->create_build_signature(binfo));
+                       if(const Tool *t = d->get_tool())
+                               if(d->get_component()==component && !any_equals(seen_tools, t))
+                               {
+                                       seen_tools.push_back(t);
+                                       tool_sigs.push_back(t->create_build_signature(binfo));
+                               }
+
+               sort(tool_sigs);
+               sigs.insert(sigs.end(), make_move_iterator(tool_sigs.begin()), make_move_iterator(tool_sigs.end()));
        }
-       else
-               sigs.push_back(tool->create_build_signature(binfo));
-
-       if(arch_in_build_sig)
-               if(const Architecture *arch = tool->get_architecture())
-                       sigs.push_front(arch->get_name());
 
        return join(sigs.begin(), sigs.end(), ";");
 }
index f802031f0ee8ea83d12eba4da1019dcb9d2e7142..24a022febd10e1a0ed711bfee58782a99ad75880 100644 (file)
@@ -21,12 +21,13 @@ GnuArchiver::GnuArchiver(Builder &b, const Architecture &a):
        processing_unit = COMPONENT;
 }
 
-Target *GnuArchiver::create_target(const list<Target *> &sources, const string &)
+Target *GnuArchiver::create_target(const vector<Target *> &sources, const string &)
 {
        if(sources.empty())
                throw invalid_argument("GnuArchiver::create_target");
 
-       list<ObjectFile *> objs;
+       vector<ObjectFile *> objs;
+       objs.reserve(sources.size());
        for(Target *s: sources)
                objs.push_back(&dynamic_cast<ObjectFile &>(*s));
 
index 702b7eb67b015aefb22fe6b84a1072558a605074..0e4172bcadd97e29825d1c1e930c0864bbab0815 100644 (file)
@@ -8,7 +8,7 @@ class GnuArchiver: public Tool
 public:
        GnuArchiver(Builder &, const Architecture &);
 
-       Target *create_target(const std::list<Target *> &, const std::string &) override;
+       Target *create_target(const std::vector<Target *> &, const std::string &) override;
        Task *run(const Target &) const override;
 };
 
index 97d3b3086b275b444ca8c4432ae349fcd5cae0b5..9e7eb390220d451dabac88c0a971ba698c095e97 100644 (file)
@@ -69,7 +69,7 @@ Target *GnuCompiler::create_source(const FS::Path &path) const
                return new CSourceFile(builder, path);
 }
 
-Target *GnuCompiler::create_target(const list<Target *> &sources, const string &)
+Target *GnuCompiler::create_target(const vector<Target *> &sources, const string &)
 {
        if(sources.size()!=1)
                throw invalid_argument("GnuCompiler::create_target");
index 9f81ac8961588598d1cefd767bf2ca3f23c20ca6..1983f79f9535298249f601697ea1809961f932e7 100644 (file)
@@ -20,7 +20,7 @@ public:
 
        Target *create_source(const Component &, const Msp::FS::Path &) const override;
        Target *create_source(const Msp::FS::Path &) const override;
-       Target *create_target(const std::list<Target *> &, const std::string &) override;
+       Target *create_target(const std::vector<Target *> &, const std::string &) override;
        std::string create_build_signature(const BuildInfo &) const override;
 protected:
        void do_prepare() override;
index ddad8d1904abb06fb7252128b7bd586593599a81..72c8b07a423a08bacc1e2238fc9354ba70a10230 100644 (file)
@@ -39,11 +39,12 @@ GnuLinker::~GnuLinker()
        delete cxx_linker;
 }
 
-Target *GnuLinker::create_target(const list<Target *> &sources, const string &arg)
+Target *GnuLinker::create_target(const vector<Target *> &sources, const string &arg)
 {
        if(sources.empty())
                throw invalid_argument("GnuLinker::create_target");
-       list<ObjectFile *> objs;
+       vector<ObjectFile *> objs;
+       objs.reserve(sources.size());
        Linker *linker = default_linker;
        for(Target *s: sources)
        {
index eb2b00f95b12bdf365ce1605d4aa3bb8f8cefd05..0644e9474348ba6e228eb71de0124bd7408fa2ca 100644 (file)
@@ -35,7 +35,7 @@ public:
        GnuLinker(Builder &, const Architecture &);
        ~GnuLinker();
 
-       Target *create_target(const std::list<Target *> &, const std::string &) override;
+       Target *create_target(const std::vector<Target *> &, const std::string &) override;
        Target *create_install(Target &) const override;
 protected:
        void do_prepare() override;
index 955decc04d8f7eea188f3c77b9fede5ba175da80..49211d7676aca975260e4d0a89cbbf9dea9f99a2 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef INSTALLMAP_H_
 #define INSTALLMAP_H_
 
-#include <list>
+#include <vector>
 #include <msp/datafile/objectloader.h>
 #include <msp/fs/path.h>
 
@@ -36,7 +36,7 @@ private:
                Msp::FS::Path install;
        };
 
-       std::list<Entry> entries;
+       std::vector<Entry> entries;
 
 public:
        /** Adds an install mapping.  Multiple mappings can be specified for the
index 991a7188088da7d4b2b7bfcc016839d25d96f53d..c8448d2c302c2ff7cdba2434ddf64509c7f22cbd 100644 (file)
@@ -15,7 +15,7 @@ JarSigner::JarSigner(Builder &b):
        set_command("jarsigner");
 }
 
-Target *JarSigner::create_target(const list<Target *> &, const string &)
+Target *JarSigner::create_target(const vector<Target *> &, const string &)
 {
        throw logic_error("not implemented");
 }
index 9b695db4ceadd6b7d85989d62de563af86c21ee7..6f5124463fc8d378904be45320f03a2654ceabfb 100644 (file)
@@ -8,7 +8,7 @@ class JarSigner: public Tool
 public:
        JarSigner(Builder &);
 
-       Target *create_target(const std::list<Target *> &, const std::string &) override;
+       Target *create_target(const std::vector<Target *> &, const std::string &) override;
        Task *run(const Target &) const override;
 };
 
index dc9022e12378c06b56016fbb00e12a0596beb3b1..922fe51a10b724c5daa0608e55e5efb90e2392fc 100644 (file)
@@ -21,13 +21,14 @@ MingwDllTool::MingwDllTool(Builder &b, const Architecture &a):
        set_command("dlltool", true);
 }
 
-Target *MingwDllTool::create_target(const list<Target *> &sources, const string &)
+Target *MingwDllTool::create_target(const vector<Target *> &sources, const string &)
 {
        if(sources.size()!=1)
                throw invalid_argument("MingwDllTool::create_target");
        SharedLibrary &shlib = dynamic_cast<SharedLibrary &>(*sources.front());
 
-       list<ObjectFile *> objs;
+       vector<ObjectFile *> objs;
+       objs.reserve(shlib.get_dependencies().size());
        for(Target *d: shlib.get_dependencies())
                if(ObjectFile *obj = dynamic_cast<ObjectFile *>(d))
                        objs.push_back(obj);
index 2d2a621c4f2f2716dd8ae99c08a4212969d9e620..039ee7cb05370d734b2273f73c95882544ebaaf7 100644 (file)
@@ -8,7 +8,7 @@ class MingwDllTool: public Tool
 public:
        MingwDllTool(Builder &, const Architecture &);
 
-       Target *create_target(const std::list<Target *> &, const std::string &) override;
+       Target *create_target(const std::vector<Target *> &, const std::string &) override;
        Target *create_install(Target &) const override;
        Task *run(const Target &) const override;
 };
index 4a44bee593f463a94ef4702ee75b2410a611d037..5544b2768532bc1f74b9499f0256e1e5139bb431 100644 (file)
@@ -19,12 +19,13 @@ MsvcArchiver::MsvcArchiver(Builder &b, const Architecture &a, const MicrosoftToo
        set_command((ms_tools.get_vc_bin_dir()/"lib.exe").str(), false);
 }
 
-Target *MsvcArchiver::create_target(const list<Target *> &sources, const string &)
+Target *MsvcArchiver::create_target(const vector<Target *> &sources, const string &)
 {
        if(sources.empty())
                throw invalid_argument("MsvcArchiver::create_target");
 
-       list<ObjectFile *> objs;
+       vector<ObjectFile *> objs;
+       objs.reserve(sources.size());
        for(Target *s: sources)
                objs.push_back(&dynamic_cast<ObjectFile &>(*s));
 
index d09e145468f4fdd4ca7fb54d08f10c4397822151..03544a91c55fe6dc9ea6f26857ba1fb6a7c4984e 100644 (file)
@@ -13,7 +13,7 @@ private:
 public:
        MsvcArchiver(Builder &, const Architecture &, const MicrosoftTools &);
 
-       Target *create_target(const std::list<Target *> &, const std::string &) override;
+       Target *create_target(const std::vector<Target *> &, const std::string &) override;
 
        Task *run(const Target &) const override;
 };
index df6bd468c2d4862657ca38b7f37dd2d7cc1ab843..c4066273b6905e2e8754973b1cb73a10f6b57b43 100644 (file)
@@ -46,7 +46,7 @@ Target *MsvcCompiler::create_source(const FS::Path &path) const
        return new CSourceFile(builder, path);
 }
 
-Target *MsvcCompiler::create_target(const list<Target *> &sources, const string &)
+Target *MsvcCompiler::create_target(const vector<Target *> &sources, const string &)
 {
        if(sources.size()!=1)
                throw invalid_argument("MsvcCompiler::create_target");
index bf2524ac7552da03ecca4cd06d5b1a6f8e495418..ef1da349d829c897bca06e68b601686e5ea24f00 100644 (file)
@@ -15,7 +15,7 @@ public:
 
        Target *create_source(const Component &, const Msp::FS::Path &) const override;
        Target *create_source(const Msp::FS::Path &) const override;
-       Target *create_target(const std::list<Target *> &, const std::string &) override;
+       Target *create_target(const std::vector<Target *> &, const std::string &) override;
        std::string create_build_signature(const BuildInfo &) const override;
 
 protected:
index 4495db7260f533b3a6842e7641e4da5af5a70b37..f6d514ba8bbd99a664f7fdb4f8ca753805288e96 100644 (file)
@@ -29,12 +29,13 @@ MsvcLinker::MsvcLinker(Builder &b, const Architecture &a, const MicrosoftTools &
        set_command((ms_tools.get_vc_bin_dir()/"link.exe").str(), false);
 }
 
-Target *MsvcLinker::create_target(const list<Target *> &sources, const string &arg)
+Target *MsvcLinker::create_target(const vector<Target *> &sources, const string &arg)
 {
        if(sources.empty())
                throw invalid_argument("MsvcLinker::create_target");
 
-       list<ObjectFile *> objs;
+       vector<ObjectFile *> objs;
+       objs.reserve(sources.size());
        for(Target *s: sources)
                objs.push_back(&dynamic_cast<ObjectFile &>(*s));
 
index f1e275d3dbe58b2843b7625661fdc079190cf3e8..26b2abaaac250c83878c17e9894ee28f5628a6a8 100644 (file)
@@ -13,7 +13,7 @@ private:
 public:
        MsvcLinker(Builder &, const Architecture &, const MicrosoftTools &);
 
-       Target *create_target(const std::list<Target *> &, const std::string &) override;
+       Target *create_target(const std::vector<Target *> &, const std::string &) override;
        std::string create_build_signature(const BuildInfo &) const override;
 
 protected:
index a7ae7d4546e1b3d534e3112e5123d756beec914f..bb3c809642c42f43aee233389b49723bbb5a33ce 100644 (file)
@@ -1,8 +1,8 @@
 #ifndef PACKAGE_H_
 #define PACKAGE_H_
 
-#include <list>
 #include <string>
+#include <vector>
 #include <msp/datafile/objectloader.h>
 #include "buildinfo.h"
 #include "conditionalloader.h"
@@ -27,7 +27,7 @@ public:
                void require(const std::string &);
        };
 
-       using Requirements = std::list<Package *>;
+       using Requirements = std::vector<Package *>;
 
 protected:
        Builder &builder;
@@ -38,7 +38,7 @@ protected:
        Requirements requires;
        BuildInfo export_binfo;
        bool prepared;
-       std::list<std::string> problems;
+       std::vector<std::string> problems;
 
        bool use_pkgconfig;
 
@@ -66,7 +66,7 @@ protected:
 public:
        bool is_prepared() const { return prepared; }
 
-       const std::list<std::string> &get_problems() const { return problems; }
+       const std::vector<std::string> &get_problems() const { return problems; }
 
        virtual void save_caches() { }
 };
index 9da4af33e3a557851c7dc7f9d23c54e235412edf..a2c684e0bfd7796f487b2185f20f0658bdbdc71d 100644 (file)
@@ -1,9 +1,9 @@
 #ifndef PACKAGEMANAGER_H_
 #define PACKAGEMANAGER_H_
 
-#include <list>
 #include <map>
 #include <string>
+#include <vector>
 #include <msp/fs/path.h>
 
 class Builder;
@@ -17,10 +17,10 @@ class PackageManager
 {
 private:
        Builder &builder;
-       std::list<Msp::FS::Path> pkg_path;
-       std::list<Msp::FS::Path> pkg_dirs;
-       std::list<Msp::FS::Path> binpkg_path;
-       std::list<Msp::FS::Path> binpkg_files;
+       std::vector<Msp::FS::Path> pkg_path;
+       std::vector<Msp::FS::Path> pkg_dirs;
+       std::vector<Msp::FS::Path> binpkg_path;
+       std::vector<Msp::FS::Path> binpkg_files;
        bool no_externals;
        std::map<std::string, Package *> packages;
        Package *main_pkg;
index d910f196276c142dac8b0f573522c4140d409286..fec83dad1f2273876e894b0c531aa39abacab984 100644 (file)
@@ -22,9 +22,9 @@ string Pattern::apply(const string &body) const
        return result;
 }
 
-list<string> Pattern::apply_list(const list<Pattern> &patterns, const string &body)
+vector<string> Pattern::apply_list(const vector<Pattern> &patterns, const string &body)
 {
-       list<string> result;
+       vector<string> result;
        for(const Pattern &p: patterns)
                result.push_back(p.apply(body));
        return result;
index 5965efaed69886ea489679f93b0e0d13774eef4d..8c623bda81eeac0036bc731ef2686d615ed459ef 100644 (file)
@@ -1,8 +1,8 @@
 #ifndef PATTERN_H_
 #define PATTERN_H_
 
-#include <list>
 #include <string>
+#include <vector>
 
 /**
 Stores a filename pattern.  A pattern consists of a prefix and a suffix, and
@@ -24,7 +24,7 @@ public:
        std::string apply(const std::string &) const;
 
        /** Applies a list of patterns to the same body. */
-       static std::list<std::string> apply_list(const std::list<Pattern> &, const std::string &);
+       static std::vector<std::string> apply_list(const std::vector<Pattern> &, const std::string &);
 };
 
 #endif
index e9320448b3508a201676eb783ddf2b8d73b87cd2..f042ec5f25a32d502849379d88c762f300494e8c 100644 (file)
@@ -13,7 +13,7 @@ PkgConfigGenerator::PkgConfigGenerator(Builder &b):
 {
 }
 
-Target *PkgConfigGenerator::create_target(const list<Target *> &, const string &)
+Target *PkgConfigGenerator::create_target(const vector<Target *> &, const string &)
 {
        throw logic_error("Not implemented");
 }
index a13e588e4d9729a89f9d78f419974898bec47d6c..3b28e3f1e94907c22c8896b7e179a7f83385137e 100644 (file)
@@ -26,7 +26,7 @@ private:
 public:
        PkgConfigGenerator(Builder &);
 
-       Target *create_target(const std::list<Target *> &, const std::string &) override;
+       Target *create_target(const std::vector<Target *> &, const std::string &) override;
        Task *run(const Target &) const override;
 };
 
index a6e8239524c91fb9775620ac41445d2e08395e8b..4ef9bb6fdf09bfd76ab7820f6cbc4f58515e1d5b 100644 (file)
@@ -18,7 +18,7 @@ SharedLibrary::SharedLibrary(Builder &b, const Msp::FS::Path &p):
                libname = libname.substr(3);
 }
 
-SharedLibrary::SharedLibrary(Builder &b, const Component &c, const list<ObjectFile *> &objs):
+SharedLibrary::SharedLibrary(Builder &b, const Component &c, const vector<ObjectFile *> &objs):
        Binary(b, c, generate_filename(c), objs),
        libname(c.get_name()),
        import_lib(0)
index b2cd59b38ab1f77ab86aece9413989225e660898..54822aadcd0bfd794606a1444a80c06837df38a6 100644 (file)
@@ -23,7 +23,7 @@ private:
 
 public:
        SharedLibrary(Builder &, const Msp::FS::Path &);
-       SharedLibrary(Builder &, const Component &, const std::list<ObjectFile *> &);
+       SharedLibrary(Builder &, const Component &, const std::vector<ObjectFile *> &);
 private:
        static std::string generate_filename(const Component &);
 
index 027debcf2881200ad536fdd9a2d8be81c6989886..b1e4279d28b8a92865c64c2ffc9786df20648e21 100644 (file)
@@ -16,8 +16,8 @@ void SourceArchiveComponent::create_targets() const
 {
        Builder &builder = package.get_builder();
 
-       list<Target *> files;
-       files.insert(files.begin(), &package.get_build_file());
+       vector<Target *> files;
+       files.push_back(&package.get_build_file());
 
        for(const FS::Path &s: collect_source_files())
        {
index f4b43a82c8c32e7ffa016f9a57f00004174f5875..cfb01af22da70bb1a9256c481229cc2118ec1239 100644 (file)
@@ -20,7 +20,7 @@ Target *SourceGenerator::create_source(const Component &comp, const FS::Path &pa
        return new TemplateFile(builder, comp, path);
 }
 
-Target *SourceGenerator::create_target(const list<Target *> &sources, const string &)
+Target *SourceGenerator::create_target(const vector<Target *> &sources, const string &)
 {
        if(sources.empty())
                throw invalid_argument("SourceGenerator::create_target");
index 964ea0a27c6724acfcb96f6176a1ef10e2fa2522..3b96799dc81dccc06b199329532d451023cce9b7 100644 (file)
@@ -25,15 +25,15 @@ public:
 
 private:
        const SourcePackage &package;
-       std::list<std::string> out_suffixes;
-       std::list<std::string> arguments;
+       std::vector<std::string> out_suffixes;
+       std::vector<std::string> arguments;
        std::string out_argument;
 
 public:
        SourceGenerator(Builder &, const SourcePackage &, const std::string &);
 
        Target *create_source(const Component &, const Msp::FS::Path &) const override;
-       Target *create_target(const std::list<Target *> &, const std::string &) override;
+       Target *create_target(const std::vector<Target *> &, const std::string &) override;
 
        Task *run(const Target &) const override;
 };
index 601627185a26e9e21f558567807d547fcc623733..40b098ca10931b4bf31651f80b7dcbb64beded83 100644 (file)
@@ -195,7 +195,10 @@ void SourcePackage::Loader::finish()
        other components wil be created first */
        auto i = find(obj.components, obj.source_archive);
        if(i!=obj.components.end())
-               obj.components.splice(obj.components.end(), obj.components, i);
+       {
+               obj.components.erase(i);
+               obj.components.push_back(obj.source_archive);
+       }
 }
 
 void SourcePackage::Loader::feature(const string &n, const string &d)
index cb2ab9d46676b0cf3f437281e73326370522e681..23e8f36320aaf5de5393bffb9ef5ab3268c7ee06 100644 (file)
@@ -55,9 +55,9 @@ private:
        Msp::FS::Path source_dir;
        const BuildType *build_type;
        Toolchain local_tools;
-       std::list<Feature> features;
+       std::vector<Feature> features;
        BuildInfo build_info;
-       std::list<Component *> components;
+       std::vector<Component *> components;
        SourceArchiveComponent *source_archive;
        Config config;
        mutable Cache cache;
index 853d1b45c4916557321703b9a58d9862644b309f..c51596685d8927debc0afb5e5bb481b327f2dffb 100644 (file)
@@ -11,7 +11,7 @@ StaticLibrary::StaticLibrary(Builder &b, const FS::Path &p):
        FileTarget(b, p)
 { }
 
-StaticLibrary::StaticLibrary(Builder &b, const Component &c, const list<ObjectFile *> &objs):
+StaticLibrary::StaticLibrary(Builder &b, const Component &c, const vector<ObjectFile *> &objs):
        FileTarget(b, c.get_package(), c.get_package().get_output_directory()/generate_filename(c))
 {
        component = &c;
index af8a57cc8f94414d456a5b90cce02a9b2ab7eed3..6b52871437f1a9ddbfc1c3e5de6a8060cb52e683 100644 (file)
@@ -19,7 +19,7 @@ private:
 
 public:
        StaticLibrary(Builder &, const Msp::FS::Path &);
-       StaticLibrary(Builder &, const Component &, const std::list<ObjectFile *> &);
+       StaticLibrary(Builder &, const Component &, const std::vector<ObjectFile *> &);
 private:
        static std::string generate_filename(const Component &);
 
index 346638ea1f69b6eb534ec84be9ad5afbc22ebcb3..8de76fe34feca85787d3d4f26f802ecea68332d9 100644 (file)
@@ -17,7 +17,7 @@ Tar::Tar(Builder &b):
        processing_unit = COMPONENT;
 }
 
-Target *Tar::create_target(const list<Target *> &sources, const string &arg)
+Target *Tar::create_target(const vector<Target *> &sources, const string &arg)
 {
        if(sources.empty() || !sources.front()->get_package())
                throw invalid_argument("Tar::create_target");
index 3719c41ed7806fb0f89c1b1ae9f5b9a2ba790e22..d0240d93bf315c71b0b1536dd38e07ea16352d00 100644 (file)
@@ -26,7 +26,7 @@ private:
 public:
        Tar(Builder &);
 
-       Target *create_target(const std::list<Target *> &, const std::string &) override;
+       Target *create_target(const std::vector<Target *> &, const std::string &) override;
        Task *run(const Target &) const override;
 };
 
index c4a822b48df43f5747479c67bc7e955ee0ce1031..2824e2a806589c4ce4c948b90dcf37a89fe18c36 100644 (file)
@@ -1,10 +1,10 @@
 #ifndef TARGET_H_
 #define TARGET_H_
 
-#include <list>
 #include <map>
 #include <set>
 #include <string>
+#include <vector>
 #include <sigc++/signal.h>
 #include <msp/time/timestamp.h>
 
@@ -27,7 +27,7 @@ dependencies can be used by other targets further down the chain.
 class Target
 {
 public:
-       using Dependencies = std::list<Target *>;
+       using Dependencies = std::vector<Target *>;
 
 protected:
        enum State
@@ -53,7 +53,7 @@ protected:
        Tool *tool;
        State state;
        std::string rebuild_reason;
-       std::list<std::string> problems;
+       std::vector<std::string> problems;
 
        Dependencies depends;
        Dependencies trans_depends;
@@ -141,7 +141,7 @@ protected:
 public:
        bool is_broken() const { return state==BROKEN; }
 
-       const std::list<std::string> &get_problems() const { return problems; }
+       const std::vector<std::string> &get_problems() const { return problems; }
 
        /** Prepares the target by finding dependencies, recursively preparing them
        and then checking whether rebuilding is needed. */
index 0890007279518446e5ebae900be1422b6a84e2af..97cf8d627b1bedaae6c338b64399107047e95e30 100644 (file)
@@ -23,7 +23,7 @@ public:
        sigc::signal<void, bool> signal_finished;
 
 protected:
-       std::list<Msp::FS::Path> files;
+       std::vector<Msp::FS::Path> files;
        bool unlink;
 
        Task();
index 377dc7f4bc0813ae095ede177bbaf004512244de..54138215e5f0ca25d368fb32bc801592f3413c2d 100644 (file)
@@ -45,7 +45,7 @@ bool Tool::accepts_suffix(const string &suffix, bool aux) const
 
 Target *Tool::create_target(Target &source, const string &arg)
 {
-       list<Target *> sources;
+       vector<Target *> sources;
        sources.push_back(&source);
        return create_target(sources, arg);
 }
@@ -92,7 +92,7 @@ Target *SubTool::create_source(const FS::Path &p) const
        return parent.create_source(p);
 }
 
-Target *SubTool::create_target(const list<Target *> &s, const string &a)
+Target *SubTool::create_target(const vector<Target *> &s, const string &a)
 {
        return parent.create_target(s, a);
 }
index c49b4c473257b0ff06f8e2e07cca2a4fbc444b54..ce08a00af62aedc0aae64b8d901d579881103797 100644 (file)
@@ -1,8 +1,8 @@
 #ifndef TOOL_H_
 #define TOOL_H_
 
-#include <list>
 #include <string>
+#include <vector>
 #include <msp/fs/path.h>
 #include "buildinfo.h"
 #include "virtualfilesystem.h"
@@ -35,13 +35,13 @@ protected:
        std::string tag;
        std::string command;
        FileTarget *executable;
-       std::list<std::string> input_suffixes;
-       std::list<std::string> aux_suffixes;
+       std::vector<std::string> input_suffixes;
+       std::vector<std::string> aux_suffixes;
        ProcessingUnit processing_unit;
        VirtualFileSystem::SearchPath system_path;
        BuildInfo build_info;
        bool prepared;
-       std::list<std::string> problems;
+       std::vector<std::string> problems;
 
        Tool(Builder &, const std::string &);
        Tool(Builder &, const Architecture &, const std::string &);
@@ -66,11 +66,11 @@ public:
        FileTarget *get_executable() const { return executable; }
 
        /// Returns a list of suffixes that can be processed with this tool.
-       const std::list<std::string> &get_input_suffixes() const { return input_suffixes; }
+       const std::vector<std::string> &get_input_suffixes() const { return input_suffixes; }
 
        /** Returns a list of suffixes that are associated with this tool, but can't
        be processed directly.  For example C and C++ headers. */
-       const std::list<std::string> &get_auxiliary_suffixes() const { return aux_suffixes; }
+       const std::vector<std::string> &get_auxiliary_suffixes() const { return aux_suffixes; }
 
        /** Indicates whether the tool can accept a suffix.  If aux is true,
        auxiliary suffixes are considered as well */
@@ -100,7 +100,7 @@ public:
        /** Creates a target from sources.  The exact types of accepted sources
        depends on the tool.  The optional second argument can be used to select an
        alternative target type for tools that can create multiple kinds of targets. */ 
-       virtual Target *create_target(const std::list<Target *> &, const std::string & = std::string()) = 0;
+       virtual Target *create_target(const std::vector<Target *> &, const std::string & = std::string()) = 0;
 
        /** Creates an install target for a target created by this tool.  Can return
        null if the tool does not want to handle installing in a special way. */
@@ -114,7 +114,7 @@ protected:
        virtual void do_prepare() { }
 
 public:
-       const std::list<std::string> &get_problems() const { return problems; }
+       const std::vector<std::string> &get_problems() const { return problems; }
 
        /** Invokes the tool to build a target.  This should not be called directly;
        use Target::build() instead. */
@@ -136,7 +136,7 @@ protected:
 public:
        Target *create_source(const Component &, const Msp::FS::Path &) const override;
        Target *create_source(const Msp::FS::Path &) const override;
-       Target *create_target(const std::list<Target *> &, const std::string & = std::string()) override;
+       Target *create_target(const std::vector<Target *> &, const std::string & = std::string()) override;
        Target *create_install(Target &) const override;
        std::string create_build_signature(const BuildInfo &) const override;
 };
index a70cdb7308557f5762ce9d45a7bf3bb188be1f03..ea452408cd4c6c25ba900a4d662ccc9847ec8f85 100644 (file)
@@ -1,9 +1,9 @@
 #ifndef TOOLCHAIN_H_
 #define TOOLCHAIN_H_
 
-#include <list>
 #include <map>
 #include <string>
+#include <vector>
 
 class Tool;
 
@@ -14,7 +14,7 @@ class Toolchain
 {
 private:
        std::map<std::string, Tool *> tools;
-       std::list<Toolchain *> chains;
+       std::vector<Toolchain *> chains;
 
 public:
        ~Toolchain();
index 8535197f03332bd393f8f09a011dc9de0b2d3c59..93c0eb49f7a6076608dd0cde22846492b94fbe36 100644 (file)
@@ -16,7 +16,7 @@ VcxProjectGenerator::VcxProjectGenerator(Builder &b):
        Tool(b, "VCXG")
 { }
 
-Target *VcxProjectGenerator::create_target(const list<Target *> &, const string &)
+Target *VcxProjectGenerator::create_target(const vector<Target *> &, const string &)
 {
        throw logic_error("Not implemented");
 }
index 05bb720d81fe7d6ac6a472815d4b82e288abd4a6..a7feb1a859b97e99c7b1d3a8333f39f77f73e412 100644 (file)
@@ -24,7 +24,7 @@ private:
 public:
        VcxProjectGenerator(Builder &);
 
-       Target *create_target(const std::list<Target *> &, const std::string &) override;
+       Target *create_target(const std::vector<Target *> &, const std::string &) override;
        Task *run(const Target &) const override;
 };
 
index c9bfd23b0c564700ea7e1d13542c0c1118cbf6fc..2fecdf0fc50c9427fd1d06c194b597b7b41ff864 100644 (file)
@@ -84,7 +84,7 @@ FileTarget *VirtualFileSystem::find_library(const string &lib, const SearchPath
 
        const Architecture &arch = builder.get_current_arch();
 
-       list<string> shared_names;
+       vector<string> shared_names;
        bool use_import_lib = false;
        if(mode!=BuildInfo::FORCE_STATIC)
        {
@@ -93,13 +93,13 @@ FileTarget *VirtualFileSystem::find_library(const string &lib, const SearchPath
                        shared_names = Pattern::apply_list(arch.get_patterns<SharedLibrary>(), lib);
        }
 
-       list<string> static_names;
+       vector<string> static_names;
        if(mode!=BuildInfo::FORCE_DYNAMIC)
                static_names = Pattern::apply_list(arch.get_patterns<StaticLibrary>(), lib);
 
        for(const FS::Path &p: combined_path)
        {
-               const list<string> *cur_names = (mode>=BuildInfo::DYNAMIC ? &shared_names : &static_names);
+               const vector<string> *cur_names = (mode>=BuildInfo::DYNAMIC ? &shared_names : &static_names);
                for(auto j=cur_names->begin(); j!=cur_names->end(); )
                {
                        FS::Path filename = p / *j;
index 9a25930aa8a8cf693980cf80720a23bb3508623b..4aa20d4b158d1ac8985a46b0383d6c00938b2276 100644 (file)
@@ -1,9 +1,9 @@
 #ifndef VIRTUALFILESYSTEM_H_
 #define VIRTUALFILESYSTEM_H_
 
-#include <list>
 #include <map>
 #include <set>
+#include <vector>
 #include <msp/fs/path.h>
 #include "buildinfo.h"
 
@@ -20,7 +20,7 @@ possible to build them.
 class VirtualFileSystem
 {
 public:
-       using SearchPath = std::list<Msp::FS::Path>;
+       using SearchPath = std::vector<Msp::FS::Path>;
 
 private:
        Builder &builder;
index 0c60689a42094b3777256d1b4da9efa837ea487e..a810cab42f070ed6e2301ec6b2451f3f4833248f 100644 (file)
@@ -14,7 +14,7 @@ VsSolutionGenerator::VsSolutionGenerator(Builder &b):
        Tool(b, "VSSG")
 { }
 
-Target *VsSolutionGenerator::create_target(const list<Target *> &, const string &)
+Target *VsSolutionGenerator::create_target(const vector<Target *> &, const string &)
 {
        throw logic_error("Not implemented");
 }
index 2efddcdad9eec188888a724f186938d5b2527331..14eae5fd7ee10207f5218d7af4703d6811b2b110 100644 (file)
@@ -24,7 +24,7 @@ private:
 public:
        VsSolutionGenerator(Builder &);
 
-       Target *create_target(const std::list<Target *> &, const std::string &) override;
+       Target *create_target(const std::vector<Target *> &, const std::string &) override;
        Task *run(const Target &) const override;
 };