From 3e25ac406d1984b1a3efd2d4da8033dc908c3fa0 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 28 Sep 2010 19:37:48 +0200 Subject: Get rid of compiler warnings --- odb/mysql/common.cxx | 23 ++++++++++++++--------- odb/mysql/common.hxx | 6 +++--- odb/mysql/context.cxx | 5 +++++ odb/mysql/header.cxx | 12 ++++++------ odb/mysql/source.cxx | 36 ++++++++++++++++++------------------ odb/parser.cxx | 46 +++++++++++++++++++++++++++++++++++++++++----- odb/sql-lexer.cxx | 3 +-- odb/validator.cxx | 2 +- 8 files changed, 89 insertions(+), 44 deletions(-) diff --git a/odb/mysql/common.cxx b/odb/mysql/common.cxx index 5253ed2..284a80e 100644 --- a/odb/mysql/common.cxx +++ b/odb/mysql/common.cxx @@ -12,7 +12,7 @@ namespace mysql void member_base:: traverse (type& m) { - if (m.count ("transient") || id_ && !m.count ("id")) + if (m.count ("transient") || (id_ && !m.count ("id"))) return; if (id_) @@ -124,6 +124,11 @@ namespace mysql traverse_set (m, t); break; } + case sql_type::invalid: + { + assert (false); + break; + } } post (m); @@ -292,50 +297,50 @@ namespace mysql } void member_database_type:: - traverse_integer (type& m, sql_type const& t) + traverse_integer (type&, sql_type const& t) { size_t i ((t.type - sql_type::TINYINT) * 2 + (t.unsign ? 1 : 0)); type_ = string ("mysql::") + integer_database_id[i]; } void member_database_type:: - traverse_float (type& m, sql_type const& t) + traverse_float (type&, sql_type const& t) { type_ = string ("mysql::") + float_database_id[t.type - sql_type::FLOAT]; } void member_database_type:: - traverse_decimal (type& m, sql_type const& t) + traverse_decimal (type&, sql_type const&) { type_ = "mysql::id_decimal"; } void member_database_type:: - traverse_date_time (type& m, sql_type const& t) + traverse_date_time (type&, sql_type const& t) { type_ = string ("mysql::") + date_time_database_id[t.type - sql_type::DATE]; } void member_database_type:: - traverse_string (type& m, sql_type const& t) + traverse_string (type&, sql_type const& t) { type_ = string ("mysql::") + char_bin_database_id[t.type - sql_type::CHAR]; } void member_database_type:: - traverse_bit (type& m, sql_type const& t) + traverse_bit (type&, sql_type const&) { type_ = "mysql::id_bit"; } void member_database_type:: - traverse_enum (type& m, sql_type const&) + traverse_enum (type&, sql_type const&) { type_ = "mysql::id_enum"; } void member_database_type:: - traverse_set (type& m, sql_type const&) + traverse_set (type&, sql_type const&) { type_ = "mysql::id_set"; } diff --git a/odb/mysql/common.hxx b/odb/mysql/common.hxx index 5016843..c689bb6 100644 --- a/odb/mysql/common.hxx +++ b/odb/mysql/common.hxx @@ -172,19 +172,19 @@ namespace mysql } virtual void - traverse_decimal (type&, sql_type const& t) + traverse_decimal (type&, sql_type const&) { r_ = true; } virtual void - traverse_long_string (type&, sql_type const& t) + traverse_long_string (type&, sql_type const&) { r_ = true; } virtual void - traverse_short_string (type&, sql_type const& t) + traverse_short_string (type&, sql_type const&) { r_ = true; // @@ Short string optimization disabled. } diff --git a/odb/mysql/context.cxx b/odb/mysql/context.cxx index 7f69bb2..7665ed6 100644 --- a/odb/mysql/context.cxx +++ b/odb/mysql/context.cxx @@ -438,6 +438,11 @@ namespace mysql s = parse_done; break; } + case parse_done: + { + assert (false); + break; + } } } diff --git a/odb/mysql/header.cxx b/odb/mysql/header.cxx index 97df10c..b22efbb 100644 --- a/odb/mysql/header.cxx +++ b/odb/mysql/header.cxx @@ -28,7 +28,7 @@ namespace mysql } virtual void - traverse_integer (type&, sql_type const& t) + traverse_integer (type&, sql_type const&) { os << image_type << " " << var << "value;" << "my_bool " << var << "null;" @@ -36,7 +36,7 @@ namespace mysql } virtual void - traverse_float (type&, sql_type const& t) + traverse_float (type&, sql_type const&) { os << image_type << " " << var << "value;" << "my_bool " << var << "null;" @@ -44,7 +44,7 @@ namespace mysql } virtual void - traverse_decimal (type&, sql_type const& t) + traverse_decimal (type&, sql_type const&) { // Exchanged as strings. Can have up to 65 digits not counting // '-' and '.'. If range is not specified, the default is 10. @@ -63,7 +63,7 @@ namespace mysql } virtual void - traverse_date_time (type&, sql_type const& t) + traverse_date_time (type&, sql_type const&) { os << image_type << " " << var << "value;" << "my_bool " << var << "null;" @@ -72,7 +72,7 @@ namespace mysql } virtual void - traverse_short_string (type&, sql_type const& t) + traverse_short_string (type&, sql_type const&) { // If range is not specified, the default buffer size is 255. // @@ -89,7 +89,7 @@ namespace mysql } virtual void - traverse_long_string (type&, sql_type const& t) + traverse_long_string (type&, sql_type const&) { os << image_type << " " << var << "value;" << "unsigned long " << var << "size;" diff --git a/odb/mysql/source.cxx b/odb/mysql/source.cxx index 92933e3..e2cf0e8 100644 --- a/odb/mysql/source.cxx +++ b/odb/mysql/source.cxx @@ -133,7 +133,7 @@ namespace mysql } virtual void - traverse_decimal (type&, sql_type const& t) + traverse_decimal (type&, sql_type const&) { os << b << ".buffer_type = MYSQL_TYPE_NEWDECIMAL;" << b << ".buffer = i." << var << "value.data ();" @@ -190,7 +190,7 @@ namespace mysql } virtual void - traverse_bit (type&, sql_type const& t) + traverse_bit (type&, sql_type const&) { // Treated as a BLOB. // @@ -261,21 +261,21 @@ namespace mysql } virtual void - traverse_integer (type&, sql_type const& t) + traverse_integer (type&, sql_type const&) { os << e << " = 0;" << endl; } virtual void - traverse_float (type&, sql_type const& t) + traverse_float (type&, sql_type const&) { os << e << " = 0;" << endl; } virtual void - traverse_decimal (type&, sql_type const& t) + traverse_decimal (type&, sql_type const&) { // @@ Optimization disabled. // @@ -287,14 +287,14 @@ namespace mysql } virtual void - traverse_date_time (type&, sql_type const& t) + traverse_date_time (type&, sql_type const&) { os << e << " = 0;" << endl; } virtual void - traverse_short_string (type&, sql_type const& t) + traverse_short_string (type&, sql_type const&) { // @@ Optimization disabled. // @@ -306,7 +306,7 @@ namespace mysql } virtual void - traverse_long_string (type&, sql_type const& t) + traverse_long_string (type&, sql_type const&) { os << "if (" << e << ")" << endl << "{" @@ -316,7 +316,7 @@ namespace mysql } virtual void - traverse_bit (type&, sql_type const& t) + traverse_bit (type&, sql_type const&) { os << e << " = 0;" << endl; @@ -387,7 +387,7 @@ namespace mysql } virtual void - traverse_integer (type& m, sql_type const&) + traverse_integer (type&, sql_type const&) { os << traits << "::set_image (" << endl << "i." << var << "value, is_null, " << member << ");" @@ -396,7 +396,7 @@ namespace mysql } virtual void - traverse_float (type& m, sql_type const&) + traverse_float (type&, sql_type const&) { os << traits << "::set_image (" << endl << "i." << var << "value, is_null, " << member << ");" @@ -405,7 +405,7 @@ namespace mysql } virtual void - traverse_decimal (type& m, sql_type const&) + traverse_decimal (type&, sql_type const&) { // @@ Optimization: can remove growth check if buffer is fixed. // @@ -424,7 +424,7 @@ namespace mysql } virtual void - traverse_date_time (type& m, sql_type const&) + traverse_date_time (type&, sql_type const&) { os << traits << "::set_image (" << endl << "i." << var << "value, is_null, " << member << ");" @@ -433,7 +433,7 @@ namespace mysql } virtual void - traverse_short_string (type& m, sql_type const&) + traverse_short_string (type&, sql_type const&) { // @@ Optimization: can remove growth check if buffer is fixed. // @@ -452,7 +452,7 @@ namespace mysql } virtual void - traverse_long_string (type& m, sql_type const&) + traverse_long_string (type&, sql_type const&) { os << "{" << "std::size_t size;" @@ -469,7 +469,7 @@ namespace mysql } virtual void - traverse_bit (type& m, sql_type const&) + traverse_bit (type&, sql_type const&) { // Represented as a BLOB. // @@ -487,7 +487,7 @@ namespace mysql } virtual void - traverse_enum (type& m, sql_type const&) + traverse_enum (type&, sql_type const&) { // Represented as a string. // @@ -506,7 +506,7 @@ namespace mysql } virtual void - traverse_set (type& m, sql_type const&) + traverse_set (type&, sql_type const&) { // Represented as a string. // diff --git a/odb/parser.cxx b/odb/parser.cxx index d48d2a3..63fd342 100644 --- a/odb/parser.cxx +++ b/odb/parser.cxx @@ -260,8 +260,6 @@ emit_class (tree c, path const& file, size_t line, size_t clmn, bool stub) bool virt (BINFO_VIRTUAL_P (bi)); tree base (TYPE_MAIN_VARIANT (BINFO_TYPE (bi))); - tree base_decl (TYPE_NAME (base)); // Typedef decl for this base. - // Find the corresponding graph node. If we cannot find one then // the base is a template instantiation since an ordinary class // has to be defined (complete) in order to be a base. @@ -318,6 +316,10 @@ emit_class (tree c, path const& file, size_t line, size_t clmn, bool stub) decls.insert (d); break; } + default: + { + break; + } } } @@ -433,6 +435,10 @@ emit_class (tree c, path const& file, size_t line, size_t clmn, bool stub) break; } + default: + { + break; + } } } @@ -494,6 +500,10 @@ emit_union (tree u, path const& file, size_t line, size_t clmn, bool stub) decls.insert (d); break; } + default: + { + break; + } } } @@ -578,6 +588,10 @@ emit_union (tree u, path const& file, size_t line, size_t clmn, bool stub) break; } + default: + { + break; + } } } @@ -684,6 +698,10 @@ collect (tree ns) decls_.insert (decl); break; } + default: + { + break; + } } } @@ -789,6 +807,10 @@ emit () emit_template_decl (decl); break; } + default: + { + break; + } } } @@ -1048,6 +1070,10 @@ emit_class_template (tree t, bool stub) decls.insert (d); break; } + default: + { + break; + } } } @@ -1071,6 +1097,10 @@ emit_class_template (tree t, bool stub) emit_template_decl (d); break; } + default: + { + break; + } } } @@ -1124,6 +1154,10 @@ emit_union_template (tree t, bool stub) decls.insert (d); break; } + default: + { + break; + } } } @@ -1147,6 +1181,10 @@ emit_union_template (tree t, bool stub) emit_template_decl (d); break; } + default: + { + break; + } } } @@ -1601,8 +1639,6 @@ emit_type_name (tree type, bool direct) tree args (INNERMOST_TEMPLATE_ARGS (TI_ARGS (ti))); - int n (TREE_VEC_LENGTH (args)); - for (size_t i (0), n (TREE_VEC_LENGTH (args)); i < n ; ++i) { tree a (TREE_VEC_ELT (args, i)); @@ -1727,7 +1763,7 @@ process_pragmas (tree t, string const& name, decl_set::const_iterator begin, decl_set::const_iterator cur, - decl_set::const_iterator end) + decl_set::const_iterator /*end*/) { // First process the position pragmas by iterating backwards // until we get to the preceding non-pragma declaration. diff --git a/odb/sql-lexer.cxx b/odb/sql-lexer.cxx index fc9a237..68e9943 100644 --- a/odb/sql-lexer.cxx +++ b/odb/sql-lexer.cxx @@ -171,7 +171,6 @@ skip_spaces () sql_token sql_lexer:: identifier (xchar c) { - size_t ln (c.line ()), cl (c.column ()); string lexeme; lexeme += c; @@ -187,7 +186,7 @@ identifier (xchar c) } sql_token sql_lexer:: -int_literal (xchar c, bool neg, size_t ml, size_t mc) +int_literal (xchar c, bool neg, size_t /*ml*/, size_t /*mc*/) { //size_t ln (neg ? ml : c.line ()), cl (neg ? mc : c.column ()); string lexeme; diff --git a/odb/validator.cxx b/odb/validator.cxx index 11cbea5..9f733a1 100644 --- a/odb/validator.cxx +++ b/odb/validator.cxx @@ -29,7 +29,7 @@ namespace semantics::type& type (m.type ()); semantics::belongs& b (m.belongs ()); - if (type.fq_anonymous (m.belongs ().hint ())) + if (type.fq_anonymous (b.hint ())) { // Can be a template-id (which we should handle eventually) or an // anonymous type in member declaration (e.g., struct {...} m_;). -- cgit v1.1