]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Fixing uninitialized warnings in parser.c
authorWolfgang Bumiller <blub@speed.at>
Wed, 26 Dec 2012 19:00:17 +0000 (20:00 +0100)
committerWolfgang Bumiller <blub@speed.at>
Wed, 26 Dec 2012 19:00:17 +0000 (20:00 +0100)
parser.c

index 4058a8f99b042c349cfa54fa3aa89717121a2fb3..a11c70955878c248adbef9c0bd7b48307abaafd2 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -2512,11 +2512,6 @@ static bool parse_switch(parser_t *parser, ast_block *block, ast_expression **ou
     while (parser->tok != '}') {
         ast_block *caseblock;
 
     while (parser->tok != '}') {
         ast_block *caseblock;
 
-        if (parser->tok != TOKEN_KEYWORD) {
-            ast_delete(switchnode);
-            parseerror(parser, "expected 'case' or 'default'");
-            return false;
-        }
         if (!strcmp(parser_tokval(parser), "case")) {
             if (!parser_next(parser)) {
                 ast_delete(switchnode);
         if (!strcmp(parser_tokval(parser), "case")) {
             if (!parser_next(parser)) {
                 ast_delete(switchnode);
@@ -2545,6 +2540,11 @@ static bool parse_switch(parser_t *parser, ast_block *block, ast_expression **ou
                 return false;
             }
         }
                 return false;
             }
         }
+        else {
+            ast_delete(switchnode);
+            parseerror(parser, "expected 'case' or 'default'");
+            return false;
+        }
 
         /* Now the colon and body */
         if (parser->tok != ':') {
 
         /* Now the colon and body */
         if (parser->tok != ':') {