X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ast.c;h=3944ade866817870eaaafd48b5b5e4dd626f0a03;hb=ef0330776eb4dc05c1bde7354d9ed6c86f2c4727;hp=3ee0201d0433061ae18cf2bd7af5b4bef15eb3bd;hpb=24a305f9b0fd1c83ff453928b768822e324223e6;p=cparser diff --git a/ast.c b/ast.c index 3ee0201..3944ade 100644 --- a/ast.c +++ b/ast.c @@ -100,7 +100,6 @@ static int right_to_left(unsigned precedence) static unsigned get_expression_precedence(expression_kind_t kind) { static const unsigned prec[] = { - [EXPR_INVALID] = PREC_PRIMARY, [EXPR_REFERENCE] = PREC_PRIMARY, [EXPR_REFERENCE_ENUM_VALUE] = PREC_PRIMARY, [EXPR_LITERAL_INTEGER] = PREC_PRIMARY, @@ -752,15 +751,6 @@ static void print_expression_prec(const expression_t *expression, unsigned top_p case EXPR_STATEMENT: print_statement_expression(&expression->statement); break; - case EXPR_INVALID: - panic("invalid expression found"); - -#if 0 - default: - /* TODO */ - print_format("some expression of type %d", (int)expression->kind); - break; -#endif } if (parenthesized) print_string(")"); @@ -1190,8 +1180,8 @@ void print_statement(const statement_t *statement) case STATEMENT_LEAVE: print_leave_statement(&statement->leave); break; - case STATEMENT_INVALID: - print_string("$invalid statement$\n"); + case STATEMENT_ERROR: + print_string("$error statement$\n"); break; } } @@ -1511,8 +1501,6 @@ print_compound: case ENTITY_LABEL: case ENTITY_ENUM_VALUE: panic("print_entity used on unexpected entity type"); - case ENTITY_INVALID: - break; } panic("Invalid entity type encountered"); } @@ -1620,8 +1608,6 @@ static expression_classification_t is_object_with_linker_constant_address( case EXPR_ERROR: return EXPR_CLASS_ERROR; - case EXPR_INVALID: - panic("invalid expression found"); default: return EXPR_CLASS_VARIABLE; @@ -1748,8 +1734,6 @@ expression_classification_t is_linker_constant(const expression_t *expression) case EXPR_ERROR: return EXPR_CLASS_ERROR; - case EXPR_INVALID: - panic("invalid expression found"); default: return EXPR_CLASS_VARIABLE; @@ -1770,15 +1754,8 @@ static expression_classification_t is_builtin_const_call(const expression_t *exp return EXPR_CLASS_VARIABLE; switch (ref->entity->function.btk) { - case bk_gnu_builtin_huge_val: - case bk_gnu_builtin_huge_valf: - case bk_gnu_builtin_huge_vall: - case bk_gnu_builtin_inf: - case bk_gnu_builtin_inff: - case bk_gnu_builtin_infl: - case bk_gnu_builtin_nan: - case bk_gnu_builtin_nanf: - case bk_gnu_builtin_nanl: + case BUILTIN_INF: + case BUILTIN_NAN: return EXPR_CLASS_CONSTANT; default: return EXPR_CLASS_VARIABLE; @@ -1830,8 +1807,6 @@ static expression_classification_t is_object_with_constant_address(const express case EXPR_ERROR: return EXPR_CLASS_ERROR; - case EXPR_INVALID: - panic("invalid expression found"); default: return EXPR_CLASS_VARIABLE; @@ -1982,8 +1957,6 @@ expression_classification_t is_constant_expression(const expression_t *expressio case EXPR_ERROR: return EXPR_CLASS_ERROR; - case EXPR_INVALID: - break; } panic("invalid expression found (is constant expression)"); }