From cd4e709ead8a3e97eee0ef7b362240986e18fbd5 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 22 May 2015 15:43:41 +0200 Subject: Get rid of gcc, clang warnings (-Wall) --- build/algorithm.cxx | 4 +++- build/algorithm.ixx | 2 +- build/bin/rule.cxx | 4 ++-- build/cxx/rule.cxx | 6 +++--- build/diagnostics | 3 ++- build/file | 2 +- build/operation | 4 ++-- build/parser.cxx | 1 - build/prerequisite | 7 ++++--- build/variable | 2 +- 10 files changed, 19 insertions(+), 16 deletions(-) diff --git a/build/algorithm.cxx b/build/algorithm.cxx index be63f99..e52d7f5 100644 --- a/build/algorithm.cxx +++ b/build/algorithm.cxx @@ -258,8 +258,10 @@ namespace build // Should have been handled by inline execute(). assert (false); case target_state::failed: - throw failed (); + break; } + + throw failed (); } target_state diff --git a/build/algorithm.ixx b/build/algorithm.ixx index 23655a9..9435b2e 100644 --- a/build/algorithm.ixx +++ b/build/algorithm.ixx @@ -12,7 +12,7 @@ namespace build { if (p.target == nullptr) p.target = &search ( - prerequisite_key {&p.type, &p.dir, &p.name, &p.ext, &p.scope}); + prerequisite_key {{&p.type, &p.dir, &p.name, &p.ext}, &p.scope}); return *p.target; } diff --git a/build/bin/rule.cxx b/build/bin/rule.cxx index 172e5d8..06fe72e 100644 --- a/build/bin/rule.cxx +++ b/build/bin/rule.cxx @@ -63,7 +63,7 @@ namespace build { if (t.a == nullptr) t.a = &static_cast (search (prerequisite_key { - &liba::static_type, &t.dir, &t.name, &t.ext, nullptr})); + {&liba::static_type, &t.dir, &t.name, &t.ext}, nullptr})); build::match (a, *t.a); } @@ -72,7 +72,7 @@ namespace build { if (t.so == nullptr) t.so = &static_cast (search (prerequisite_key { - &libso::static_type, &t.dir, &t.name, &t.ext, nullptr})); + {&libso::static_type, &t.dir, &t.name, &t.ext}, nullptr})); build::match (a, *t.so); } diff --git a/build/cxx/rule.cxx b/build/cxx/rule.cxx index 1eb1398..63fc4a5 100644 --- a/build/cxx/rule.cxx +++ b/build/cxx/rule.cxx @@ -635,7 +635,7 @@ namespace build so ? objso::static_type : obja::static_type); pt = &search ( - prerequisite_key {&type, &p.dir, &p.name, &p.ext, &p.scope}); + prerequisite_key {{&type, &p.dir, &p.name, &p.ext}, &p.scope}); } } else if (lib* l = pt->is_a ()) @@ -675,7 +675,7 @@ namespace build lso ? libso::static_type : liba::static_type); pt = &search ( - prerequisite_key {&type, &p.dir, &p.name, &p.ext, &p.scope}); + prerequisite_key {{&type, &p.dir, &p.name, &p.ext}, &p.scope}); } } @@ -770,7 +770,7 @@ namespace build so ? objso::static_type : obja::static_type); ot = &search ( - prerequisite_key {&type, &o.dir, &o.name, &o.ext, nullptr}); + prerequisite_key {{&type, &o.dir, &o.name, &o.ext}, nullptr}); } } diff --git a/build/diagnostics b/build/diagnostics index a9e9305..05401b9 100644 --- a/build/diagnostics +++ b/build/diagnostics @@ -262,8 +262,9 @@ namespace build }; typedef diag_prologue simple_prologue; - struct location + class location { + public: location () {} location (const char* f, std::uint64_t l, std::uint64_t c) : file (f), line (l), column (c) {} diff --git a/build/file b/build/file index c02c985..7f72282 100644 --- a/build/file +++ b/build/file @@ -12,7 +12,7 @@ namespace build { class scope; - struct location; + class location; bool is_src_root (const dir_path&); diff --git a/build/operation b/build/operation index 45e054f..7492050 100644 --- a/build/operation +++ b/build/operation @@ -16,9 +16,9 @@ namespace build { - struct location; + class location; class scope; - struct target_key; + class target_key; // While we are using uint8_t for the meta/operation ids, we assume // that each is limited to 4 bits (max 128 entries) so that we can diff --git a/build/parser.cxx b/build/parser.cxx index 97e8733..c8bc241 100644 --- a/build/parser.cxx +++ b/build/parser.cxx @@ -693,7 +693,6 @@ namespace build // The rest is a value. Parse it as names to get variable expansion. // - const location l (get_location (t, &path_)); export_value_ = (tt != type::newline && tt != type::eos ? names (t, tt) : names_type ()); diff --git a/build/prerequisite b/build/prerequisite index e65921e..ba850ec 100644 --- a/build/prerequisite +++ b/build/prerequisite @@ -80,14 +80,15 @@ namespace build inline bool operator< (const prerequisite& x, const prerequisite& y) { - return prerequisite_key {&x.type, &x.dir, &x.name, &x.ext, &x.scope} < - prerequisite_key {&y.type, &y.dir, &y.name, &y.ext, &y.scope}; + return prerequisite_key {{&x.type, &x.dir, &x.name, &x.ext}, &x.scope} < + prerequisite_key {{&y.type, &y.dir, &y.name, &y.ext}, &y.scope}; } inline std::ostream& operator<< (std::ostream& os, const prerequisite& p) { - return os << prerequisite_key {&p.type, &p.dir, &p.name, &p.ext, &p.scope}; + return os << + prerequisite_key {{&p.type, &p.dir, &p.name, &p.ext}, &p.scope}; } // Set of prerequisites in a scope. diff --git a/build/variable b/build/variable index 0972f3c..0cd411d 100644 --- a/build/variable +++ b/build/variable @@ -64,7 +64,7 @@ namespace build ~value () = default; }; - struct list_value: value, names + class list_value: public value, public names { public: using names::names; -- cgit v1.1