From: Jürg Billeter Date: Fri, 14 Nov 2008 20:14:46 +0000 (+0000) Subject: Avoid C compiler warnings with switch statements X-Git-Tag: VALA_0_5_2~91 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1bc16004dad8bfd9e6ae5f0d7437f1bd7e61187;p=thirdparty%2Fvala.git Avoid C compiler warnings with switch statements 2008-11-14 Jürg Billeter * vala/valagenieparser.vala: * vala/valaparser.vala: Avoid C compiler warnings with switch statements svn path=/trunk/; revision=2020 --- diff --git a/ChangeLog b/ChangeLog index db6f1b242..5e2637dfb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-11-14 Jürg Billeter + + * vala/valagenieparser.vala: + * vala/valaparser.vala: + + Avoid C compiler warnings with switch statements + 2008-11-14 Jürg Billeter * gobject/valadbusclientmodule.vala: diff --git a/vala/valagenieparser.vala b/vala/valagenieparser.vala index 436cb0980..fc4e67ee6 100644 --- a/vala/valagenieparser.vala +++ b/vala/valagenieparser.vala @@ -291,9 +291,9 @@ public class Vala.Genie.Parser : CodeVisitor { case TokenType.WHILE: next (); return; + default: + throw new ParseError.SYNTAX (get_error ("expected identifier")); } - - throw new ParseError.SYNTAX (get_error ("expected identifier")); } string parse_identifier () throws ParseError { @@ -326,9 +326,9 @@ public class Vala.Genie.Parser : CodeVisitor { case TokenType.NULL: next (); return new NullLiteral (get_src (begin)); + default: + throw new ParseError.SYNTAX (get_error ("expected literal")); } - - throw new ParseError.SYNTAX (get_error ("expected literal")); } public void parse_file (SourceFile source_file) { @@ -1091,9 +1091,13 @@ public class Vala.Genie.Parser : CodeVisitor { } var inner = parse_unary_expression (); return new CastExpression (inner, type, get_src (begin), false); + default: + break; } } break; + default: + break; } // no cast expression rollback (begin); @@ -1106,6 +1110,8 @@ public class Vala.Genie.Parser : CodeVisitor { next (); var op = parse_unary_expression (); return new AddressofExpression (op, get_src (begin)); + default: + break; } var expr = parse_primary_expression (); @@ -1631,10 +1637,10 @@ public class Vala.Genie.Parser : CodeVisitor { case TokenType.OP_PTR: rollback (begin); return true; + default: + rollback (begin); + return false; } - - rollback (begin); - return false; } Block parse_embedded_statement () throws ParseError { diff --git a/vala/valaparser.vala b/vala/valaparser.vala index eed1316e7..28b1b2239 100644 --- a/vala/valaparser.vala +++ b/vala/valaparser.vala @@ -236,9 +236,9 @@ public class Vala.Parser : CodeVisitor { case TokenType.YIELDS: next (); return; + default: + throw new ParseError.SYNTAX (get_error ("expected identifier")); } - - throw new ParseError.SYNTAX (get_error ("expected identifier")); } string parse_identifier () throws ParseError { @@ -281,9 +281,9 @@ public class Vala.Parser : CodeVisitor { case TokenType.NULL: next (); return new NullLiteral (get_src (begin)); + default: + throw new ParseError.SYNTAX (get_error ("expected literal")); } - - throw new ParseError.SYNTAX (get_error ("expected literal")); } public void parse_file (SourceFile source_file) { @@ -821,9 +821,13 @@ public class Vala.Parser : CodeVisitor { } var inner = parse_unary_expression (); return new CastExpression (inner, type, get_src (begin), false); + default: + break; } } break; + default: + break; } // no cast expression rollback (begin); @@ -836,6 +840,8 @@ public class Vala.Parser : CodeVisitor { next (); var op = parse_unary_expression (); return new AddressofExpression (op, get_src (begin)); + default: + break; } var expr = parse_primary_expression (); @@ -1293,10 +1299,10 @@ public class Vala.Parser : CodeVisitor { case TokenType.OP_PTR: rollback (begin); return true; + default: + rollback (begin); + return false; } - - rollback (begin); - return false; } Block parse_embedded_statement () throws ParseError { @@ -1737,6 +1743,7 @@ public class Vala.Parser : CodeVisitor { case TokenType.INTERFACE: return parse_interface_declaration (attrs); case TokenType.NAMESPACE: return parse_namespace_declaration (attrs); case TokenType.STRUCT: return parse_struct_declaration (attrs); + default: break; } break; case TokenType.OPEN_PARENS: @@ -1762,6 +1769,8 @@ public class Vala.Parser : CodeVisitor { case TokenType.OPEN_BRACE: rollback (begin); return parse_property_declaration (attrs); + default: + break; } break; }