]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Cleanup
authorDale Weiler <killfieldengine@gmail.com>
Fri, 31 May 2013 03:52:44 +0000 (03:52 +0000)
committerDale Weiler <killfieldengine@gmail.com>
Fri, 31 May 2013 03:52:44 +0000 (03:52 +0000)
diag.c
gmqcc.h
parser.c

diff --git a/diag.c b/diag.c
index b583e4f314fda857dd4ca47f2bc58abe6443bcaf..13d276fdeb72d1bc89af12e4e7739c7df9c4dc71 100644 (file)
--- a/diag.c
+++ b/diag.c
@@ -157,9 +157,6 @@ static void diagnostic_feed(const char *file, size_t line, size_t beg, size_t en
     
     switch (diagnostic) {
         case DIAGNOSTIC_SEMICOLON:
-            break;
-            
-        case DIAGNOSTIC_SEMICOLON_SAME:
             for (; len < vec_size(vec_last(read)->values); len++)
                 space += strlen(vec_last(read)->values[len]);
                 
@@ -167,7 +164,7 @@ static void diagnostic_feed(const char *file, size_t line, size_t beg, size_t en
             space -= beg - end;
             break;
             
-        case DIAGNOSTIC_ASSIGNMENT:
+        default:
             break;
     }
 
@@ -226,19 +223,6 @@ void diagnostic_calculate(const char *file, size_t line, size_t diagnostic) {
             linebeg++;
             marker = true;
             break;
-        
-        case DIAGNOSTIC_SEMICOLON_SAME:
-            linecnt = 1;
-            linebeg = line-2;
-            marker  = true;
-            break;
-        
-        /* 
-         * Cases that don't need line calculation should break the
-         * statement and carry on to the feeder.
-         */
-        case DIAGNOSTIC_ASSIGNMENT:
-            break;
 
         /* Catches the DIAGNOSTIC_NULL and out of range case */
         default:
diff --git a/gmqcc.h b/gmqcc.h
index 87d656fa095b0978ae243a0560cf801d698755e5..1beaf4d2c56ea2f6b7756662994f7f048f4dd5fe 100644 (file)
--- a/gmqcc.h
+++ b/gmqcc.h
@@ -1029,9 +1029,7 @@ void            ftepp_add_macro        (struct ftepp_s *ftepp, const char *name,
 /*===================================================================*/
 enum {
     DIAGNOSTIC_NULL,
-    DIAGNOSTIC_SEMICOLON,      /* Where semicolon requires from next line */
-    DIAGNOSTIC_SEMICOLON_SAME, /* Where semicolon required from same line */
-    DIAGNOSTIC_ASSIGNMENT
+    DIAGNOSTIC_SEMICOLON
 };
 
 void diagnostic_destroy();
index 7a9e5c93b6bc1d460b55afd023a2c6eec9f8c3d2..907f6a658e9987883ea9f734c8bf286fa3c6d6c6 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -1246,12 +1246,10 @@ static bool parser_sy_apply_operator(parser_t *parser, shunt *sy)
                         field->next->vtype == TYPE_FUNCTION &&
                         exprs[1]->vtype == TYPE_FUNCTION)
                     {
-                        parser->diagnostic = DIAGNOSTIC_ASSIGNMENT;
                         (void)!compile_warning(ctx, WARN_ASSIGN_FUNCTION_TYPES,
                                                "invalid types in assignment: cannot assign %s to %s", ty2, ty1);
                     }
                     else {
-                        parser->diagnostic = DIAGNOSTIC_ASSIGNMENT;
                         compile_error(ctx, "invalid types in assignment: cannot assign %s to %s", ty2, ty1);
                     }
                 }
@@ -2274,6 +2272,7 @@ static ast_expression* parse_expression(parser_t *parser, bool stopatcomma, bool
     if (!e)
         return NULL;
     if (parser->tok != ';') {
+        parser->diagnostic = DIAGNOSTIC_SEMICOLON;
         parseerror(parser, "semicolon expected after expression");
         ast_unref(e);
         return NULL;
@@ -5707,8 +5706,8 @@ skipvar:
             if (parser->tok != '=') {
                 const char *obtain = parser_tokval(parser);
                 if (!strcmp(obtain, "}")) {
-                    parser->diagnostic = DIAGNOSTIC_SEMICOLON_SAME;
-                    parseerror(parser, "expected semicolon, got `%s`", obtain);
+                    parser->diagnostic = DIAGNOSTIC_SEMICOLON;
+                    parseerror(parser, "expected semicolon");
                 } else
                     parseerror(parser, "missing initializer");
                 break;