X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=parser.c;h=fa85c3c12549b48574bd7566100ea8032b5e7e11;hb=bafab880eb08fe9a867aae7e52fc290e09a915f2;hp=3d864acd943eddb5e090c9cebaaaa90ece0c4bef;hpb=46e601cdf52e685ab226cdb0eac8799107b3f77e;p=cparser diff --git a/parser.c b/parser.c index 3d864ac..fa85c3c 100644 --- a/parser.c +++ b/parser.c @@ -141,7 +141,7 @@ static struct obstack temp_obst; #define PUSH_PARENT(stmt) \ statement_t *const prev_parent = current_parent; \ - current_parent = (stmt); + ((void)(current_parent = (stmt))) #define POP_PARENT ((void)(current_parent = prev_parent)) static source_position_t null_position = { NULL, 0 }; @@ -1991,6 +1991,11 @@ static initializer_t *initializer_from_expression(type_t *orig_type, &expression->base.source_position); initializer_t *const result = allocate_initializer_zero(INITIALIZER_VALUE); +#if 0 + if (type->kind == TYPE_BITFIELD) { + type = type->bitfield.base_type; + } +#endif result->value.value = create_implicit_cast(expression, type); return result; @@ -7376,13 +7381,13 @@ static expression_t *parse_conditional_expression(unsigned precedence, "pointer/integer type mismatch in conditional expression ('%T' and '%T')", true_type, false_type); result_type = pointer_type; } else { - type_error_incompatible("while parsing conditional", - &expression->base.source_position, true_type, false_type); + if (is_type_valid(other_type)) { + type_error_incompatible("while parsing conditional", + &expression->base.source_position, true_type, false_type); + } result_type = type_error_type; } } else { - /* TODO: one pointer to void*, other some pointer */ - if (is_type_valid(true_type) && is_type_valid(false_type)) { type_error_incompatible("while parsing conditional", &conditional->base.source_position, true_type, @@ -7653,7 +7658,7 @@ static void semantic_take_addr(unary_expression_t *expression) value->base.type = revert_automatic_type_conversion(value); type_t *orig_type = value->base.type; - if (!is_type_valid(orig_type)) + if (!is_type_valid(skip_typeref(orig_type))) return; set_address_taken(value, false); @@ -8804,7 +8809,7 @@ static statement_t *parse_case_statement(void) /* This check does not prevent the error message in all cases of an * prior error while parsing the expression. At least it catches the * common case of a mistyped enum entry. */ - if (is_type_valid(end_range->base.type)) { + if (is_type_valid(skip_typeref(end_range->base.type))) { errorf(pos, "case range does not reduce to an integer constant"); } statement->case_label.is_bad = true; @@ -9146,7 +9151,7 @@ static statement_t *parse_do(void) eat(T_do); - PUSH_PARENT(statement) + PUSH_PARENT(statement); add_anchor_token(T_while); statement->do_while.body = parse_loop_body(statement);