From: Dale Weiler Date: Fri, 31 May 2013 03:52:44 +0000 (+0000) Subject: Cleanup X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=dd660981d1d7fd786ce9d97f7e16b2bc33335ff3;p=xonotic%2Fgmqcc.git Cleanup --- diff --git a/diag.c b/diag.c index b583e4f..13d276f 100644 --- 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 87d656f..1beaf4d 100644 --- 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(); diff --git a/parser.c b/parser.c index 7a9e5c9..907f6a6 100644 --- 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;