From 04d1549acb9e38e6d0c470fc40c2a718f31c78d3 Mon Sep 17 00:00:00 2001 From: dekken Date: Sun, 19 Nov 2023 20:27:45 +0100 Subject: [PATCH] mkn run -- arg0 / formatting --- .clang-format | 1 + README.noformat | 5 +-- inc/maiken/app.hpp | 34 ++++++++++---------- inc/maiken/compiler/compilers.hpp | 2 +- inc/maiken/dist.hpp | 18 +++++------ inc/maiken/dist/message.hpp | 52 +++++++++++++++---------------- inc/maiken/dist/server.hpp | 14 ++++----- inc/maiken/global.hpp | 12 +++---- inc/maiken/project.hpp | 12 +++---- inc/maiken/property.hpp | 4 +-- inc/maiken/scm.hpp | 8 ++--- inc/maiken/settings.hpp | 4 +-- mkn.cpp | 4 +-- mkn.yaml | 2 +- server.cpp | 6 ++-- src/maiken.cpp | 8 ++--- src/maiken/build.cpp | 2 +- src/maiken/build/obj.cpp | 4 +-- src/maiken/compiler/compilers.cpp | 2 +- src/maiken/compiler/csc.cpp | 4 +-- src/maiken/compiler/gcc.cpp | 7 ++--- src/maiken/compiler/win.cpp | 4 +-- src/maiken/create.cpp | 15 ++++----- src/maiken/dep.cpp | 2 +- src/maiken/depmod.cpp | 4 +-- src/maiken/dist/messages.cpp | 8 ++--- src/maiken/dist/post.cpp | 2 +- src/maiken/dist/rcm.cpp | 2 +- src/maiken/dist/server.cpp | 4 +-- src/maiken/mods.cpp | 4 +-- src/maiken/pack.cpp | 2 +- src/maiken/scm.cpp | 2 +- src/maiken/scm/getter.cpp | 10 +++--- src/maiken/setup.cpp | 2 +- src/maiken/threading/compile.cpp | 2 +- src/maiken/timestamps.cpp | 2 +- src/settings.cpp | 2 +- 37 files changed, 137 insertions(+), 135 deletions(-) diff --git a/.clang-format b/.clang-format index 4835500c..99f4b901 100644 --- a/.clang-format +++ b/.clang-format @@ -2,6 +2,7 @@ IndentWidth: 2 BasedOnStyle: 'google' ColumnLimit: 100 SortIncludes: false +QualifierAlignment: Right UseTab: Never DerivePointerAlignment: false PointerAlignment: Left diff --git a/README.noformat b/README.noformat index 7b51efd6..ab04df90 100644 --- a/README.noformat +++ b/README.noformat @@ -588,6 +588,7 @@ mkn clean build -dtKa -DARG - clean/compile with optimal threads passin mkn clean build -dtKa "-DARG -DARG1" - clean/compile with optimal threads passing -DARG and -DARG1/link everything statically mkn clean build -d 1 -t 2 -u - update/clean/compile with two threads/link project and immediate dependencies mkn -ds - Display "${scm} status" for everything +mkn run -- arg0 arg1 arg2 - Execute binary passing arguments to main as argc/argv 6. Environment Variables @@ -628,13 +629,13 @@ Type bool Default false Description Windows only: when attempting automatic settings.yaml creation, use cl even if clang/gcc are found -Key MKN_LIB_EXT_DEF +Key MKN_LIB_EXT Type string Default #ifdef _WIN32 evs["MKN_LIB_EXT"] = "dll"; #else evs["MKN_LIB_EXT"] = "so"; Description The file extention of shared objects being created. -Key MKN_LIB_PRE_DEF +Key MKN_LIB_PRE Type string Default #ifdef _WIN32 evs["MKN_LIB_PRE"] = ""; #else evs["MKN_LIB_PRE"] = "lib"; diff --git a/inc/maiken/app.hpp b/inc/maiken/app.hpp index 4fb1886f..fb7d3d74 100644 --- a/inc/maiken/app.hpp +++ b/inc/maiken/app.hpp @@ -120,7 +120,7 @@ class KUL_PUBLISH Application : public Constants { void scmStatus(bool const& deps = false) KTHROW(mkn::kul::scm::Exception); void scmUpdate(bool const& f) KTHROW(mkn::kul::scm::Exception); - void scmUpdate(bool const& f, const mkn::kul::SCM* scm, std::string const& repo) + void scmUpdate(bool const& f, mkn::kul::SCM const* scm, std::string const& repo) KTHROW(mkn::kul::scm::Exception); void setup() KTHROW(mkn::kul::Exception); @@ -128,7 +128,7 @@ class KUL_PUBLISH Application : public Constants { void showConfig(bool force = 0); void showTree() const; void showTreeRecursive(uint8_t i) const; - void cyclicCheck(const std::vector>& apps) const + void cyclicCheck(std::vector> const& apps) const KTHROW(mkn::kul::Exception); void showProfiles(); @@ -142,7 +142,7 @@ class KUL_PUBLISH Application : public Constants { void populateMapsFromDependencies() KTHROW(mkn::kul::Exception); - void loadDepOrMod(YAML::Node const& node, const mkn::kul::Dir& depOrMod, bool module) + void loadDepOrMod(YAML::Node const& node, mkn::kul::Dir const& depOrMod, bool module) KTHROW(mkn::kul::Exception); mkn::kul::Dir resolveDepOrModDirectory(YAML::Node const& d, bool module); void popDepOrMod(YAML::Node const& n, std::vector& vec, std::string const& s, @@ -226,27 +226,27 @@ class KUL_PUBLISH Application : public Constants { auto& main() const { return main_; } virtual void process() KTHROW(mkn::kul::Exception); - const mkn::kul::Dir& buildDir() const { return bd; } + mkn::kul::Dir const& buildDir() const { return bd; } std::string const& binary() const { return bin; } std::string const& profile() const { return p; } maiken::Project const& project() const { return proj; } - const std::vector& dependencies() const { return deps; } - const std::vector& revendencies() const { return rdeps; } - const std::vector& moduleDependencies() const { return modDeps; } - const std::vector>& modules() const { return mods; } - const mkn::kul::hash::map::S2T& files() const { return fs; } + std::vector const& dependencies() const { return deps; } + std::vector const& revendencies() const { return rdeps; } + std::vector const& moduleDependencies() const { return modDeps; } + std::vector> const& modules() const { return mods; } + mkn::kul::hash::map::S2T const& files() const { return fs; } std::vector const& libraries() const { return libs; } - const std::vector>& sources() const { return srcs; } - const std::vector>& includes() const { return incs; } + std::vector> const& sources() const { return srcs; } + std::vector> const& includes() const { return incs; } std::vector const& libraryPaths() const { return paths; } - const mkn::kul::hash::map::S2S& properties() const { return ps; } - const mkn::kul::hash::map::S2T& arguments() const { return args; } + mkn::kul::hash::map::S2S const& properties() const { return ps; } + mkn::kul::hash::map::S2T const& arguments() const { return args; } auto& mode() const { return m; } void mode(compiler::Mode mode) { m = mode; } std::vector& envVars() { return evs; } - const std::vector& envVars() const { return evs; } + std::vector const& envVars() const { return evs; } void add_def(std::string const& def) { defs.emplace_back(def); } std::vector const& defines() const { return defs; } @@ -254,7 +254,7 @@ class KUL_PUBLISH Application : public Constants { void addInclude(std::string const& s, bool p = 1) { auto it = std::find_if( incs.begin(), incs.end(), - [&](const std::pair& element) { return element.first == s; }); + [&](std::pair const& element) { return element.first == s; }); if (it == incs.end()) incs.emplace_back(s, p); } void addLibpath(std::string const& s) { paths.push_back(s); } @@ -296,7 +296,7 @@ class KUL_PUBLISH Application : public Constants { std::optional main_; std::string const p; mkn::kul::Dir bd, inst; - std::unordered_map modIArgs, modCArgs, modLArgs, modTArgs, modPArgs; + std::unordered_map modIArgs, modCArgs, modLArgs, modTArgs, modPArgs; maiken::Project const& proj; mkn::kul::hash::map::S2T fs; mkn::kul::hash::map::S2S cArg, cLnk, includeStamps, itss, ps, tests; @@ -308,7 +308,7 @@ class KUL_PUBLISH Application : public Constants { std::vector defs, libs, paths; std::vector> srcs; std::vector> incs; - const mkn::kul::SCM* scm = 0; + mkn::kul::SCM const* scm = 0; }; class Applications : public Constants { diff --git a/inc/maiken/compiler/compilers.hpp b/inc/maiken/compiler/compilers.hpp index b22225c8..01f2c00f 100644 --- a/inc/maiken/compiler/compilers.hpp +++ b/inc/maiken/compiler/compilers.hpp @@ -91,7 +91,7 @@ class Compilers { private: Compilers(); - std::string key(std::string comp, const mkn::kul::hash::map::S2T& map); + std::string key(std::string comp, mkn::kul::hash::map::S2T const& map); }; } // namespace maiken #endif /* _MAIKEN_CODE_COMPILERS_HPP_ */ diff --git a/inc/maiken/dist.hpp b/inc/maiken/dist.hpp index 05b0a76d..a630b1af 100644 --- a/inc/maiken/dist.hpp +++ b/inc/maiken/dist.hpp @@ -74,7 +74,7 @@ class DistLinker { static void send([[maybe_unused]] mkn::kul::File const& bin) { #if defined(_MKN_WITH_MKN_RAM_) && defined(_MKN_WITH_IO_CEREAL_) std::vector> posts; - auto post_lambda = [](const dist::Host& host, mkn::kul::File const& bin) { + auto post_lambda = [](dist::Host const& host, mkn::kul::File const& bin) { mkn::kul::io::BinaryReader br(bin); dist::Blob b; b.files_left = 1; @@ -148,7 +148,7 @@ class Post { explicit Post(ARequest* _msg) : msg(std::unique_ptr(_msg)) {} explicit Post(std::unique_ptr _msg) : msg(std::move(_msg)) {} - void send(const Host& host) KTHROW(Exception) { + void send(Host const& host) KTHROW(Exception) { send(host.host(), "res", host.port(), {{"session", host.session_id()}}); } void send(std::string const& host, std::string const& res, uint16_t const& port, @@ -162,10 +162,10 @@ class Post { private: Post() {} - Post(const Post&) = delete; - Post(const Post&&) = delete; - Post& operator=(const Post&) = delete; - Post& operator=(const Post&&) = delete; + Post(Post const&) = delete; + Post(Post const&&) = delete; + Post& operator=(Post const&) = delete; + Post& operator=(Post const&&) = delete; template void serialize(Archive& ar) { ar(::cereal::make_nvp("msg", msg)); @@ -188,13 +188,13 @@ class RemoteCommandManager { std::unique_ptr build_compile_request( std::string const& directory, - const std::vector>& src_obj); + std::vector> const& src_obj); std::unique_ptr build_download_request(); std::unique_ptr build_link_request(std::string const& b); - void build_hosts(const Settings& settings) KTHROW(mkn::kul::Exception) { + void build_hosts(Settings const& settings) KTHROW(mkn::kul::Exception) { if (settings.root()["dist"]) { if (settings.root()["dist"]["nodes"]) { for (auto const& node : settings.root()["dist"]["nodes"]) { @@ -204,7 +204,7 @@ class RemoteCommandManager { } } } - const std::vector& hosts() const { return m_hosts; } + std::vector const& hosts() const { return m_hosts; } private: std::vector m_hosts; diff --git a/inc/maiken/dist/message.hpp b/inc/maiken/dist/message.hpp index e6722d0a..ff110b7c 100644 --- a/inc/maiken/dist/message.hpp +++ b/inc/maiken/dist/message.hpp @@ -74,7 +74,7 @@ class ARequest : public AMessage { ar(::cereal::make_nvp("AMessage", ::cereal::base_class(this))); } - virtual void do_response_for(const mkn::kul::http::A1_1Request& req, Sessions& sessions, + virtual void do_response_for(mkn::kul::http::A1_1Request const& req, Sessions& sessions, mkn::kul::http::_1_1Response& resp) = 0; }; @@ -89,14 +89,14 @@ class SetupRequest : public ARequest { mkn::kul::cli::Args const& args) : m_project_yaml(project), m_settings_yaml(settings), m_args(args) {} - void do_response_for(const mkn::kul::http::A1_1Request& req, Sessions& sessions, + void do_response_for(mkn::kul::http::A1_1Request const& req, Sessions& sessions, mkn::kul::http::_1_1Response& resp) override; private: - SetupRequest(const SetupRequest&) = delete; - SetupRequest(const SetupRequest&&) = delete; - SetupRequest& operator=(const SetupRequest&) = delete; - SetupRequest& operator=(const SetupRequest&&) = delete; + SetupRequest(SetupRequest const&) = delete; + SetupRequest(SetupRequest const&&) = delete; + SetupRequest& operator=(SetupRequest const&) = delete; + SetupRequest& operator=(SetupRequest const&&) = delete; template void serialize(Archive& ar) { ar(::cereal::make_nvp("ARequest", ::cereal::base_class(this))); @@ -118,17 +118,17 @@ class CompileRequest : public ARequest { public: CompileRequest() {} CompileRequest(std::string const& directory, - const std::vector>& src_obj) + std::vector> const& src_obj) : m_directory(directory), m_src_obj(src_obj) {} - void do_response_for(const mkn::kul::http::A1_1Request& req, Sessions& sessions, + void do_response_for(mkn::kul::http::A1_1Request const& req, Sessions& sessions, mkn::kul::http::_1_1Response& resp) override; private: - CompileRequest(const CompileRequest&) = delete; - CompileRequest(const CompileRequest&&) = delete; - CompileRequest& operator=(const CompileRequest&) = delete; - CompileRequest& operator=(const CompileRequest&&) = delete; + CompileRequest(CompileRequest const&) = delete; + CompileRequest(CompileRequest const&&) = delete; + CompileRequest& operator=(CompileRequest const&) = delete; + CompileRequest& operator=(CompileRequest const&&) = delete; template void serialize(Archive& ar) { @@ -149,14 +149,14 @@ class DownloadRequest : public ARequest { public: DownloadRequest() {} - void do_response_for(const mkn::kul::http::A1_1Request& req, Sessions& sessions, + void do_response_for(mkn::kul::http::A1_1Request const& req, Sessions& sessions, mkn::kul::http::_1_1Response& resp) override; private: - DownloadRequest(const DownloadRequest&) = delete; - DownloadRequest(const DownloadRequest&&) = delete; - DownloadRequest& operator=(const DownloadRequest&) = delete; - DownloadRequest& operator=(const DownloadRequest&&) = delete; + DownloadRequest(DownloadRequest const&) = delete; + DownloadRequest(DownloadRequest const&&) = delete; + DownloadRequest& operator=(DownloadRequest const&) = delete; + DownloadRequest& operator=(DownloadRequest const&&) = delete; template void serialize(Archive& ar) { @@ -172,14 +172,14 @@ class LinkRequest : public ARequest { public: LinkRequest() {} LinkRequest(std::string const& b) { str = b; } - void do_response_for(const mkn::kul::http::A1_1Request& req, Sessions& sessions, + void do_response_for(mkn::kul::http::A1_1Request const& req, Sessions& sessions, mkn::kul::http::_1_1Response& resp) override; private: - LinkRequest(const LinkRequest&) = delete; - LinkRequest(const LinkRequest&&) = delete; - LinkRequest& operator=(const LinkRequest&) = delete; - LinkRequest& operator=(const LinkRequest&&) = delete; + LinkRequest(LinkRequest const&) = delete; + LinkRequest(LinkRequest const&&) = delete; + LinkRequest& operator=(LinkRequest const&) = delete; + LinkRequest& operator=(LinkRequest const&&) = delete; template void serialize(Archive& ar) { @@ -205,10 +205,10 @@ class Blob { } private: - Blob(const Blob&) = delete; - Blob(const Blob&&) = delete; - Blob& operator=(const Blob&) = delete; - Blob& operator=(const Blob&&) = delete; + Blob(Blob const&) = delete; + Blob(Blob const&&) = delete; + Blob& operator=(Blob const&) = delete; + Blob& operator=(Blob const&&) = delete; }; } // end namespace dist } // end namespace maiken diff --git a/inc/maiken/dist/server.hpp b/inc/maiken/dist/server.hpp index 9576bf6c..f198fd8c 100644 --- a/inc/maiken/dist/server.hpp +++ b/inc/maiken/dist/server.hpp @@ -49,7 +49,7 @@ class ServerSession { ServerSession() : start_time(mkn::kul::Now::MILLIS()) {} void reset_setup(SetupRequest* request) { setup.reset(request); } SetupRequest* setup_ptr() { return setup.get(); } - void set_apps(const std::vector& _apps) { this->apps = std::move(_apps); } + void set_apps(std::vector const& _apps) { this->apps = std::move(_apps); } std::vector apps_vector() { return apps; }; public: @@ -69,15 +69,15 @@ class Server : public mkn::kul::http::MultiServer, public Constants { friend class mkn::kul::Thread; public: - Server(uint16_t const port, const mkn::kul::Dir& _home, uint16_t threads) + Server(uint16_t const port, mkn::kul::Dir const& _home, uint16_t threads) : mkn::kul::http::MultiServer(port, 1, threads), busy(false), m_home(_home) {} virtual ~Server() {} - mkn::kul::http::_1_1Response respond(const mkn::kul::http::A1_1Request& req) override; + mkn::kul::http::_1_1Response respond(mkn::kul::http::A1_1Request const& req) override; - Server(const Server&) = delete; - Server(const Server&&) = delete; - Server& operator=(const Server&) = delete; - Server& operator=(const Server&&) = delete; + Server(Server const&) = delete; + Server(Server const&&) = delete; + Server& operator=(Server const&) = delete; + Server& operator=(Server const&&) = delete; protected: void onConnect(char const* cip, uint16_t const& port) override { diff --git a/inc/maiken/global.hpp b/inc/maiken/global.hpp index bf282f73..f293fff6 100644 --- a/inc/maiken/global.hpp +++ b/inc/maiken/global.hpp @@ -89,7 +89,7 @@ class AppVars : public Constants { std::string const& runArgs() const { return ra; } void runArgs(std::string const& ra) { this->ra = ra; } - const mkn::kul::hash::map::S2S& jargs() const { return jas; } + mkn::kul::hash::map::S2S const& jargs() const { return jas; } void jargs(std::string const& a, std::string const& b) { jas[a] = b; } std::string const& linker() const { return la; } @@ -137,10 +137,10 @@ class AppVars : public Constants { uint16_t const& threads() const { return ts; } void threads(uint16_t const& t) { this->ts = t; } - const mkn::kul::hash::map::S2S& properkeys() const { return pks; } + mkn::kul::hash::map::S2S const& properkeys() const { return pks; } void properkeys(std::string const& k, std::string const& v) { pks[k] = v; } - const mkn::kul::hash::map::S2S& envVars() const { return evs; } + mkn::kul::hash::map::S2S const& envVars() const { return evs; } std::string envVar(std::string const&& k) const { return (*evs.find(k)).second; } void envVar(std::string const& k, std::string const& v) { evs[k] = v; } @@ -184,7 +184,7 @@ class AppVars : public Constants { return ret; }; auto convert_to_std_map = - [](const mkn::kul::hash::map::S2S& s) -> std::unordered_map { + [](mkn::kul::hash::map::S2S const& s) -> std::unordered_map { std::unordered_map ret; for (auto const& p : s) ret.emplace(p.first, p.second); return ret; @@ -203,13 +203,13 @@ class AppVars : public Constants { ar(no); auto convert_to_kul_set = - [](const std::unordered_set& s) -> mkn::kul::hash::set::String { + [](std::unordered_set const& s) -> mkn::kul::hash::set::String { mkn::kul::hash::set::String ret; for (auto const& p : s) ret.insert(p); return ret; }; auto convert_to_kul_map = - [](const std::unordered_map& s) -> mkn::kul::hash::map::S2S { + [](std::unordered_map const& s) -> mkn::kul::hash::map::S2S { mkn::kul::hash::map::S2S ret; for (auto const& p : s) ret.insert(p.first, p.second); return ret; diff --git a/inc/maiken/project.hpp b/inc/maiken/project.hpp index b12411eb..c035666c 100644 --- a/inc/maiken/project.hpp +++ b/inc/maiken/project.hpp @@ -51,8 +51,8 @@ class Projects; class KUL_PUBLISH Project : public mkn::kul::yaml::File, public Constants { public: Project(mkn::kul::File const& f) : mkn::kul::yaml::File(f), m_dir(f.dir().real()) {} - Project(const Project& p) : mkn::kul::yaml::File(p), m_dir(p.m_dir.real()) {} - const mkn::kul::Dir& dir() const { return m_dir; } + Project(Project const& p) : mkn::kul::yaml::File(p), m_dir(p.m_dir.real()) {} + mkn::kul::Dir const& dir() const { return m_dir; } const mkn::kul::yaml::Validator validator() const; static mkn::kul::hash::map::S2S populate_tests(YAML::Node const& node); @@ -71,19 +71,19 @@ class Projects { static Projects p; return p; } - const Project* getOrCreate(const mkn::kul::Dir& d) { + Project const* getOrCreate(mkn::kul::Dir const& d) { if (!d) KEXCEPT(ProjectException, "Directory does not exist:\n" + d.path()); mkn::kul::File f("mkn.yaml", d); if (!f && mkn::kul::File("mkn.yml", d).is()) f = mkn::kul::File("mkn.yml", d); return getOrCreate(f); } - const Project* getOrCreate(mkn::kul::File const& f) { + Project const* getOrCreate(mkn::kul::File const& f) { if (!f.is()) KEXCEPT(ProjectException, "project file does not exist:\n" + f.full()); if (!m_projects.count(f.real())) { auto project = std::make_unique(f); try { mkn::kul::yaml::Item::VALIDATE(project->root(), project->validator().children()); - } catch (const mkn::kul::yaml::Exception& e) { + } catch (mkn::kul::yaml::Exception const& e) { KEXCEPT(ProjectException, "YAML error encountered in file: " + f.real()); } auto pp = project.get(); @@ -92,7 +92,7 @@ class Projects { } return m_projects[f.real()]; } - void reload(const Project& proj) { + void reload(Project const& proj) { if (!m_reloaded.count(proj.file())) { m_projects[proj.file()]->reload(); m_reloaded.insert(proj.file()); diff --git a/inc/maiken/property.hpp b/inc/maiken/property.hpp index f1056b04..4a235037 100644 --- a/inc/maiken/property.hpp +++ b/inc/maiken/property.hpp @@ -34,14 +34,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace maiken { class Properties : public Constants { private: - static std::shared_ptr> KEY(const mkn::kul::hash::map::S2S& ps, + static std::shared_ptr> KEY(mkn::kul::hash::map::S2S const& ps, std::string const& s) KTHROW(mkn::kul::Exception); public: static std::string RESOLVE(Application const& app, std::string const& s) KTHROW(mkn::kul::Exception); - static std::string RESOLVE(const Settings& app, std::string const& s) KTHROW(mkn::kul::Exception); + static std::string RESOLVE(Settings const& app, std::string const& s) KTHROW(mkn::kul::Exception); }; } // namespace maiken #endif //_MAIKEN_PROPERTY_HPP_ \ No newline at end of file diff --git a/inc/maiken/scm.hpp b/inc/maiken/scm.hpp index 339bf3b8..bbe1ccc0 100644 --- a/inc/maiken/scm.hpp +++ b/inc/maiken/scm.hpp @@ -42,13 +42,13 @@ class SCMGetter { static SCMGetter s; return s; } - static bool HAS(const mkn::kul::Dir& d); - static std::string REPO(const mkn::kul::Dir& d, std::string const& r, bool module); - static const mkn::kul::SCM* GET(const mkn::kul::Dir& d, std::string const& r, bool module); + static bool HAS(mkn::kul::Dir const& d); + static std::string REPO(mkn::kul::Dir const& d, std::string const& r, bool module); + static mkn::kul::SCM const* GET(mkn::kul::Dir const& d, std::string const& r, bool module); private: static bool IS_SOLID(std::string const& r); - static const mkn::kul::SCM* GET_SCM(const mkn::kul::Dir& d, std::string const& r, bool module); + static mkn::kul::SCM const* GET_SCM(mkn::kul::Dir const& d, std::string const& r, bool module); mkn::kul::hash::map::S2S valids; }; diff --git a/inc/maiken/settings.hpp b/inc/maiken/settings.hpp index d54420c4..8e863f0f 100644 --- a/inc/maiken/settings.hpp +++ b/inc/maiken/settings.hpp @@ -58,12 +58,12 @@ class Settings : public mkn::kul::yaml::File, public Constants { public: Settings(std::string const& s); - const Settings* super() const { return sup.get(); } + Settings const* super() const { return sup.get(); } const mkn::kul::yaml::Validator validator() const; std::vector const& remoteModules() const { return rms; } std::vector const& remoteRepos() const { return rrs; } - const mkn::kul::hash::map::S2S& properties() const { return ps; } + mkn::kul::hash::map::S2S const& properties() const { return ps; } static Settings& INSTANCE() KTHROW(mkn::kul::Exit); static bool SET(std::string const& s); diff --git a/mkn.cpp b/mkn.cpp index defa0b7b..3df5fbca 100644 --- a/mkn.cpp +++ b/mkn.cpp @@ -53,13 +53,13 @@ int main(int argc, char* argv[]) { } catch (mkn::kul::Exit const& e) { if (e.code() != 0) KERR << mkn::kul::os::EOL() << "ERROR: " << e.stack(); ret = e.code(); - } catch (const mkn::kul::proc::ExitException& e) { + } catch (mkn::kul::proc::ExitException const& e) { KERR << e; ret = e.code(); } catch (mkn::kul::Exception const& e) { KERR << e.stack(); ret = 1; - } catch (const std::exception& e) { + } catch (std::exception const& e) { KERR << e.what(); ret = 1; } diff --git a/mkn.yaml b/mkn.yaml index d6f8bb63..422c90af 100644 --- a/mkn.yaml +++ b/mkn.yaml @@ -4,7 +4,7 @@ name: mkn # scm: https://github.com/mkn/mkn version: master property: - DATE: 06-AUG-2023 + DATE: 19-NOV-2023 parent: bin mode: none diff --git a/server.cpp b/server.cpp index 23ee3f6a..a5b722a1 100644 --- a/server.cpp +++ b/server.cpp @@ -43,7 +43,7 @@ int main(int argc, char* argv[]) { Args args({}, {Arg('d', maiken::Constants::STR_DIR, ArgType::STRING)}); try { args.process(argc, argv); - } catch (const mkn::kul::cli::Exception& e) { + } catch (mkn::kul::cli::Exception const& e) { KEXIT(1, e.what()); } if (args.has(maiken::Constants::STR_DIR)) { @@ -62,12 +62,12 @@ int main(int argc, char* argv[]) { } catch (mkn::kul::Exit const& e) { if (e.code() != 0) KERR << mkn::kul::os::EOL() << "ERROR: " << e; exit_code = e.code(); - } catch (const mkn::kul::proc::ExitException& e) { + } catch (mkn::kul::proc::ExitException const& e) { exit_code = e.code(); } catch (mkn::kul::Exception const& e) { KERR << e.stack(); exit_code = 2; - } catch (const std::exception& e) { + } catch (std::exception const& e) { KERR << e.what(); exit_code = 3; } diff --git a/src/maiken.cpp b/src/maiken.cpp index aa8ae577..9e801e1c 100644 --- a/src/maiken.cpp +++ b/src/maiken.cpp @@ -109,13 +109,13 @@ void maiken::Application::populateMaps(YAML::Node const& n) KTHROW(mkn::kul::Exc try { if (n[STR_INC]) for (auto const& o : mkn::kul::String::LINES(n[STR_INC].Scalar())) addIncludeLine(o); - } catch (const mkn::kul::StringException&) { + } catch (mkn::kul::StringException const&) { KEXIT(1, "include contains invalid bool value\n" + project().dir().path()); } try { if (n[STR_SRC]) for (auto const& o : mkn::kul::String::LINES(n[STR_SRC].Scalar())) addSourceLine(o); - } catch (const mkn::kul::StringException&) { + } catch (mkn::kul::StringException const&) { KEXIT(1, "source contains invalid bool value\n" + project().dir().path()); } if (n[STR_PATH]) @@ -139,7 +139,7 @@ void maiken::Application::populateMaps(YAML::Node const& n) KTHROW(mkn::kul::Exc KEXIT(1, s + " is not a valid directory\n" + project().dir().path()); } -void maiken::Application::cyclicCheck(const std::vector>& apps) +void maiken::Application::cyclicCheck(std::vector> const& apps) const KTHROW(mkn::kul::Exception) { if (par) par->cyclicCheck(apps); for (auto const& pa : apps) { @@ -200,7 +200,7 @@ void maiken::Application::setSuper() { try { sup = Applications::INSTANCE().getOrCreate(*maiken::Projects::INSTANCE().getOrCreate(d), ""); sup->resolveProperties(); - } catch (const std::exception& e) { + } catch (std::exception const& e) { KLOG(ERR) << e.what(); KEXIT(1, "Possible super cycle detected: " + project().dir().real()); } diff --git a/src/maiken/build.cpp b/src/maiken/build.cpp index 03d4718a..816777c9 100644 --- a/src/maiken/build.cpp +++ b/src/maiken/build.cpp @@ -46,7 +46,7 @@ void maiken::Application::link(mkn::kul::hash::set::String const& objects) if (ts) ts.rm(); mkn::kul::io::Writer(ts) << mkn::kul::Now::MILLIS(); } - if (CommandStateMachine::INSTANCE().commands().count(STR_TEST) && !tests.empty()) + if (CommandStateMachine::INSTANCE().commands().count(STR_TEST) && tests.size() > 0) buildTest(objects); auto delEmpty = [](auto dir) { diff --git a/src/maiken/build/obj.cpp b/src/maiken/build/obj.cpp index 5ef42d24..072c53ba 100644 --- a/src/maiken/build/obj.cpp +++ b/src/maiken/build/obj.cpp @@ -91,7 +91,7 @@ void maiken::Application::compile(std::vector> posts; - auto compile_lambda = [](std::shared_ptr post, const dist::Host& host) { + auto compile_lambda = [](std::shared_ptr post, dist::Host const& host) { post->send(host); dist::FileWriter fw; dist::Blob b; @@ -197,7 +197,7 @@ void maiken::Application::compile(std::queue& map) { + mkn::kul::hash::map::S2T const& map) { mkn::kul::String::REPLACE_ALL(comp, ".exe", ""); if (map.count(comp) > 0) return comp; if (comp.find(" ") != std::string::npos) diff --git a/src/maiken/compiler/csc.cpp b/src/maiken/compiler/csc.cpp index fdf73159..07c15919 100644 --- a/src/maiken/compiler/csc.cpp +++ b/src/maiken/compiler/csc.cpp @@ -69,7 +69,7 @@ maiken::CompilerProcessCapture maiken::csharp::WINCompiler::buildExecutable(Link try { if (!dryRun) p.set(app.envVars()).start(); - } catch (const mkn::kul::proc::Exception& e) { + } catch (mkn::kul::proc::Exception const& e) { pc.exception(std::current_exception()); } pc.file(exe); @@ -101,7 +101,7 @@ maiken::CompilerProcessCapture maiken::csharp::WINCompiler::buildLibrary(LinkDAO for (std::string const& s : mkn::kul::String::SPLIT(linkerEnd, ' ')) p.arg(s); try { if (!dryRun) p.set(app.envVars()).start(); - } catch (const mkn::kul::proc::Exception& e) { + } catch (mkn::kul::proc::Exception const& e) { pc.exception(std::current_exception()); } pc.file(dll); diff --git a/src/maiken/compiler/gcc.cpp b/src/maiken/compiler/gcc.cpp index f9edc8f7..e6af1653 100644 --- a/src/maiken/compiler/gcc.cpp +++ b/src/maiken/compiler/gcc.cpp @@ -147,7 +147,7 @@ maiken::CompilerProcessCapture maiken::cpp::GccCompiler::buildExecutable(LinkDAO CompilerProcessCapture pc; try { if (!dryRun) p.set(app.envVars()).start(); - } catch (const mkn::kul::proc::Exception& e) { + } catch (mkn::kul::proc::Exception const& e) { pc.exception(std::current_exception()); } pc.file(out); @@ -174,7 +174,6 @@ maiken::CompilerProcessCapture maiken::cpp::GccCompiler::buildLibrary(LinkDAO& d std::string lib = out.dir().join(sharedLib(app, out.name())); - if (mode == compiler::Mode::STAT) lib = out.dir().join(staticLib(out.name())); mkn::kul::File out_file(lib); @@ -222,7 +221,7 @@ maiken::CompilerProcessCapture maiken::cpp::GccCompiler::buildLibrary(LinkDAO& d CompilerProcessCapture pc; try { if (!dryRun) p.set(app.envVars()).start(); - } catch (const mkn::kul::proc::Exception& e) { + } catch (mkn::kul::proc::Exception const& e) { pc.exception(std::current_exception()); } pc.file(lib); @@ -266,7 +265,7 @@ maiken::CompilerProcessCapture maiken::cpp::GccCompiler::compileSource(CompileDA if (!mkn::kul::LogMan::INSTANCE().inf()) pc.setProcess(p); try { if (!dryRun) p.set(app.envVars()).start(); - } catch (const mkn::kul::proc::Exception& e) { + } catch (mkn::kul::proc::Exception const& e) { pc.exception(std::current_exception()); } pc.file(out); diff --git a/src/maiken/compiler/win.cpp b/src/maiken/compiler/win.cpp index 243a6418..819a3a4e 100644 --- a/src/maiken/compiler/win.cpp +++ b/src/maiken/compiler/win.cpp @@ -116,7 +116,7 @@ maiken::CompilerProcessCapture maiken::cpp::WINCompiler::buildExecutable(LinkDAO CompilerProcessCapture pc; try { if (!dryRun) p.set(app.envVars()).start(); - } catch (const mkn::kul::proc::Exception& e) { + } catch (mkn::kul::proc::Exception const& e) { pc.exception(std::current_exception()); } pc.file(exe); @@ -174,7 +174,7 @@ maiken::CompilerProcessCapture maiken::cpp::WINCompiler::buildLibrary(LinkDAO& d CompilerProcessCapture pc; try { if (!dryRun) p.set(app.envVars()).start(); - } catch (const mkn::kul::proc::Exception& e) { + } catch (mkn::kul::proc::Exception const& e) { pc.exception(std::current_exception()); } pc.file(lib); diff --git a/src/maiken/create.cpp b/src/maiken/create.cpp index d481c55a..aaa16237 100644 --- a/src/maiken/create.cpp +++ b/src/maiken/create.cpp @@ -245,7 +245,7 @@ std::vector maiken::Application::CREATE(mkn::kul::cli::Arg AppVars::INSTANCE().nodes((std::numeric_limits::max)()); if (args.get(STR_NODES).size()) AppVars::INSTANCE().nodes(mkn::kul::String::UINT16(args.get(STR_NODES))); - } catch (const mkn::kul::StringException& e) { + } catch (mkn::kul::StringException const& e) { KEXIT(1, "-n argument is invalid"); } catch (mkn::kul::Exception const& e) { KEXIT(1, e.stack()); @@ -282,7 +282,7 @@ std::vector maiken::Application::CREATE(mkn::kul::cli::Arg } { auto splitArgs = [](std::string const& s, std::string const& t, - const std::function& f) { + std::function const& f) { for (auto const& p : mkn::kul::String::ESC_SPLIT(s, ',')) { if (p.find("=") == std::string::npos) KEXIT(1, t + " override invalid, = missing"); std::vector ps = mkn::kul::String::ESC_SPLIT(p, '='); @@ -356,6 +356,7 @@ std::vector maiken::Application::CREATE(mkn::kul::cli::Arg if (args.has(STR_ARG)) AppVars::INSTANCE().args(args.get(STR_ARG)); if (args.has(STR_RUN_ARG)) AppVars::INSTANCE().runArgs(args.get(STR_RUN_ARG)); + AppVars::INSTANCE().runArgs(AppVars::INSTANCE().runArgs() + " " + args.rest()); if (args.has(STR_LINKER)) AppVars::INSTANCE().linker(args.get(STR_LINKER)); if (args.has(STR_ALINKER)) AppVars::INSTANCE().allinker(args.get(STR_ALINKER)); if (args.has(STR_THREADS)) { @@ -363,7 +364,7 @@ std::vector maiken::Application::CREATE(mkn::kul::cli::Arg AppVars::INSTANCE().threads(mkn::kul::cpu::threads()); if (args.get(STR_THREADS).size()) AppVars::INSTANCE().threads(mkn::kul::String::UINT16(args.get(STR_THREADS))); - } catch (const mkn::kul::StringException& e) { + } catch (mkn::kul::StringException const& e) { KEXIT(1, "-t argument is invalid"); } catch (mkn::kul::Exception const& e) { KEXIT(1, e.stack()); @@ -373,7 +374,7 @@ std::vector maiken::Application::CREATE(mkn::kul::cli::Arg try { AppVars::INSTANCE().threads( mkn::kul::String::UINT16(mkn::kul::env::GET("MKN_COMPILE_THREADS"))); - } catch (const mkn::kul::StringException& e) { + } catch (mkn::kul::StringException const& e) { KEXIT(1, "MKN_COMPILE_THREADS is invalid"); } catch (mkn::kul::Exception const& e) { KEXIT(1, e.stack()); @@ -385,12 +386,12 @@ std::vector maiken::Application::CREATE(mkn::kul::cli::Arg for (YAML::const_iterator it = node.begin(); it != node.end(); ++it) for (auto const& s : mkn::kul::String::SPLIT(it->first.Scalar(), ':')) AppVars::INSTANCE().jargs(s, it->second.Scalar()); - } catch (const std::exception& e) { + } catch (std::exception const& e) { KEXIT(1, "JSON args failed to parse"); } } - auto printDeps = [&](const std::vector& vec) { + auto printDeps = [&](std::vector const& vec) { std::vector v; for (auto app = vec.rbegin(); app != vec.rend(); ++app) { std::string const& s((*app)->project().dir().real()); @@ -446,7 +447,7 @@ std::vector maiken::Application::CREATE(mkn::kul::cli::Arg size_t threads = (hosts.size() < AppVars::INSTANCE().nodes()) ? hosts.size() : AppVars::INSTANCE().nodes(); // ping nodes and set active - auto ping = [&](const maiken::dist::Host& host) { + auto ping = [&](maiken::dist::Host const& host) { auto post = std::make_unique( maiken::dist::RemoteCommandManager::INST().build_setup_query(*apps[0], args)); post->send(host); diff --git a/src/maiken/dep.cpp b/src/maiken/dep.cpp index e2625023..e5b87e81 100644 --- a/src/maiken/dep.cpp +++ b/src/maiken/dep.cpp @@ -89,7 +89,7 @@ void maiken::Application::buildDepVec(std::string const& depVal) { if (!depVal.empty()) { try { AppVars::INSTANCE().dependencyLevel(mkn::kul::String::UINT16(depVal)); - } catch (const mkn::kul::StringException& e) { + } catch (mkn::kul::StringException const& e) { AppVars::INSTANCE().dependencyLevel(0); parseDependencyString(depVal, include); } diff --git a/src/maiken/depmod.cpp b/src/maiken/depmod.cpp index af8bb532..15a6a49e 100644 --- a/src/maiken/depmod.cpp +++ b/src/maiken/depmod.cpp @@ -31,7 +31,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "maiken/github.hpp" #include "maiken/scm.hpp" -void maiken::Application::loadDepOrMod(YAML::Node const& node, const mkn::kul::Dir& depOrMod, +void maiken::Application::loadDepOrMod(YAML::Node const& node, mkn::kul::Dir const& depOrMod, bool module) KTHROW(mkn::kul::Exception) { KOUT(NON) << MKN_PROJECT_NOT_FOUND << depOrMod; #ifdef _MKN_DISABLE_SCM_ @@ -50,7 +50,7 @@ void maiken::Application::loadDepOrMod(YAML::Node const& node, const mkn::kul::D try { KOUT(NON) << SCMGetter::GET(depOrMod, tscr, module) ->co(depOrMod.path(), SCMGetter::REPO(depOrMod, tscr, module), v); - } catch (const mkn::kul::scm::Exception& e) { + } catch (mkn::kul::scm::Exception const& e) { if (node[STR_NAME]) { mkn::kul::File version(".mkn/dep/ver/" + node[STR_NAME].Scalar()); if (version) version.rm(); diff --git a/src/maiken/dist/messages.cpp b/src/maiken/dist/messages.cpp index 2574acd4..7cf19cb9 100644 --- a/src/maiken/dist/messages.cpp +++ b/src/maiken/dist/messages.cpp @@ -32,7 +32,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "maiken/dist.hpp" -void maiken::dist::SetupRequest::do_response_for(const mkn::kul::http::A1_1Request& req, +void maiken::dist::SetupRequest::do_response_for(mkn::kul::http::A1_1Request const& req, Sessions& sessions, mkn::kul::http::_1_1Response& resp) { if (!req.header("session")) KEXCEPTION("BAD 41"); // resp.withBody("FAILUIRE"); @@ -56,7 +56,7 @@ void maiken::dist::SetupRequest::do_response_for(const mkn::kul::http::A1_1Reque resp.withBody(std::string(out.c_str())); } -void maiken::dist::CompileRequest::do_response_for(const mkn::kul::http::A1_1Request& req, +void maiken::dist::CompileRequest::do_response_for(mkn::kul::http::A1_1Request const& req, Sessions& sessions, mkn::kul::http::_1_1Response& resp) { if (!req.header("session")) KEXCEPTION("BAD CompileRequest"); @@ -83,7 +83,7 @@ void maiken::dist::CompileRequest::do_response_for(const mkn::kul::http::A1_1Req resp.withBody(std::string(out.c_str())); } -void maiken::dist::LinkRequest::do_response_for(const mkn::kul::http::A1_1Request& req, +void maiken::dist::LinkRequest::do_response_for(mkn::kul::http::A1_1Request const& req, Sessions& sessions, mkn::kul::http::_1_1Response& resp) { if (!req.header("session")) KEXCEPTION("BAD LinkRequest"); @@ -119,7 +119,7 @@ void maiken::dist::LinkRequest::do_response_for(const mkn::kul::http::A1_1Reques resp.withBody(std::string(out.c_str())); } -void maiken::dist::DownloadRequest::do_response_for(const mkn::kul::http::A1_1Request& req, +void maiken::dist::DownloadRequest::do_response_for(mkn::kul::http::A1_1Request const& req, Sessions& sessions, mkn::kul::http::_1_1Response& resp) { if (!req.header("session")) KEXCEPTION("BAD DownloadRequest"); diff --git a/src/maiken/dist/post.cpp b/src/maiken/dist/post.cpp index a5baab97..5bc90f7e 100644 --- a/src/maiken/dist/post.cpp +++ b/src/maiken/dist/post.cpp @@ -46,7 +46,7 @@ void maiken::dist::Post::send(std::string const& host, std::string const& res, u .withBody(s1) .withHeaders(headers) .withResponse( - [&](const mkn::kul::http::_1_1Response& r) { this->_body = std::move(r.body()); }) + [&](mkn::kul::http::_1_1Response const& r) { this->_body = std::move(r.body()); }) .send(); } diff --git a/src/maiken/dist/rcm.cpp b/src/maiken/dist/rcm.cpp index 8e651175..0ea5db6c 100644 --- a/src/maiken/dist/rcm.cpp +++ b/src/maiken/dist/rcm.cpp @@ -65,7 +65,7 @@ std::unique_ptr maiken::dist::RemoteCommandManager:: std::unique_ptr maiken::dist::RemoteCommandManager::build_compile_request( std::string const& directory, - const std::vector>& src_objs) { + std::vector> const& src_objs) { return std::make_unique(directory, src_objs); } diff --git a/src/maiken/dist/server.cpp b/src/maiken/dist/server.cpp index a52d4918..39db7ff1 100644 --- a/src/maiken/dist/server.cpp +++ b/src/maiken/dist/server.cpp @@ -33,7 +33,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include "maiken/dist.hpp" -mkn::kul::http::_1_1Response maiken::dist::Server::respond(const mkn::kul::http::A1_1Request& req) { +mkn::kul::http::_1_1Response maiken::dist::Server::respond(mkn::kul::http::A1_1Request const& req) { mkn::kul::http::_1_1Response r; // check session exists - if not error if (!sessions.count(req.ip())) { @@ -54,7 +54,7 @@ void maiken::dist::Server::operator()() { try { start(); join(); - } catch (const std::runtime_error& e) { + } catch (std::runtime_error const& e) { KLOG(ERR) << e.what(); } catch (...) { KLOG(ERR) << "UNKNOWN ERROR"; diff --git a/src/maiken/mods.cpp b/src/maiken/mods.cpp index 9948def4..751b1944 100644 --- a/src/maiken/mods.cpp +++ b/src/maiken/mods.cpp @@ -32,7 +32,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "mkn/kul/bon.hpp" void maiken::Application::modArgs(std::string const mod_str, std::vector& mod_nodes, - std::function getIfMissing) { + std::function getIfMissing) { if (mod_str.size()) { mkn::kul::hash::set::String mods; std::stringstream ss; @@ -55,7 +55,7 @@ void maiken::Application::modArgs(std::string const mod_str, std::vector& mod_nodes, - std::function getIfMissing) { + std::function getIfMissing) { for (auto mod : mods) { mkn::kul::String::REPLACE_ALL(mod, mkn::kul::os::EOL(), ""); mkn::kul::String::TRIM(mod); diff --git a/src/maiken/pack.cpp b/src/maiken/pack.cpp index 1ec3dec0..dec7b05d 100644 --- a/src/maiken/pack.cpp +++ b/src/maiken/pack.cpp @@ -33,7 +33,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. class LibFinder { public: - static bool findAdd(std::string const& l, const mkn::kul::Dir& i, const mkn::kul::Dir& o) { + static bool findAdd(std::string const& l, mkn::kul::Dir const& i, mkn::kul::Dir const& o) { bool found = 0; for (auto const& f : i.files(0)) { auto const& fn(f.name()); diff --git a/src/maiken/scm.cpp b/src/maiken/scm.cpp index 93d97b6d..8388021c 100644 --- a/src/maiken/scm.cpp +++ b/src/maiken/scm.cpp @@ -96,7 +96,7 @@ void maiken::Application::scmUpdate(bool const& f) KTHROW(mkn::kul::scm::Excepti } } -void maiken::Application::scmUpdate(bool const& f, const mkn::kul::SCM* scm, std::string const& url) +void maiken::Application::scmUpdate(bool const& f, mkn::kul::SCM const* scm, std::string const& url) KTHROW(mkn::kul::scm::Exception) { std::string const& ver(!this->scv.empty() ? this->scv : this->project().root()[STR_VERSION] diff --git a/src/maiken/scm/getter.cpp b/src/maiken/scm/getter.cpp index 465ac12e..afdd7943 100644 --- a/src/maiken/scm/getter.cpp +++ b/src/maiken/scm/getter.cpp @@ -32,7 +32,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "maiken/scm.hpp" #include "maiken/settings.hpp" -const mkn::kul::SCM* maiken::SCMGetter::GET_SCM(mkn::kul::Dir const& d, std::string const& r, +mkn::kul::SCM const* maiken::SCMGetter::GET_SCM(mkn::kul::Dir const& d, std::string const& r, bool module) { std::vector repos; if (IS_SOLID(r)) @@ -65,7 +65,7 @@ const mkn::kul::SCM* maiken::SCMGetter::GET_SCM(mkn::kul::Dir const& d, std::str } KLOG(DBG) << gp.outs(); KLOG(DBG) << gp.errs(); - } catch (const mkn::kul::proc::ExitException& e) { + } catch (mkn::kul::proc::ExitException const& e) { KLOG(ERR) << e.stack(); } #endif //_MKN_DISABLE_GIT_ @@ -97,7 +97,7 @@ bool maiken::SCMGetter::IS_SOLID(std::string const& r) { return r.find("://") != std::string::npos || r.find("@") != std::string::npos; } -std::string maiken::SCMGetter::REPO(const mkn::kul::Dir& d, std::string const& r, bool module) { +std::string maiken::SCMGetter::REPO(mkn::kul::Dir const& d, std::string const& r, bool module) { if (INSTANCE().valids.count(d.path())) return INSTANCE().valids.at(d.path()); if (IS_SOLID(r)) INSTANCE().valids.insert(d.path(), r); @@ -106,10 +106,10 @@ std::string maiken::SCMGetter::REPO(const mkn::kul::Dir& d, std::string const& r if (INSTANCE().valids.count(d.path())) return INSTANCE().valids.at(d.path()); KEXCEPT(Exception, "SCM not discovered for project: " + d.path()); } -bool maiken::SCMGetter::HAS(const mkn::kul::Dir& d) { +bool maiken::SCMGetter::HAS(mkn::kul::Dir const& d) { return (mkn::kul::Dir(d.join(".git")) || mkn::kul::Dir(d.join(".svn"))); } -const mkn::kul::SCM* maiken::SCMGetter::GET(const mkn::kul::Dir& d, std::string const& r, +mkn::kul::SCM const* maiken::SCMGetter::GET(mkn::kul::Dir const& d, std::string const& r, bool module) { if (IS_SOLID(r)) INSTANCE().valids.insert(d.path(), r); if (mkn::kul::Dir(d.join(".git"))) return &mkn::kul::scm::Manager::INSTANCE().get("git"); diff --git a/src/maiken/setup.cpp b/src/maiken/setup.cpp index b7f5e5d5..3e586fd3 100644 --- a/src/maiken/setup.cpp +++ b/src/maiken/setup.cpp @@ -206,7 +206,7 @@ void maiken::Application::setup() KTHROW(mkn::kul::Exception) { } if (out.empty() && n[STR_OUT]) out = Properties::RESOLVE(*this, n[STR_OUT].Scalar()); if (!main_ && n[STR_MAIN]) addMainLine(n[STR_MAIN].Scalar()); - if (tests.empty() && n[STR_TEST]) tests = Project::populate_tests(n[STR_TEST]); + if (!tests.size() && n[STR_TEST]) tests = Project::populate_tests(n[STR_TEST]); if (lang.empty() && n[STR_LANG]) lang = n[STR_LANG].Scalar(); profile = n[STR_PARENT] ? Properties::RESOLVE(*this, n[STR_PARENT].Scalar()) : ""; c = !profile.empty(); diff --git a/src/maiken/threading/compile.cpp b/src/maiken/threading/compile.cpp index 2f6820f3..f82f9742 100644 --- a/src/maiken/threading/compile.cpp +++ b/src/maiken/threading/compile.cpp @@ -74,7 +74,7 @@ maiken::CompilerProcessCapture maiken::CompilationUnit::compile() const CompileDAO dao{app, compiler, in, out, args, incs, mode, dryRun}; return comp->compileSource(dao); - } catch (const std::exception& e) { + } catch (std::exception const& e) { std::rethrow_exception(std::current_exception()); } } diff --git a/src/maiken/timestamps.cpp b/src/maiken/timestamps.cpp index 8f525d95..54de00a4 100644 --- a/src/maiken/timestamps.cpp +++ b/src/maiken/timestamps.cpp @@ -81,7 +81,7 @@ void maiken::Application::loadTimeStamps() KTHROW(mkn::kul::StringException) { if (bits.size() != 2) KEXIT(1, "timestamp file invalid format\n" + src.full()); try { stss.insert(bits[0], mkn::kul::String::UINT64(bits[1])); - } catch (const mkn::kul::StringException& e) { + } catch (mkn::kul::StringException const& e) { KEXIT(1, "timestamp file invalid format\n" + src.full()); } } diff --git a/src/settings.cpp b/src/settings.cpp index 2ae77f77..c44b16f0 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -314,7 +314,7 @@ void maiken::Settings::POST_CONSTRUCT() { mkn::kul::env::SET(ev.name(), ev.toString().c_str()); } } else { - for (const auto& c : root[STR_ENV]) { + for (auto const& c : root[STR_ENV]) { auto ev = maiken::Settings::PARSE_ENV_NODE(c, settings); appVars.envVar(ev.name(), ev.toString()); mkn::kul::env::SET(ev.name(), ev.toString().c_str());