From aa053d637e8259755af7d2e4b510a242f4d29c7b Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 21 Dec 2022 11:23:37 +0200 Subject: [PATCH] Convert all list containers to vectors --- source/analyzer.cpp | 3 ++- source/analyzer.h | 3 +-- source/androidapplicationcomponent.cpp | 7 +++--- source/androidassetpackagingtool.cpp | 8 +++--- source/androidassetpackagingtool.h | 2 +- source/androidlinker.cpp | 2 +- source/androidlinker.h | 2 +- source/androidmanifestgenerator.cpp | 2 +- source/androidmanifestgenerator.h | 2 +- source/androidpackagefile.cpp | 2 +- source/androidpackagefile.h | 2 +- source/androidresourcebundle.cpp | 2 +- source/androidresourcebundle.h | 2 +- source/apkbuilder.cpp | 8 +++--- source/apkbuilder.h | 2 +- source/architecture.h | 10 ++++---- source/binary.cpp | 2 +- source/binary.h | 4 +-- source/binarycomponent.cpp | 15 ++++++------ source/binarycomponent.h | 2 +- source/binarypackage.cpp | 2 +- source/binarypackage.h | 2 +- source/builder.cpp | 7 +++--- source/builder.h | 3 +-- source/buildercli.cpp | 8 +++--- source/buildercli.h | 4 +-- source/buildinfo.cpp | 17 +++++++------ source/buildinfo.h | 12 ++++----- source/cache.h | 4 +-- source/compilecommandsgenerator.cpp | 2 +- source/compilecommandsgenerator.h | 2 +- source/component.cpp | 7 +++--- source/component.h | 14 +++++------ source/copy.cpp | 2 +- source/copy.h | 2 +- source/csourcefile.cpp | 8 +++--- source/csourcefile.h | 4 +-- source/datapack.cpp | 2 +- source/datapack.h | 6 ++--- source/datapackcomponent.cpp | 2 +- source/datatool.cpp | 5 ++-- source/datatool.h | 2 +- source/datatransform.cpp | 2 +- source/executable.cpp | 2 +- source/executable.h | 2 +- source/exportdefinitions.cpp | 2 +- source/exportdefinitions.h | 2 +- source/feature.h | 2 +- source/filetarget.cpp | 34 ++++++++++++++------------ source/gnuarchiver.cpp | 5 ++-- source/gnuarchiver.h | 2 +- source/gnucompiler.cpp | 2 +- source/gnucompiler.h | 2 +- source/gnulinker.cpp | 5 ++-- source/gnulinker.h | 2 +- source/installmap.h | 4 +-- source/jarsigner.cpp | 2 +- source/jarsigner.h | 2 +- source/mingwdlltool.cpp | 5 ++-- source/mingwdlltool.h | 2 +- source/msvcarchiver.cpp | 5 ++-- source/msvcarchiver.h | 2 +- source/msvccompiler.cpp | 2 +- source/msvccompiler.h | 2 +- source/msvclinker.cpp | 5 ++-- source/msvclinker.h | 2 +- source/package.h | 8 +++--- source/packagemanager.h | 10 ++++---- source/pattern.cpp | 4 +-- source/pattern.h | 4 +-- source/pkgconfiggenerator.cpp | 2 +- source/pkgconfiggenerator.h | 2 +- source/sharedlibrary.cpp | 2 +- source/sharedlibrary.h | 2 +- source/sourcearchivecomponent.cpp | 4 +-- source/sourcegenerator.cpp | 2 +- source/sourcegenerator.h | 6 ++--- source/sourcepackage.cpp | 5 +++- source/sourcepackage.h | 4 +-- source/staticlibrary.cpp | 2 +- source/staticlibrary.h | 2 +- source/tar.cpp | 2 +- source/tar.h | 2 +- source/target.h | 8 +++--- source/task.h | 2 +- source/tool.cpp | 4 +-- source/tool.h | 18 +++++++------- source/toolchain.h | 4 +-- source/vcxprojectgenerator.cpp | 2 +- source/vcxprojectgenerator.h | 2 +- source/virtualfilesystem.cpp | 6 ++--- source/virtualfilesystem.h | 4 +-- source/vssolutiongenerator.cpp | 2 +- source/vssolutiongenerator.h | 2 +- 94 files changed, 218 insertions(+), 195 deletions(-) diff --git a/source/analyzer.cpp b/source/analyzer.cpp index 4cebafa..94f7782 100644 --- a/source/analyzer.cpp +++ b/source/analyzer.cpp @@ -1,3 +1,4 @@ +#include #include #include #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); diff --git a/source/analyzer.h b/source/analyzer.h index 373150b..4c9e146 100644 --- a/source/analyzer.h +++ b/source/analyzer.h @@ -1,7 +1,6 @@ #ifndef ANALYZER_H_ #define ANALYZER_H_ -#include #include #include #include @@ -29,7 +28,7 @@ private: Builder &builder; Mode mode; - std::list table; + std::vector table; unsigned max_depth; bool full_paths; std::map > rdepends; diff --git a/source/androidapplicationcomponent.cpp b/source/androidapplicationcomponent.cpp index 95eb944..212db7d 100644 --- a/source/androidapplicationcomponent.cpp +++ b/source/androidapplicationcomponent.cpp @@ -22,7 +22,7 @@ void AndroidApplicationComponent::create_targets() const Builder &builder = package.get_builder(); BuildGraph &build_graph = builder.get_build_graph(); - list contents; + vector contents; for(const auto &kvp: build_graph.get_targets()) if(kvp.second->get_package()==&package) if(InstalledFile *inst = dynamic_cast(kvp.second)) @@ -33,7 +33,7 @@ void AndroidApplicationComponent::create_targets() const for(const string &p: permissions) manifest->add_permission(p); - list resource_sources; + vector 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 apk_sources; + vector apk_sources; + apk_sources.reserve(1+contents.size()); apk_sources.push_back(resource_bundle); const Architecture &arch = package.get_builder().get_current_arch(); diff --git a/source/androidassetpackagingtool.cpp b/source/androidassetpackagingtool.cpp index 0ef99a7..3d86747 100644 --- a/source/androidassetpackagingtool.cpp +++ b/source/androidassetpackagingtool.cpp @@ -25,10 +25,11 @@ AndroidAssetPackagingTool::AndroidAssetPackagingTool(Builder &b, const AndroidSd problems.push_back("Android platform not found"); } -Target *AndroidAssetPackagingTool::create_target(const list &sources, const string &) +Target *AndroidAssetPackagingTool::create_target(const vector &sources, const string &) { AndroidManifestFile *manifest = 0; - list resources; + vector resources; + resources.reserve(sources.size()); for(Target *s: sources) { if(AndroidManifestFile *m = dynamic_cast(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 resource_dirs; + vector resource_dirs; + resource_dirs.reserve(res.get_dependencies().size()); for(Target *d: res.get_dependencies()) { FileTarget *file = dynamic_cast(d); diff --git a/source/androidassetpackagingtool.h b/source/androidassetpackagingtool.h index 639da92..8f01e6d 100644 --- a/source/androidassetpackagingtool.h +++ b/source/androidassetpackagingtool.h @@ -13,7 +13,7 @@ private: public: AndroidAssetPackagingTool(Builder &, const AndroidSdk &); - Target *create_target(const std::list &, const std::string &) override; + Target *create_target(const std::vector &, const std::string &) override; Task *run(const Target &) const override; }; diff --git a/source/androidlinker.cpp b/source/androidlinker.cpp index 67c76c2..2cacf38 100644 --- a/source/androidlinker.cpp +++ b/source/androidlinker.cpp @@ -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 &sources, const string &) +Target *AndroidLinker::create_target(const vector &sources, const string &) { return GnuLinker::create_target(sources, "shared"); } diff --git a/source/androidlinker.h b/source/androidlinker.h index 9d880d2..269d168 100644 --- a/source/androidlinker.h +++ b/source/androidlinker.h @@ -10,7 +10,7 @@ class AndroidLinker: public GnuLinker public: AndroidLinker(Builder &, const Architecture &, const AndroidNdk &); - Target *create_target(const std::list &, const std::string &) override; + Target *create_target(const std::vector &, const std::string &) override; }; #endif diff --git a/source/androidmanifestgenerator.cpp b/source/androidmanifestgenerator.cpp index 1d2f330..b9d67df 100644 --- a/source/androidmanifestgenerator.cpp +++ b/source/androidmanifestgenerator.cpp @@ -13,7 +13,7 @@ AndroidManifestGenerator::AndroidManifestGenerator(Builder &b): Tool(b, "AMG") { } -Target *AndroidManifestGenerator::create_target(const list &, const string &) +Target *AndroidManifestGenerator::create_target(const vector &, const string &) { throw logic_error("not implemented"); } diff --git a/source/androidmanifestgenerator.h b/source/androidmanifestgenerator.h index c2c2a95..7c6e44c 100644 --- a/source/androidmanifestgenerator.h +++ b/source/androidmanifestgenerator.h @@ -24,7 +24,7 @@ private: public: AndroidManifestGenerator(Builder &); - Target *create_target(const std::list &, const std::string &) override; + Target *create_target(const std::vector &, const std::string &) override; Task *run(const Target &) const override; }; diff --git a/source/androidpackagefile.cpp b/source/androidpackagefile.cpp index 22eedec..9dee78f 100644 --- a/source/androidpackagefile.cpp +++ b/source/androidpackagefile.cpp @@ -5,7 +5,7 @@ using namespace std; -AndroidPackageFile::AndroidPackageFile(Builder &b, const Component &c, AndroidResourceBundle &resource_bundle, const list &other_files): +AndroidPackageFile::AndroidPackageFile(Builder &b, const Component &c, AndroidResourceBundle &resource_bundle, const vector &other_files): FileTarget(b, c.get_package(), c.get_package().get_output_directory()/(c.get_name()+".apk")) { component = &c; diff --git a/source/androidpackagefile.h b/source/androidpackagefile.h index 644b5d4..c5f237a 100644 --- a/source/androidpackagefile.h +++ b/source/androidpackagefile.h @@ -8,7 +8,7 @@ class AndroidResourceBundle; class AndroidPackageFile: public FileTarget { public: - AndroidPackageFile(Builder &, const Component &, AndroidResourceBundle &, const std::list &); + AndroidPackageFile(Builder &, const Component &, AndroidResourceBundle &, const std::vector &); const char *get_type() const override { return "AndroidPackageFile"; } }; diff --git a/source/androidresourcebundle.cpp b/source/androidresourcebundle.cpp index 2918b05..8113c00 100644 --- a/source/androidresourcebundle.cpp +++ b/source/androidresourcebundle.cpp @@ -5,7 +5,7 @@ using namespace std; -AndroidResourceBundle::AndroidResourceBundle(Builder &b, const Component &c, AndroidManifestFile &manifest, const list &resources): +AndroidResourceBundle::AndroidResourceBundle(Builder &b, const Component &c, AndroidManifestFile &manifest, const vector &resources): FileTarget(b, c.get_package(), c.get_package().get_temp_directory()/c.get_name()/(c.get_name()+".ap_")) { component = &c; diff --git a/source/androidresourcebundle.h b/source/androidresourcebundle.h index 92fc2b8..18c07e0 100644 --- a/source/androidresourcebundle.h +++ b/source/androidresourcebundle.h @@ -8,7 +8,7 @@ class AndroidManifestFile; class AndroidResourceBundle: public FileTarget { public: - AndroidResourceBundle(Builder &, const Component &, AndroidManifestFile &, const std::list &); + AndroidResourceBundle(Builder &, const Component &, AndroidManifestFile &, const std::vector &); const char *get_type() const override { return "AndroidResourceBundle"; } }; diff --git a/source/apkbuilder.cpp b/source/apkbuilder.cpp index 2568f33..0e14163 100644 --- a/source/apkbuilder.cpp +++ b/source/apkbuilder.cpp @@ -21,10 +21,11 @@ ApkBuilder::ApkBuilder(Builder &b): set_command("jar"); } -Target *ApkBuilder::create_target(const list &sources, const string &) +Target *ApkBuilder::create_target(const vector &sources, const string &) { AndroidResourceBundle *resource_bundle = 0; - list other_files; + vector other_files; + other_files.reserve(sources.size()); for(Target *s: sources) { if(AndroidResourceBundle *r = dynamic_cast(s)) @@ -52,7 +53,8 @@ Task *ApkBuilder::run(const Target &tgt) const argv.push_back("u"); FS::Path input_path; - list files; + vector files; + files.reserve(apk.get_dependencies().size()); for(Target *d: apk.get_dependencies()) { FileTarget *file = dynamic_cast(d); diff --git a/source/apkbuilder.h b/source/apkbuilder.h index 673063e..7346b75 100644 --- a/source/apkbuilder.h +++ b/source/apkbuilder.h @@ -11,7 +11,7 @@ private: public: ApkBuilder(Builder &); - Target *create_target(const std::list &, const std::string &) override; + Target *create_target(const std::vector &, const std::string &) override; protected: void do_prepare() override; public: diff --git a/source/architecture.h b/source/architecture.h index 776de85..a31ad9f 100644 --- a/source/architecture.h +++ b/source/architecture.h @@ -32,7 +32,7 @@ private: std::string name; bool native; std::string cross_prefix; - std::map> filename_patterns; + std::map> 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 - const std::list &get_patterns() const; + const std::vector &get_patterns() const; template std::string create_filename(const std::string &) const; @@ -67,20 +67,20 @@ private: }; template -inline const std::list &Architecture::get_patterns() const +inline const std::vector &Architecture::get_patterns() const { auto i = filename_patterns.find(typeid(T).name()); if(i!=filename_patterns.end()) return i->second; - static std::list empty; + static std::vector empty; return empty; } template inline std::string Architecture::create_filename(const std::string &base) const { - const std::list &patterns = get_patterns(); + const std::vector &patterns = get_patterns(); return patterns.empty() ? base : patterns.front().apply(base); } diff --git a/source/binary.cpp b/source/binary.cpp index 7b5bac8..ffffaa5 100644 --- a/source/binary.cpp +++ b/source/binary.cpp @@ -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 &objs): +Binary::Binary(Builder &b, const Component &c, const string &p, const vector &objs): FileTarget(b, c.get_package(), c.get_package().get_output_directory()/p), objects(objs) { diff --git a/source/binary.h b/source/binary.h index a9e8de1..16ed1ec 100644 --- a/source/binary.h +++ b/source/binary.h @@ -17,10 +17,10 @@ private: BuildInfo static_binfo; protected: - std::list objects; + std::vector objects; Binary(Builder &, const Msp::FS::Path &); - Binary(Builder &, const Component &, const std::string &, const std::list &); + Binary(Builder &, const Component &, const std::string &, const std::vector &); public: void collect_build_info(BuildInfo &) const override; diff --git a/source/binarycomponent.cpp b/source/binarycomponent.cpp index f1aaa0e..608ed3f 100644 --- a/source/binarycomponent.cpp +++ b/source/binarycomponent.cpp @@ -53,8 +53,9 @@ void BinaryComponent::create_targets() const const Toolchain &toolchain = builder.get_toolchain(); const Toolchain &pkg_tools = package.get_toolchain(); - list objs; - list source_filenames = collect_source_files(); + vector objs; + vector 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 templates; + vector 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 results; + vector results; + results.reserve(2); if(type==LIBRARY) { Tool &archiver = toolchain.get_tool("AR"); diff --git a/source/binarycomponent.h b/source/binarycomponent.h index c31fff2..eca9508 100644 --- a/source/binarycomponent.h +++ b/source/binarycomponent.h @@ -23,7 +23,7 @@ public: private: Type type; - std::list uses; + std::vector uses; public: BinaryComponent(SourcePackage &, const std::string &, Type); diff --git a/source/binarypackage.cpp b/source/binarypackage.cpp index c0d688a..66d1225 100644 --- a/source/binarypackage.cpp +++ b/source/binarypackage.cpp @@ -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 bases; + vector 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 */ diff --git a/source/binarypackage.h b/source/binarypackage.h index b960155..62a8acf 100644 --- a/source/binarypackage.h +++ b/source/binarypackage.h @@ -23,7 +23,7 @@ public: private: Msp::FS::Path base_path; - std::list headers; + std::vector headers; BuildInfo static_binfo; public: diff --git a/source/builder.cpp b/source/builder.cpp index 46bc704..1b8ed3c 100644 --- a/source/builder.cpp +++ b/source/builder.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -113,9 +114,9 @@ void Builder::set_logger(const Logger *l) logger = (l ? l : &default_logger); } -list Builder::collect_problems() const +vector Builder::collect_problems() const { - list problems; + vector problems; set broken_packages; set broken_components; set 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 clean_tgts; - list queue; + deque queue; queue.push_back(&build_graph.get_goals()); while(!queue.empty()) diff --git a/source/builder.h b/source/builder.h index b7b0b78..5d62a9a 100644 --- a/source/builder.h +++ b/source/builder.h @@ -1,7 +1,6 @@ #ifndef BUILDER_H_ #define BUILDER_H_ -#include #include #include #include @@ -86,7 +85,7 @@ public: void set_logger(const Logger *); const Logger &get_logger() const { return *logger; } - std::list collect_problems() const; + std::vector 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 diff --git a/source/buildercli.cpp b/source/buildercli.cpp index 8ba8d96..2469f51 100644 --- a/source/buildercli.cpp +++ b/source/buildercli.cpp @@ -39,7 +39,7 @@ BuilderCLI::BuilderCLI(int argc, char **argv): bool no_externals = false; unsigned verbose = 1; bool silent = false; - list log_channels; + vector log_channels; string build_type; GetOpt getopt; @@ -136,7 +136,7 @@ BuilderCLI::BuilderCLI(int argc, char **argv): builder.set_architecture(tolower(arch)); - list start_files; + vector 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 package_details; + vector 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 problems = builder.collect_problems(); + vector 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); diff --git a/source/buildercli.h b/source/buildercli.h index 28388a0..4fcdb03 100644 --- a/source/buildercli.h +++ b/source/buildercli.h @@ -12,7 +12,7 @@ Provides a command-line interface for Builder. class BuilderCLI: public Msp::RegisteredApplication { private: - std::list cmdline_targets; + std::vector 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 what_if; + std::vector what_if; bool conf_all; bool conf_only; bool build_all; diff --git a/source/buildinfo.cpp b/source/buildinfo.cpp index 2925448..43e1427 100644 --- a/source/buildinfo.cpp +++ b/source/buildinfo.cpp @@ -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 -void unique(list &l) +void unique(vector &v) { - set seen; - for(auto i=l.begin(); i!=l.end(); ) + vector 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++); } } diff --git a/source/buildinfo.h b/source/buildinfo.h index f84315c..203ba5f 100644 --- a/source/buildinfo.h +++ b/source/buildinfo.h @@ -1,8 +1,8 @@ #ifndef BUILDINFO_H_ #define BUILDINFO_H_ -#include #include +#include #include #include @@ -91,14 +91,14 @@ public: Tracked sysroot; std::map defines; - std::list incpath; - std::list local_incpath; - std::list libpath; - std::list libs; + std::vector incpath; + std::vector local_incpath; + std::vector libpath; + std::vector libs; Tracked libmode; Tracked rpath_mode; std::map libmodes; - std::list keep_symbols; + std::vector keep_symbols; std::map standards; Tracked threads; Tracked debug; diff --git a/source/cache.h b/source/cache.h index cf7253f..f3a2c13 100644 --- a/source/cache.h +++ b/source/cache.h @@ -1,8 +1,8 @@ #ifndef CACHE_H_ #define CACHE_H_ -#include #include +#include #include #include @@ -20,7 +20,7 @@ unprintable characters or nuls. class Cache { public: - using Values = std::list; + using Values = std::vector; private: using Key = std::pair; diff --git a/source/compilecommandsgenerator.cpp b/source/compilecommandsgenerator.cpp index 2f4e07b..82221e7 100644 --- a/source/compilecommandsgenerator.cpp +++ b/source/compilecommandsgenerator.cpp @@ -14,7 +14,7 @@ CompileCommandsGenerator::CompileCommandsGenerator(Builder &b): Tool(b, "CCJG") { } -Target *CompileCommandsGenerator::create_target(const list &, const string &) +Target *CompileCommandsGenerator::create_target(const vector &, const string &) { throw logic_error("Not implemented"); } diff --git a/source/compilecommandsgenerator.h b/source/compilecommandsgenerator.h index 29bb043..519cad0 100644 --- a/source/compilecommandsgenerator.h +++ b/source/compilecommandsgenerator.h @@ -24,7 +24,7 @@ private: public: CompileCommandsGenerator(Builder &); - Target *create_target(const std::list &, const std::string &) override; + Target *create_target(const std::vector &, const std::string &) override; Task *run(const Target &) const override; }; diff --git a/source/component.cpp b/source/component.cpp index 6545b28..a571933 100644 --- a/source/component.cpp +++ b/source/component.cpp @@ -94,14 +94,15 @@ BuildInfo Component::get_build_info_for_path(const FS::Path &path) const return binfo; } -list Component::collect_source_files() const +vector Component::collect_source_files() const { - list files; + vector files; for(const FS::Path &p: sources) { if(FS::is_dir(p)) { - list dirs; + vector dirs; + dirs.reserve(1+overlays.size()); dirs.push_back(p); for(const string &o: overlays) { diff --git a/source/component.h b/source/component.h index 1db9259..bde558d 100644 --- a/source/component.h +++ b/source/component.h @@ -35,14 +35,14 @@ public: protected: SourcePackage &package; std::string name; - std::list sources; - std::list overlays; + std::vector sources; + std::vector overlays; bool install; BuildInfo build_info; Package::Requirements requires; bool deflt; InstallMap install_map; - std::list problems; + std::vector 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 &get_sources() const { return sources; } + const std::vector &get_sources() const { return sources; } - const std::list &get_overlays() const { return overlays; } + const std::vector &get_overlays() const { return overlays; } protected: /** Returns a list of all source files for the component. */ - std::list collect_source_files() const; + std::vector 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 &get_problems() const { return problems; } + const std::vector &get_problems() const { return problems; } /** Prepares any required packages. */ void prepare(); diff --git a/source/copy.cpp b/source/copy.cpp index 53118de..f7dab41 100644 --- a/source/copy.cpp +++ b/source/copy.cpp @@ -18,7 +18,7 @@ Copy::Copy(Builder &b): Tool(b, "CP") { } -Target *Copy::create_target(const list &sources, const string &arg) +Target *Copy::create_target(const vector &sources, const string &arg) { FileTarget &file_tgt = dynamic_cast(*sources.front()); InstalledFile *inst = new InstalledFile(builder, *file_tgt.get_package(), file_tgt, arg); diff --git a/source/copy.h b/source/copy.h index 6353ab1..5f20c16 100644 --- a/source/copy.h +++ b/source/copy.h @@ -31,7 +31,7 @@ private: public: Copy(Builder &); - Target *create_target(const std::list &, const std::string &) override; + Target *create_target(const std::vector &, const std::string &) override; Task *run(const Target &) const override; }; diff --git a/source/csourcefile.cpp b/source/csourcefile.cpp index 41dbd43..e9b0bc8 100644 --- a/source/csourcefile.cpp +++ b/source/csourcefile.cpp @@ -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) diff --git a/source/csourcefile.h b/source/csourcefile.h index e585721..da966eb 100644 --- a/source/csourcefile.h +++ b/source/csourcefile.h @@ -10,14 +10,14 @@ Represents a C or C++ source file. class CSourceFile: public SourceFile { protected: - std::list includes; + std::vector 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 &get_includes() const { return includes; } + const std::vector &get_includes() const { return includes; } protected: virtual void parse_includes(Msp::IO::Base &); void find_dependencies() override; diff --git a/source/datapack.cpp b/source/datapack.cpp index cb207d4..713120f 100644 --- a/source/datapack.cpp +++ b/source/datapack.cpp @@ -4,7 +4,7 @@ using namespace std; -DataPack::DataPack(Builder &b, const Component &c, const list &f): +DataPack::DataPack(Builder &b, const Component &c, const vector &f): FileTarget(b, c.get_package(), generate_target_path(c)), files(f) { diff --git a/source/datapack.h b/source/datapack.h index f676f4a..b02922f 100644 --- a/source/datapack.h +++ b/source/datapack.h @@ -6,17 +6,17 @@ class DataPack: public FileTarget { private: - std::list files; + std::vector files; public: - DataPack(Builder &, const Component &, const std::list &); + DataPack(Builder &, const Component &, const std::vector &); private: static Msp::FS::Path generate_target_path(const Component &); public: const char *get_type() const override { return "DataPack"; } - const std::list &get_files() const { return files; } + const std::vector &get_files() const { return files; } }; #endif diff --git a/source/datapackcomponent.cpp b/source/datapackcomponent.cpp index b95770f..5750287 100644 --- a/source/datapackcomponent.cpp +++ b/source/datapackcomponent.cpp @@ -17,7 +17,7 @@ void DataPackComponent::create_targets() const Builder &builder = package.get_builder(); Tool &dcomp = builder.get_toolchain().get_tool("DATA"); - list files; + vector files; for(const FS::Path &s: collect_source_files()) { string ext = FS::extpart(FS::basename(s)); diff --git a/source/datatool.cpp b/source/datatool.cpp index 75d52aa..b24de13 100644 --- a/source/datatool.cpp +++ b/source/datatool.cpp @@ -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 &sources, const string &arg) +Target *DataTool::create_target(const vector &sources, const string &arg) { if(arg=="collection") { @@ -39,7 +39,8 @@ Target *DataTool::create_target(const list &sources, const string &arg { if(sources.empty()) throw invalid_argument("DataTool::create_target"); - list files; + vector files; + files.reserve(sources.size()); for(Target *t: sources) files.push_back(&dynamic_cast(*t)); DataPack *pack = new DataPack(builder, *files.front()->get_component(), files); diff --git a/source/datatool.h b/source/datatool.h index 7996ab5..128f833 100644 --- a/source/datatool.h +++ b/source/datatool.h @@ -9,7 +9,7 @@ public: DataTool(Builder &); Target *create_source(const Component &, const Msp::FS::Path &) const override; - Target *create_target(const std::list &, const std::string &) override; + Target *create_target(const std::vector &, const std::string &) override; std::string create_build_signature(const BuildInfo &) const override; Task *run(const Target &) const override; }; diff --git a/source/datatransform.cpp b/source/datatransform.cpp index 4f5806c..055587a 100644 --- a/source/datatransform.cpp +++ b/source/datatransform.cpp @@ -24,7 +24,7 @@ DataTransform::DataTransform(Builder &b, const Component &c, const FS::Path &p): void DataTransform::find_dependencies() { - list files; + vector files; Cache &cache = component->get_package().get_cache(); const Time::TimeStamp &cache_mtime = cache.get_mtime(); if(mtime &objs): +Executable::Executable(Builder &b, const Component &c, const vector &objs): Binary(b, c, b.get_current_arch().create_filename(c.get_name()), objs) { install_location = "bin"; diff --git a/source/executable.h b/source/executable.h index e9c99ab..a75e26e 100644 --- a/source/executable.h +++ b/source/executable.h @@ -7,7 +7,7 @@ class Executable: public Binary { public: Executable(Builder &, const Msp::FS::Path &); - Executable(Builder &, const Component &, const std::list &); + Executable(Builder &, const Component &, const std::vector &); const char *get_type() const override { return "Executable"; } }; diff --git a/source/exportdefinitions.cpp b/source/exportdefinitions.cpp index 1af7603..7edf759 100644 --- a/source/exportdefinitions.cpp +++ b/source/exportdefinitions.cpp @@ -6,7 +6,7 @@ using namespace std; using namespace Msp; -ExportDefinitions::ExportDefinitions(Builder &b, const Component &c, const list &objs): +ExportDefinitions::ExportDefinitions(Builder &b, const Component &c, const vector &objs): FileTarget(b, c.get_package(), generate_target_path(c)) { component = &c; diff --git a/source/exportdefinitions.h b/source/exportdefinitions.h index 3e7a994..b8631ee 100644 --- a/source/exportdefinitions.h +++ b/source/exportdefinitions.h @@ -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 &); + ExportDefinitions(Builder &, const Component &, const std::vector &); private: static Msp::FS::Path generate_target_path(const Component &); diff --git a/source/feature.h b/source/feature.h index f0134db..2ab2081 100644 --- a/source/feature.h +++ b/source/feature.h @@ -17,7 +17,7 @@ struct Feature std::string name; std::string description; std::string default_value; - std::list choices; + std::vector choices; bool exported; Feature(const std::string &); diff --git a/source/filetarget.cpp b/source/filetarget.cpp index 493f020..1434372 100644 --- a/source/filetarget.cpp +++ b/source/filetarget.cpp @@ -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 sigs; + vector 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 depend_tools; + vector seen_tools; + vector 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(), ";"); } diff --git a/source/gnuarchiver.cpp b/source/gnuarchiver.cpp index f802031..24a022f 100644 --- a/source/gnuarchiver.cpp +++ b/source/gnuarchiver.cpp @@ -21,12 +21,13 @@ GnuArchiver::GnuArchiver(Builder &b, const Architecture &a): processing_unit = COMPONENT; } -Target *GnuArchiver::create_target(const list &sources, const string &) +Target *GnuArchiver::create_target(const vector &sources, const string &) { if(sources.empty()) throw invalid_argument("GnuArchiver::create_target"); - list objs; + vector objs; + objs.reserve(sources.size()); for(Target *s: sources) objs.push_back(&dynamic_cast(*s)); diff --git a/source/gnuarchiver.h b/source/gnuarchiver.h index 702b7eb..0e4172b 100644 --- a/source/gnuarchiver.h +++ b/source/gnuarchiver.h @@ -8,7 +8,7 @@ class GnuArchiver: public Tool public: GnuArchiver(Builder &, const Architecture &); - Target *create_target(const std::list &, const std::string &) override; + Target *create_target(const std::vector &, const std::string &) override; Task *run(const Target &) const override; }; diff --git a/source/gnucompiler.cpp b/source/gnucompiler.cpp index 97d3b30..9e7eb39 100644 --- a/source/gnucompiler.cpp +++ b/source/gnucompiler.cpp @@ -69,7 +69,7 @@ Target *GnuCompiler::create_source(const FS::Path &path) const return new CSourceFile(builder, path); } -Target *GnuCompiler::create_target(const list &sources, const string &) +Target *GnuCompiler::create_target(const vector &sources, const string &) { if(sources.size()!=1) throw invalid_argument("GnuCompiler::create_target"); diff --git a/source/gnucompiler.h b/source/gnucompiler.h index 9f81ac8..1983f79 100644 --- a/source/gnucompiler.h +++ b/source/gnucompiler.h @@ -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 &, const std::string &) override; + Target *create_target(const std::vector &, const std::string &) override; std::string create_build_signature(const BuildInfo &) const override; protected: void do_prepare() override; diff --git a/source/gnulinker.cpp b/source/gnulinker.cpp index ddad8d1..72c8b07 100644 --- a/source/gnulinker.cpp +++ b/source/gnulinker.cpp @@ -39,11 +39,12 @@ GnuLinker::~GnuLinker() delete cxx_linker; } -Target *GnuLinker::create_target(const list &sources, const string &arg) +Target *GnuLinker::create_target(const vector &sources, const string &arg) { if(sources.empty()) throw invalid_argument("GnuLinker::create_target"); - list objs; + vector objs; + objs.reserve(sources.size()); Linker *linker = default_linker; for(Target *s: sources) { diff --git a/source/gnulinker.h b/source/gnulinker.h index eb2b00f..0644e94 100644 --- a/source/gnulinker.h +++ b/source/gnulinker.h @@ -35,7 +35,7 @@ public: GnuLinker(Builder &, const Architecture &); ~GnuLinker(); - Target *create_target(const std::list &, const std::string &) override; + Target *create_target(const std::vector &, const std::string &) override; Target *create_install(Target &) const override; protected: void do_prepare() override; diff --git a/source/installmap.h b/source/installmap.h index 955decc..49211d7 100644 --- a/source/installmap.h +++ b/source/installmap.h @@ -1,7 +1,7 @@ #ifndef INSTALLMAP_H_ #define INSTALLMAP_H_ -#include +#include #include #include @@ -36,7 +36,7 @@ private: Msp::FS::Path install; }; - std::list entries; + std::vector entries; public: /** Adds an install mapping. Multiple mappings can be specified for the diff --git a/source/jarsigner.cpp b/source/jarsigner.cpp index 991a718..c8448d2 100644 --- a/source/jarsigner.cpp +++ b/source/jarsigner.cpp @@ -15,7 +15,7 @@ JarSigner::JarSigner(Builder &b): set_command("jarsigner"); } -Target *JarSigner::create_target(const list &, const string &) +Target *JarSigner::create_target(const vector &, const string &) { throw logic_error("not implemented"); } diff --git a/source/jarsigner.h b/source/jarsigner.h index 9b695db..6f51244 100644 --- a/source/jarsigner.h +++ b/source/jarsigner.h @@ -8,7 +8,7 @@ class JarSigner: public Tool public: JarSigner(Builder &); - Target *create_target(const std::list &, const std::string &) override; + Target *create_target(const std::vector &, const std::string &) override; Task *run(const Target &) const override; }; diff --git a/source/mingwdlltool.cpp b/source/mingwdlltool.cpp index dc9022e..922fe51 100644 --- a/source/mingwdlltool.cpp +++ b/source/mingwdlltool.cpp @@ -21,13 +21,14 @@ MingwDllTool::MingwDllTool(Builder &b, const Architecture &a): set_command("dlltool", true); } -Target *MingwDllTool::create_target(const list &sources, const string &) +Target *MingwDllTool::create_target(const vector &sources, const string &) { if(sources.size()!=1) throw invalid_argument("MingwDllTool::create_target"); SharedLibrary &shlib = dynamic_cast(*sources.front()); - list objs; + vector objs; + objs.reserve(shlib.get_dependencies().size()); for(Target *d: shlib.get_dependencies()) if(ObjectFile *obj = dynamic_cast(d)) objs.push_back(obj); diff --git a/source/mingwdlltool.h b/source/mingwdlltool.h index 2d2a621..039ee7c 100644 --- a/source/mingwdlltool.h +++ b/source/mingwdlltool.h @@ -8,7 +8,7 @@ class MingwDllTool: public Tool public: MingwDllTool(Builder &, const Architecture &); - Target *create_target(const std::list &, const std::string &) override; + Target *create_target(const std::vector &, const std::string &) override; Target *create_install(Target &) const override; Task *run(const Target &) const override; }; diff --git a/source/msvcarchiver.cpp b/source/msvcarchiver.cpp index 4a44bee..5544b27 100644 --- a/source/msvcarchiver.cpp +++ b/source/msvcarchiver.cpp @@ -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 &sources, const string &) +Target *MsvcArchiver::create_target(const vector &sources, const string &) { if(sources.empty()) throw invalid_argument("MsvcArchiver::create_target"); - list objs; + vector objs; + objs.reserve(sources.size()); for(Target *s: sources) objs.push_back(&dynamic_cast(*s)); diff --git a/source/msvcarchiver.h b/source/msvcarchiver.h index d09e145..03544a9 100644 --- a/source/msvcarchiver.h +++ b/source/msvcarchiver.h @@ -13,7 +13,7 @@ private: public: MsvcArchiver(Builder &, const Architecture &, const MicrosoftTools &); - Target *create_target(const std::list &, const std::string &) override; + Target *create_target(const std::vector &, const std::string &) override; Task *run(const Target &) const override; }; diff --git a/source/msvccompiler.cpp b/source/msvccompiler.cpp index df6bd46..c406627 100644 --- a/source/msvccompiler.cpp +++ b/source/msvccompiler.cpp @@ -46,7 +46,7 @@ Target *MsvcCompiler::create_source(const FS::Path &path) const return new CSourceFile(builder, path); } -Target *MsvcCompiler::create_target(const list &sources, const string &) +Target *MsvcCompiler::create_target(const vector &sources, const string &) { if(sources.size()!=1) throw invalid_argument("MsvcCompiler::create_target"); diff --git a/source/msvccompiler.h b/source/msvccompiler.h index bf2524a..ef1da34 100644 --- a/source/msvccompiler.h +++ b/source/msvccompiler.h @@ -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 &, const std::string &) override; + Target *create_target(const std::vector &, const std::string &) override; std::string create_build_signature(const BuildInfo &) const override; protected: diff --git a/source/msvclinker.cpp b/source/msvclinker.cpp index 4495db7..f6d514b 100644 --- a/source/msvclinker.cpp +++ b/source/msvclinker.cpp @@ -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 &sources, const string &arg) +Target *MsvcLinker::create_target(const vector &sources, const string &arg) { if(sources.empty()) throw invalid_argument("MsvcLinker::create_target"); - list objs; + vector objs; + objs.reserve(sources.size()); for(Target *s: sources) objs.push_back(&dynamic_cast(*s)); diff --git a/source/msvclinker.h b/source/msvclinker.h index f1e275d..26b2aba 100644 --- a/source/msvclinker.h +++ b/source/msvclinker.h @@ -13,7 +13,7 @@ private: public: MsvcLinker(Builder &, const Architecture &, const MicrosoftTools &); - Target *create_target(const std::list &, const std::string &) override; + Target *create_target(const std::vector &, const std::string &) override; std::string create_build_signature(const BuildInfo &) const override; protected: diff --git a/source/package.h b/source/package.h index a7ae7d4..bb3c809 100644 --- a/source/package.h +++ b/source/package.h @@ -1,8 +1,8 @@ #ifndef PACKAGE_H_ #define PACKAGE_H_ -#include #include +#include #include #include "buildinfo.h" #include "conditionalloader.h" @@ -27,7 +27,7 @@ public: void require(const std::string &); }; - using Requirements = std::list; + using Requirements = std::vector; protected: Builder &builder; @@ -38,7 +38,7 @@ protected: Requirements requires; BuildInfo export_binfo; bool prepared; - std::list problems; + std::vector problems; bool use_pkgconfig; @@ -66,7 +66,7 @@ protected: public: bool is_prepared() const { return prepared; } - const std::list &get_problems() const { return problems; } + const std::vector &get_problems() const { return problems; } virtual void save_caches() { } }; diff --git a/source/packagemanager.h b/source/packagemanager.h index 9da4af3..a2c684e 100644 --- a/source/packagemanager.h +++ b/source/packagemanager.h @@ -1,9 +1,9 @@ #ifndef PACKAGEMANAGER_H_ #define PACKAGEMANAGER_H_ -#include #include #include +#include #include class Builder; @@ -17,10 +17,10 @@ class PackageManager { private: Builder &builder; - std::list pkg_path; - std::list pkg_dirs; - std::list binpkg_path; - std::list binpkg_files; + std::vector pkg_path; + std::vector pkg_dirs; + std::vector binpkg_path; + std::vector binpkg_files; bool no_externals; std::map packages; Package *main_pkg; diff --git a/source/pattern.cpp b/source/pattern.cpp index d910f19..fec83da 100644 --- a/source/pattern.cpp +++ b/source/pattern.cpp @@ -22,9 +22,9 @@ string Pattern::apply(const string &body) const return result; } -list Pattern::apply_list(const list &patterns, const string &body) +vector Pattern::apply_list(const vector &patterns, const string &body) { - list result; + vector result; for(const Pattern &p: patterns) result.push_back(p.apply(body)); return result; diff --git a/source/pattern.h b/source/pattern.h index 5965efa..8c623bd 100644 --- a/source/pattern.h +++ b/source/pattern.h @@ -1,8 +1,8 @@ #ifndef PATTERN_H_ #define PATTERN_H_ -#include #include +#include /** 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 apply_list(const std::list &, const std::string &); + static std::vector apply_list(const std::vector &, const std::string &); }; #endif diff --git a/source/pkgconfiggenerator.cpp b/source/pkgconfiggenerator.cpp index e932044..f042ec5 100644 --- a/source/pkgconfiggenerator.cpp +++ b/source/pkgconfiggenerator.cpp @@ -13,7 +13,7 @@ PkgConfigGenerator::PkgConfigGenerator(Builder &b): { } -Target *PkgConfigGenerator::create_target(const list &, const string &) +Target *PkgConfigGenerator::create_target(const vector &, const string &) { throw logic_error("Not implemented"); } diff --git a/source/pkgconfiggenerator.h b/source/pkgconfiggenerator.h index a13e588..3b28e3f 100644 --- a/source/pkgconfiggenerator.h +++ b/source/pkgconfiggenerator.h @@ -26,7 +26,7 @@ private: public: PkgConfigGenerator(Builder &); - Target *create_target(const std::list &, const std::string &) override; + Target *create_target(const std::vector &, const std::string &) override; Task *run(const Target &) const override; }; diff --git a/source/sharedlibrary.cpp b/source/sharedlibrary.cpp index a6e8239..4ef9bb6 100644 --- a/source/sharedlibrary.cpp +++ b/source/sharedlibrary.cpp @@ -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 &objs): +SharedLibrary::SharedLibrary(Builder &b, const Component &c, const vector &objs): Binary(b, c, generate_filename(c), objs), libname(c.get_name()), import_lib(0) diff --git a/source/sharedlibrary.h b/source/sharedlibrary.h index b2cd59b..54822aa 100644 --- a/source/sharedlibrary.h +++ b/source/sharedlibrary.h @@ -23,7 +23,7 @@ private: public: SharedLibrary(Builder &, const Msp::FS::Path &); - SharedLibrary(Builder &, const Component &, const std::list &); + SharedLibrary(Builder &, const Component &, const std::vector &); private: static std::string generate_filename(const Component &); diff --git a/source/sourcearchivecomponent.cpp b/source/sourcearchivecomponent.cpp index 027debc..b1e4279 100644 --- a/source/sourcearchivecomponent.cpp +++ b/source/sourcearchivecomponent.cpp @@ -16,8 +16,8 @@ void SourceArchiveComponent::create_targets() const { Builder &builder = package.get_builder(); - list files; - files.insert(files.begin(), &package.get_build_file()); + vector files; + files.push_back(&package.get_build_file()); for(const FS::Path &s: collect_source_files()) { diff --git a/source/sourcegenerator.cpp b/source/sourcegenerator.cpp index f4b43a8..cfb01af 100644 --- a/source/sourcegenerator.cpp +++ b/source/sourcegenerator.cpp @@ -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 &sources, const string &) +Target *SourceGenerator::create_target(const vector &sources, const string &) { if(sources.empty()) throw invalid_argument("SourceGenerator::create_target"); diff --git a/source/sourcegenerator.h b/source/sourcegenerator.h index 964ea0a..3b96799 100644 --- a/source/sourcegenerator.h +++ b/source/sourcegenerator.h @@ -25,15 +25,15 @@ public: private: const SourcePackage &package; - std::list out_suffixes; - std::list arguments; + std::vector out_suffixes; + std::vector 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 &, const std::string &) override; + Target *create_target(const std::vector &, const std::string &) override; Task *run(const Target &) const override; }; diff --git a/source/sourcepackage.cpp b/source/sourcepackage.cpp index 6016271..40b098c 100644 --- a/source/sourcepackage.cpp +++ b/source/sourcepackage.cpp @@ -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) diff --git a/source/sourcepackage.h b/source/sourcepackage.h index cb2ab9d..23e8f36 100644 --- a/source/sourcepackage.h +++ b/source/sourcepackage.h @@ -55,9 +55,9 @@ private: Msp::FS::Path source_dir; const BuildType *build_type; Toolchain local_tools; - std::list features; + std::vector features; BuildInfo build_info; - std::list components; + std::vector components; SourceArchiveComponent *source_archive; Config config; mutable Cache cache; diff --git a/source/staticlibrary.cpp b/source/staticlibrary.cpp index 853d1b4..c515966 100644 --- a/source/staticlibrary.cpp +++ b/source/staticlibrary.cpp @@ -11,7 +11,7 @@ StaticLibrary::StaticLibrary(Builder &b, const FS::Path &p): FileTarget(b, p) { } -StaticLibrary::StaticLibrary(Builder &b, const Component &c, const list &objs): +StaticLibrary::StaticLibrary(Builder &b, const Component &c, const vector &objs): FileTarget(b, c.get_package(), c.get_package().get_output_directory()/generate_filename(c)) { component = &c; diff --git a/source/staticlibrary.h b/source/staticlibrary.h index af8a57c..6b52871 100644 --- a/source/staticlibrary.h +++ b/source/staticlibrary.h @@ -19,7 +19,7 @@ private: public: StaticLibrary(Builder &, const Msp::FS::Path &); - StaticLibrary(Builder &, const Component &, const std::list &); + StaticLibrary(Builder &, const Component &, const std::vector &); private: static std::string generate_filename(const Component &); diff --git a/source/tar.cpp b/source/tar.cpp index 346638e..8de76fe 100644 --- a/source/tar.cpp +++ b/source/tar.cpp @@ -17,7 +17,7 @@ Tar::Tar(Builder &b): processing_unit = COMPONENT; } -Target *Tar::create_target(const list &sources, const string &arg) +Target *Tar::create_target(const vector &sources, const string &arg) { if(sources.empty() || !sources.front()->get_package()) throw invalid_argument("Tar::create_target"); diff --git a/source/tar.h b/source/tar.h index 3719c41..d0240d9 100644 --- a/source/tar.h +++ b/source/tar.h @@ -26,7 +26,7 @@ private: public: Tar(Builder &); - Target *create_target(const std::list &, const std::string &) override; + Target *create_target(const std::vector &, const std::string &) override; Task *run(const Target &) const override; }; diff --git a/source/target.h b/source/target.h index c4a822b..2824e2a 100644 --- a/source/target.h +++ b/source/target.h @@ -1,10 +1,10 @@ #ifndef TARGET_H_ #define TARGET_H_ -#include #include #include #include +#include #include #include @@ -27,7 +27,7 @@ dependencies can be used by other targets further down the chain. class Target { public: - using Dependencies = std::list; + using Dependencies = std::vector; protected: enum State @@ -53,7 +53,7 @@ protected: Tool *tool; State state; std::string rebuild_reason; - std::list problems; + std::vector problems; Dependencies depends; Dependencies trans_depends; @@ -141,7 +141,7 @@ protected: public: bool is_broken() const { return state==BROKEN; } - const std::list &get_problems() const { return problems; } + const std::vector &get_problems() const { return problems; } /** Prepares the target by finding dependencies, recursively preparing them and then checking whether rebuilding is needed. */ diff --git a/source/task.h b/source/task.h index 0890007..97cf8d6 100644 --- a/source/task.h +++ b/source/task.h @@ -23,7 +23,7 @@ public: sigc::signal signal_finished; protected: - std::list files; + std::vector files; bool unlink; Task(); diff --git a/source/tool.cpp b/source/tool.cpp index 377dc7f..5413821 100644 --- a/source/tool.cpp +++ b/source/tool.cpp @@ -45,7 +45,7 @@ bool Tool::accepts_suffix(const string &suffix, bool aux) const Target *Tool::create_target(Target &source, const string &arg) { - list sources; + vector 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 &s, const string &a) +Target *SubTool::create_target(const vector &s, const string &a) { return parent.create_target(s, a); } diff --git a/source/tool.h b/source/tool.h index c49b4c4..ce08a00 100644 --- a/source/tool.h +++ b/source/tool.h @@ -1,8 +1,8 @@ #ifndef TOOL_H_ #define TOOL_H_ -#include #include +#include #include #include "buildinfo.h" #include "virtualfilesystem.h" @@ -35,13 +35,13 @@ protected: std::string tag; std::string command; FileTarget *executable; - std::list input_suffixes; - std::list aux_suffixes; + std::vector input_suffixes; + std::vector aux_suffixes; ProcessingUnit processing_unit; VirtualFileSystem::SearchPath system_path; BuildInfo build_info; bool prepared; - std::list problems; + std::vector 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 &get_input_suffixes() const { return input_suffixes; } + const std::vector &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 &get_auxiliary_suffixes() const { return aux_suffixes; } + const std::vector &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 &, const std::string & = std::string()) = 0; + virtual Target *create_target(const std::vector &, 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 &get_problems() const { return problems; } + const std::vector &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 &, const std::string & = std::string()) override; + Target *create_target(const std::vector &, const std::string & = std::string()) override; Target *create_install(Target &) const override; std::string create_build_signature(const BuildInfo &) const override; }; diff --git a/source/toolchain.h b/source/toolchain.h index a70cdb7..ea45240 100644 --- a/source/toolchain.h +++ b/source/toolchain.h @@ -1,9 +1,9 @@ #ifndef TOOLCHAIN_H_ #define TOOLCHAIN_H_ -#include #include #include +#include class Tool; @@ -14,7 +14,7 @@ class Toolchain { private: std::map tools; - std::list chains; + std::vector chains; public: ~Toolchain(); diff --git a/source/vcxprojectgenerator.cpp b/source/vcxprojectgenerator.cpp index 8535197..93c0eb4 100644 --- a/source/vcxprojectgenerator.cpp +++ b/source/vcxprojectgenerator.cpp @@ -16,7 +16,7 @@ VcxProjectGenerator::VcxProjectGenerator(Builder &b): Tool(b, "VCXG") { } -Target *VcxProjectGenerator::create_target(const list &, const string &) +Target *VcxProjectGenerator::create_target(const vector &, const string &) { throw logic_error("Not implemented"); } diff --git a/source/vcxprojectgenerator.h b/source/vcxprojectgenerator.h index 05bb720..a7feb1a 100644 --- a/source/vcxprojectgenerator.h +++ b/source/vcxprojectgenerator.h @@ -24,7 +24,7 @@ private: public: VcxProjectGenerator(Builder &); - Target *create_target(const std::list &, const std::string &) override; + Target *create_target(const std::vector &, const std::string &) override; Task *run(const Target &) const override; }; diff --git a/source/virtualfilesystem.cpp b/source/virtualfilesystem.cpp index c9bfd23..2fecdf0 100644 --- a/source/virtualfilesystem.cpp +++ b/source/virtualfilesystem.cpp @@ -84,7 +84,7 @@ FileTarget *VirtualFileSystem::find_library(const string &lib, const SearchPath const Architecture &arch = builder.get_current_arch(); - list shared_names; + vector 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(), lib); } - list static_names; + vector static_names; if(mode!=BuildInfo::FORCE_DYNAMIC) static_names = Pattern::apply_list(arch.get_patterns(), lib); for(const FS::Path &p: combined_path) { - const list *cur_names = (mode>=BuildInfo::DYNAMIC ? &shared_names : &static_names); + const vector *cur_names = (mode>=BuildInfo::DYNAMIC ? &shared_names : &static_names); for(auto j=cur_names->begin(); j!=cur_names->end(); ) { FS::Path filename = p / *j; diff --git a/source/virtualfilesystem.h b/source/virtualfilesystem.h index 9a25930..4aa20d4 100644 --- a/source/virtualfilesystem.h +++ b/source/virtualfilesystem.h @@ -1,9 +1,9 @@ #ifndef VIRTUALFILESYSTEM_H_ #define VIRTUALFILESYSTEM_H_ -#include #include #include +#include #include #include "buildinfo.h" @@ -20,7 +20,7 @@ possible to build them. class VirtualFileSystem { public: - using SearchPath = std::list; + using SearchPath = std::vector; private: Builder &builder; diff --git a/source/vssolutiongenerator.cpp b/source/vssolutiongenerator.cpp index 0c60689..a810cab 100644 --- a/source/vssolutiongenerator.cpp +++ b/source/vssolutiongenerator.cpp @@ -14,7 +14,7 @@ VsSolutionGenerator::VsSolutionGenerator(Builder &b): Tool(b, "VSSG") { } -Target *VsSolutionGenerator::create_target(const list &, const string &) +Target *VsSolutionGenerator::create_target(const vector &, const string &) { throw logic_error("Not implemented"); } diff --git a/source/vssolutiongenerator.h b/source/vssolutiongenerator.h index 2efddcd..14eae5f 100644 --- a/source/vssolutiongenerator.h +++ b/source/vssolutiongenerator.h @@ -24,7 +24,7 @@ private: public: VsSolutionGenerator(Builder &); - Target *create_target(const std::list &, const std::string &) override; + Target *create_target(const std::vector &, const std::string &) override; Task *run(const Target &) const override; }; -- 2.43.0