From 4fd0df2573341824eea5edfaf45be33997ce56ce Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 12 Feb 2016 16:34:29 +0200 Subject: / scheme cleanup --- bpkg/bpkg.cxx | 3 +-- bpkg/cfg-add | 2 ++ bpkg/cfg-add.cxx | 4 ---- bpkg/cfg-create | 2 ++ bpkg/cfg-create.cxx | 2 -- bpkg/cfg-fetch | 2 ++ bpkg/cfg-fetch.cxx | 3 --- bpkg/database | 9 +++++---- bpkg/database.cxx | 2 -- bpkg/diagnostics | 35 +++++++++++++---------------------- bpkg/diagnostics.cxx | 2 -- bpkg/fetch | 2 -- bpkg/help | 6 +++--- bpkg/help.cxx | 5 ----- bpkg/manifest-utility.cxx | 2 -- bpkg/package | 16 ++++++---------- bpkg/package.cxx | 2 -- bpkg/pkg-build | 2 ++ bpkg/pkg-build.cxx | 6 ------ bpkg/pkg-clean | 2 ++ bpkg/pkg-command | 2 +- bpkg/pkg-command.cxx | 2 -- bpkg/pkg-configure | 2 ++ bpkg/pkg-configure.cxx | 2 -- bpkg/pkg-disfigure | 2 ++ bpkg/pkg-disfigure.cxx | 2 -- bpkg/pkg-drop | 2 ++ bpkg/pkg-drop.cxx | 4 ---- bpkg/pkg-fetch | 2 ++ bpkg/pkg-fetch.cxx | 2 -- bpkg/pkg-install | 2 ++ bpkg/pkg-purge | 2 ++ bpkg/pkg-purge.cxx | 2 -- bpkg/pkg-status | 2 ++ bpkg/pkg-status.cxx | 3 --- bpkg/pkg-test | 2 ++ bpkg/pkg-uninstall | 2 ++ bpkg/pkg-unpack | 2 ++ bpkg/pkg-unpack.cxx | 2 -- bpkg/pkg-update | 2 ++ bpkg/pkg-verify | 2 ++ bpkg/pkg-verify.cxx | 2 -- bpkg/rep-create | 2 ++ bpkg/rep-create.cxx | 4 ---- bpkg/rep-info | 2 ++ bpkg/rep-info.cxx | 3 --- bpkg/satisfaction | 3 ++- bpkg/types | 41 ++++++++++++++++++++++++++++++++--------- bpkg/utility | 22 ++++++++++++++++++---- bpkg/utility.cxx | 5 +---- 50 files changed, 120 insertions(+), 118 deletions(-) (limited to 'bpkg') diff --git a/bpkg/bpkg.cxx b/bpkg/bpkg.cxx index 8d4d1fb..c94dde9 100644 --- a/bpkg/bpkg.cxx +++ b/bpkg/bpkg.cxx @@ -4,12 +4,11 @@ #include // strcmp() #include -#include #include #include -#include +#include #include #include diff --git a/bpkg/cfg-add b/bpkg/cfg-add index 5d0e3af..eec8859 100644 --- a/bpkg/cfg-add +++ b/bpkg/cfg-add @@ -6,6 +6,8 @@ #define BPKG_CFG_ADD #include +#include + #include namespace bpkg diff --git a/bpkg/cfg-add.cxx b/bpkg/cfg-add.cxx index 2a233a1..13a306e 100644 --- a/bpkg/cfg-add.cxx +++ b/bpkg/cfg-add.cxx @@ -4,12 +4,8 @@ #include -#include // invalid_argument - -#include #include #include -#include #include #include #include diff --git a/bpkg/cfg-create b/bpkg/cfg-create index 1d20757..1099b91 100644 --- a/bpkg/cfg-create +++ b/bpkg/cfg-create @@ -6,6 +6,8 @@ #define BPKG_CFG_CREATE #include +#include + #include namespace bpkg diff --git a/bpkg/cfg-create.cxx b/bpkg/cfg-create.cxx index 62b39d8..760c644 100644 --- a/bpkg/cfg-create.cxx +++ b/bpkg/cfg-create.cxx @@ -6,10 +6,8 @@ #include -#include #include #include -#include #include #include diff --git a/bpkg/cfg-fetch b/bpkg/cfg-fetch index 394fec7..57a4095 100644 --- a/bpkg/cfg-fetch +++ b/bpkg/cfg-fetch @@ -6,6 +6,8 @@ #define BPKG_CFG_FETCH #include +#include + #include namespace bpkg diff --git a/bpkg/cfg-fetch.cxx b/bpkg/cfg-fetch.cxx index d90ab93..f35d081 100644 --- a/bpkg/cfg-fetch.cxx +++ b/bpkg/cfg-fetch.cxx @@ -5,15 +5,12 @@ #include #include -#include #include #include -#include #include #include -#include #include #include diff --git a/bpkg/database b/bpkg/database index 0781bf9..b9b9943 100644 --- a/bpkg/database +++ b/bpkg/database @@ -5,7 +5,6 @@ #ifndef BPKG_DATABASE #define BPKG_DATABASE -#include // forward() #include // remove_reference #include @@ -15,6 +14,8 @@ #include #include +#include + #include namespace bpkg @@ -51,7 +52,7 @@ namespace bpkg R r_; public: - pointer_result_range (R&& r): r_ (std::forward (r)) {} + pointer_result_range (R&& r): r_ (forward (r)) {} using base_iterator = typename std::remove_reference::type::iterator; @@ -60,7 +61,7 @@ namespace bpkg iterator () = default; explicit - iterator (base_iterator i): base_iterator (std::move (i)) {} + iterator (base_iterator i): base_iterator (move (i)) {} typename base_iterator::pointer_type operator* () {return this->load ();} @@ -74,7 +75,7 @@ namespace bpkg inline pointer_result_range pointer_result (R&& r) { - return pointer_result_range (std::forward (r)); + return pointer_result_range (forward (r)); } } diff --git a/bpkg/database.cxx b/bpkg/database.cxx index a6168b0..54672d1 100644 --- a/bpkg/database.cxx +++ b/bpkg/database.cxx @@ -7,8 +7,6 @@ #include #include -#include -#include #include using namespace std; diff --git a/bpkg/diagnostics b/bpkg/diagnostics index e47a2fd..9a2118f 100644 --- a/bpkg/diagnostics +++ b/bpkg/diagnostics @@ -5,12 +5,7 @@ #ifndef BPKG_DIAGNOSTICS #define BPKG_DIAGNOSTICS -#include -#include -#include // forward() #include -#include -#include #include @@ -37,10 +32,10 @@ namespace bpkg // nameN arg arg ... nullptr nullptr // void - print_process (diag_record&, const char* const args[], std::size_t n = 0); + print_process (diag_record&, const char* const args[], size_t n = 0); void - print_process (const char* const args[], std::size_t n = 0); + print_process (const char* const args[], size_t n = 0); inline void print_process (diag_record& dr, const cstrings& args) @@ -77,7 +72,7 @@ namespace bpkg // Diagnostic facility, base infrastructure (potentially reusable). // - extern std::ostream* diag_stream; + extern ostream* diag_stream; template struct diag_prologue; template struct diag_mark; @@ -129,7 +124,7 @@ namespace bpkg @@ libstdc++ doesn't yet have the ostringstream move support. diag_record (diag_record&& r) - : os_ (std::move (r.os_)) + : os_ (move (r.os_)) { empty_ = r.empty_; r.empty_ = true; @@ -172,11 +167,11 @@ namespace bpkg template diag_prologue (A&&... a) - : B (std::forward (a)...), epilogue_ (nullptr) {} + : B (forward (a)...), epilogue_ (nullptr) {} template diag_prologue (diag_epilogue e, A&&... a) - : B (std::forward (a)...), epilogue_ (e) {} + : B (forward (a)...), epilogue_ (e) {} template diag_record @@ -207,7 +202,7 @@ namespace bpkg diag_mark (): B () {} template - diag_mark (A&&... a): B (std::forward (a)...) {} + diag_mark (A&&... a): B (forward (a)...) {} template diag_record @@ -244,12 +239,12 @@ namespace bpkg { public: location () {} - location (string f, std::uint64_t l, std::uint64_t c) - : file (std::move (f)), line (l), column (c) {} + location (string f, uint64_t l, uint64_t c) + : file (move (f)), line (l), column (c) {} string file; - std::uint64_t line; - std::uint64_t column; + uint64_t line; + uint64_t column; }; struct location_prologue_base @@ -303,9 +298,7 @@ namespace bpkg return location_prologue ( type_, name_, - location (std::forward (f), - std::forward (l), - std::forward (c))); + location (forward (f), forward (l), forward (c))); } protected: @@ -382,9 +375,7 @@ namespace bpkg &epilogue, "error", nullptr, - location (std::forward (f), - std::forward (l), - std::forward (c))); + location (forward (f), forward (l), forward (c))); } static void diff --git a/bpkg/diagnostics.cxx b/bpkg/diagnostics.cxx index e228a8b..41f08b4 100644 --- a/bpkg/diagnostics.cxx +++ b/bpkg/diagnostics.cxx @@ -9,8 +9,6 @@ #include -#include - using namespace std; namespace bpkg diff --git a/bpkg/fetch b/bpkg/fetch index 06c2d15..2867243 100644 --- a/bpkg/fetch +++ b/bpkg/fetch @@ -5,8 +5,6 @@ #ifndef BPKG_FETCH #define BPKG_FETCH -#include - #include #include diff --git a/bpkg/help b/bpkg/help index 1cad767..6026cc4 100644 --- a/bpkg/help +++ b/bpkg/help @@ -5,14 +5,14 @@ #ifndef BPKG_HELP #define BPKG_HELP -#include - #include +#include + #include namespace bpkg { - using usage_function = cli::usage_para (std::ostream&, cli::usage_para); + using usage_function = cli::usage_para (ostream&, cli::usage_para); int help (const help_options&, const string& topic, usage_function* usage); diff --git a/bpkg/help.cxx b/bpkg/help.cxx index 587a7c7..8713426 100644 --- a/bpkg/help.cxx +++ b/bpkg/help.cxx @@ -4,14 +4,9 @@ #include -#include - #include -#include -#include #include - #include using namespace std; diff --git a/bpkg/manifest-utility.cxx b/bpkg/manifest-utility.cxx index c819060..5aa90b9 100644 --- a/bpkg/manifest-utility.cxx +++ b/bpkg/manifest-utility.cxx @@ -4,8 +4,6 @@ #include -#include // invalid_argument - #include using namespace std; diff --git a/bpkg/package b/bpkg/package index ad465e9..d227929 100644 --- a/bpkg/package +++ b/bpkg/package @@ -7,10 +7,6 @@ #include #include -#include -#include // uint16 -#include -#include // pair #include #include @@ -257,7 +253,7 @@ namespace bpkg #pragma db member(dependency::constraint) column("") #pragma db value(dependency_alternatives) definition - using dependencies = std::vector; + using dependencies = vector; // available_package // @@ -294,7 +290,7 @@ namespace bpkg // with the thinking being that since the package is already in at // least fetched state, we shouldn't be needing its location. // - std::vector locations; //@@ Map? + vector locations; //@@ Map? // Package manifest data. // @@ -357,10 +353,10 @@ namespace bpkg // (barely comprehensible) view/query to achieve this, doing it on // the "client side" is definitely more straightforward. // - std::vector> + vector> filter (const shared_ptr&, odb::result&&); - std::pair, shared_ptr> + pair, shared_ptr> filter_one (const shared_ptr&, odb::result&&); // package_state @@ -379,8 +375,8 @@ namespace bpkg package_state to_package_state (const string&); // May throw invalid_argument. - inline std::ostream& - operator<< (std::ostream& os, package_state s) {return os << to_string (s);} + inline ostream& + operator<< (ostream& os, package_state s) {return os << to_string (s);} #pragma db map type(package_state) as(string) \ to(to_string (?)) \ diff --git a/bpkg/package.cxx b/bpkg/package.cxx index 4113c12..a72ab21 100644 --- a/bpkg/package.cxx +++ b/bpkg/package.cxx @@ -5,8 +5,6 @@ #include #include -#include // invalid_argument - #include using namespace std; diff --git a/bpkg/pkg-build b/bpkg/pkg-build index a9ac4d3..566b456 100644 --- a/bpkg/pkg-build +++ b/bpkg/pkg-build @@ -6,6 +6,8 @@ #define BPKG_PKG_BUILD #include +#include + #include namespace bpkg diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx index 9c3914c..6138317 100644 --- a/bpkg/pkg-build.cxx +++ b/bpkg/pkg-build.cxx @@ -7,17 +7,11 @@ #include #include #include -#include // make_move_iterator() #include // cout #include // find() -#include // reference_wrapper -#include // reverse_iterate() - -#include #include #include -#include #include #include #include diff --git a/bpkg/pkg-clean b/bpkg/pkg-clean index 73b21af..0bc5a60 100644 --- a/bpkg/pkg-clean +++ b/bpkg/pkg-clean @@ -6,6 +6,8 @@ #define BPKG_PKG_CLEAN #include +#include + #include #include diff --git a/bpkg/pkg-command b/bpkg/pkg-command index 334a97e..6790917 100644 --- a/bpkg/pkg-command +++ b/bpkg/pkg-command @@ -6,9 +6,9 @@ #define BPKG_PKG_COMMAND #include +#include // selected_package #include -#include // selected_package #include namespace bpkg diff --git a/bpkg/pkg-command.cxx b/bpkg/pkg-command.cxx index 356d578..088ad9c 100644 --- a/bpkg/pkg-command.cxx +++ b/bpkg/pkg-command.cxx @@ -4,10 +4,8 @@ #include -#include #include #include -#include #include #include diff --git a/bpkg/pkg-configure b/bpkg/pkg-configure index 775f036..9b044e2 100644 --- a/bpkg/pkg-configure +++ b/bpkg/pkg-configure @@ -7,6 +7,8 @@ #include #include // transaction, selected_package +#include + #include namespace bpkg diff --git a/bpkg/pkg-configure.cxx b/bpkg/pkg-configure.cxx index 8cccddf..8a4fd5f 100644 --- a/bpkg/pkg-configure.cxx +++ b/bpkg/pkg-configure.cxx @@ -4,10 +4,8 @@ #include -#include #include #include -#include #include #include #include diff --git a/bpkg/pkg-disfigure b/bpkg/pkg-disfigure index 239183d..f23bb87 100644 --- a/bpkg/pkg-disfigure +++ b/bpkg/pkg-disfigure @@ -7,6 +7,8 @@ #include #include // transaction, selected_package +#include + #include namespace bpkg diff --git a/bpkg/pkg-disfigure.cxx b/bpkg/pkg-disfigure.cxx index b16e837..5fa9990 100644 --- a/bpkg/pkg-disfigure.cxx +++ b/bpkg/pkg-disfigure.cxx @@ -4,10 +4,8 @@ #include -#include #include #include -#include #include #include diff --git a/bpkg/pkg-drop b/bpkg/pkg-drop index 851ffbc..ea19e11 100644 --- a/bpkg/pkg-drop +++ b/bpkg/pkg-drop @@ -6,6 +6,8 @@ #define BPKG_PKG_DROP #include +#include + #include namespace bpkg diff --git a/bpkg/pkg-drop.cxx b/bpkg/pkg-drop.cxx index 4331f3a..8c979d2 100644 --- a/bpkg/pkg-drop.cxx +++ b/bpkg/pkg-drop.cxx @@ -6,14 +6,10 @@ #include #include -#include #include // cout -#include // reference_wrapper -#include #include #include -#include #include #include #include diff --git a/bpkg/pkg-fetch b/bpkg/pkg-fetch index f35e1e8..bda8adf 100644 --- a/bpkg/pkg-fetch +++ b/bpkg/pkg-fetch @@ -9,6 +9,8 @@ #include #include // transaction, selected_package +#include + #include namespace bpkg diff --git a/bpkg/pkg-fetch.cxx b/bpkg/pkg-fetch.cxx index a57059d..f677deb 100644 --- a/bpkg/pkg-fetch.cxx +++ b/bpkg/pkg-fetch.cxx @@ -7,10 +7,8 @@ #include #include -#include #include #include -#include #include #include #include diff --git a/bpkg/pkg-install b/bpkg/pkg-install index b934324..aafa367 100644 --- a/bpkg/pkg-install +++ b/bpkg/pkg-install @@ -7,6 +7,8 @@ #include #include // selected_package +#include + #include #include diff --git a/bpkg/pkg-purge b/bpkg/pkg-purge index e2389ce..6172e49 100644 --- a/bpkg/pkg-purge +++ b/bpkg/pkg-purge @@ -7,6 +7,8 @@ #include #include // transaction, selected_package +#include + #include namespace bpkg diff --git a/bpkg/pkg-purge.cxx b/bpkg/pkg-purge.cxx index dcaf2cd..62bf982 100644 --- a/bpkg/pkg-purge.cxx +++ b/bpkg/pkg-purge.cxx @@ -4,10 +4,8 @@ #include -#include #include #include -#include #include #include diff --git a/bpkg/pkg-status b/bpkg/pkg-status index b585a13..b3eb637 100644 --- a/bpkg/pkg-status +++ b/bpkg/pkg-status @@ -6,6 +6,8 @@ #define BPKG_PKG_STATUS #include +#include + #include namespace bpkg diff --git a/bpkg/pkg-status.cxx b/bpkg/pkg-status.cxx index 041da8c..a792e0c 100644 --- a/bpkg/pkg-status.cxx +++ b/bpkg/pkg-status.cxx @@ -5,12 +5,9 @@ #include #include // cout -#include // function -#include #include #include -#include #include #include #include diff --git a/bpkg/pkg-test b/bpkg/pkg-test index cb42b14..252be03 100644 --- a/bpkg/pkg-test +++ b/bpkg/pkg-test @@ -6,6 +6,8 @@ #define BPKG_PKG_TEST #include +#include + #include #include diff --git a/bpkg/pkg-uninstall b/bpkg/pkg-uninstall index 77ed2f2..47b133d 100644 --- a/bpkg/pkg-uninstall +++ b/bpkg/pkg-uninstall @@ -7,6 +7,8 @@ #include #include // selected_package +#include + #include #include diff --git a/bpkg/pkg-unpack b/bpkg/pkg-unpack index 62eaac4..748ce9c 100644 --- a/bpkg/pkg-unpack +++ b/bpkg/pkg-unpack @@ -7,6 +7,8 @@ #include #include // transaction, selected_package +#include + #include namespace bpkg diff --git a/bpkg/pkg-unpack.cxx b/bpkg/pkg-unpack.cxx index caf5aa4..e3cc499 100644 --- a/bpkg/pkg-unpack.cxx +++ b/bpkg/pkg-unpack.cxx @@ -8,10 +8,8 @@ #include -#include #include #include -#include #include #include diff --git a/bpkg/pkg-update b/bpkg/pkg-update index 59dde37..5cc28eb 100644 --- a/bpkg/pkg-update +++ b/bpkg/pkg-update @@ -7,6 +7,8 @@ #include #include // selected_package +#include + #include #include diff --git a/bpkg/pkg-verify b/bpkg/pkg-verify index 3eccf66..2f21ea1 100644 --- a/bpkg/pkg-verify +++ b/bpkg/pkg-verify @@ -8,6 +8,8 @@ #include #include +#include + #include namespace bpkg diff --git a/bpkg/pkg-verify.cxx b/bpkg/pkg-verify.cxx index a76370d..96caf28 100644 --- a/bpkg/pkg-verify.cxx +++ b/bpkg/pkg-verify.cxx @@ -11,8 +11,6 @@ #include -#include -#include #include using namespace std; diff --git a/bpkg/rep-create b/bpkg/rep-create index 3863d92..b215e1f 100644 --- a/bpkg/rep-create +++ b/bpkg/rep-create @@ -6,6 +6,8 @@ #define BPKG_REP_CREATE #include +#include + #include namespace bpkg diff --git a/bpkg/rep-create.cxx b/bpkg/rep-create.cxx index cc2ade1..8c6d3df 100644 --- a/bpkg/rep-create.cxx +++ b/bpkg/rep-create.cxx @@ -7,16 +7,12 @@ #include #include #include -#include #include // dir_iterator #include #include -#include -#include - #include #include #include diff --git a/bpkg/rep-info b/bpkg/rep-info index 85ac234..62c5121 100644 --- a/bpkg/rep-info +++ b/bpkg/rep-info @@ -6,6 +6,8 @@ #define BPKG_REP_INFO #include +#include + #include namespace bpkg diff --git a/bpkg/rep-info.cxx b/bpkg/rep-info.cxx index 241f04b..d2157af 100644 --- a/bpkg/rep-info.cxx +++ b/bpkg/rep-info.cxx @@ -5,14 +5,11 @@ #include #include // cout -#include // invalid_argument #include #include #include -#include -#include #include #include diff --git a/bpkg/satisfaction b/bpkg/satisfaction index e4f3495..a140b5f 100644 --- a/bpkg/satisfaction +++ b/bpkg/satisfaction @@ -6,9 +6,10 @@ #define BPKG_SATISFACTION #include -#include #include +#include + namespace bpkg { // Return true if version satisfies the constraint. diff --git a/bpkg/types b/bpkg/types index b0db478..aa88701 100644 --- a/bpkg/types +++ b/bpkg/types @@ -7,11 +7,17 @@ #include #include -#include // shared_ptr, unique_ptr -#include // size_t -#include // uint{8,16,32,64}_t +#include // unique_ptr, shared_ptr +#include // pair +#include // size_t, nullptr_t +#include // uint{8,16,32,64}_t #include #include +#include // function, reference_wrapper + +#include // exception +#include // logic_error, invalid_argument, runtime_error +#include #include @@ -26,8 +32,18 @@ namespace bpkg using std::uint16_t; using std::uint32_t; using std::uint64_t; + using std::size_t; + using std::nullptr_t; + + using std::pair; using std::string; + using std::function; + using std::reference_wrapper; + + using std::unique_ptr; + using std::shared_ptr; + using std::weak_ptr; using std::vector; @@ -37,16 +53,21 @@ namespace bpkg using std::istream; using std::ostream; + // Exceptions. While is included, there is no using for + // std::exception -- use qualified. + // + using std::logic_error; + using std::invalid_argument; + using std::runtime_error; + using std::system_error; + + // + // using butl::optional; using butl::nullopt; - // Smart pointers + // ODB smart pointers. // - using std::unique_ptr; - - using std::shared_ptr; - using std::weak_ptr; - using odb::lazy_shared_ptr; using odb::lazy_weak_ptr; @@ -60,6 +81,8 @@ namespace bpkg using paths = std::vector; using dir_paths = std::vector; + // Custom path printing. + // inline ostream& operator<< (ostream& os, const path& p) {return os << p.string ();} diff --git a/bpkg/utility b/bpkg/utility index 9aa2dba..3b2a11f 100644 --- a/bpkg/utility +++ b/bpkg/utility @@ -5,9 +5,14 @@ #ifndef BPKG_UTILITY #define BPKG_UTILITY -#include // make_shared() -#include -#include // move() +#include // make_shared() +#include // to_string() +#include // move(), forward(), declval(), make_pair() +#include // assert() +#include // make_move_iterator() + +#include // reverse_iterate() + #include // uncaught_exception() #include @@ -17,8 +22,17 @@ namespace bpkg { using std::move; + using std::forward; + using std::declval; + + using std::make_pair; using std::make_shared; - using std::to_string; // To complement bpkg::to_string(). + using std::make_move_iterator; + using std::to_string; + + // + // + using butl::reverse_iterate; // Y/N prompt. The def argument, if specified, should be either 'y' // or 'no'. It is used as the default answer, in case the user just diff --git a/bpkg/utility.cxx b/bpkg/utility.cxx index 556bc88..f6cbc45 100644 --- a/bpkg/utility.cxx +++ b/bpkg/utility.cxx @@ -4,14 +4,11 @@ #include -#include // cout cin -#include +#include // cout, cin #include -#include #include - #include using namespace std; -- cgit v1.1