X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=parser.c;h=5ed7914f94221d05d224e7d723b3997f6d385515;hb=3def71f59901789159be20bfdc806fb0fb1b6375;hp=1f30b1623492094da5bd239c1127ca3f1dc3ccd4;hpb=b44cca466ef8b9d3320cec8d284853074a0935db;p=cparser diff --git a/parser.c b/parser.c index 1f30b16..5ed7914 100644 --- a/parser.c +++ b/parser.c @@ -89,7 +89,6 @@ static scope_t *current_scope = NULL; /** Point to the current function declaration if inside a function. */ static function_t *current_function = NULL; static entity_t *current_entity = NULL; -static entity_t *current_init_decl = NULL; static switch_statement_t *current_switch = NULL; static statement_t *current_loop = NULL; static statement_t *current_parent = NULL; @@ -101,8 +100,6 @@ static label_statement_t *label_first = NULL; static label_statement_t **label_anchor = NULL; /** current translation unit. */ static translation_unit_t *unit = NULL; -/** true if we are in a type property context (evaluation only for type) */ -static bool in_type_prop = false; /** true if we are in an __extension__ context. */ static bool in_gcc_extension = false; static struct obstack temp_obst; @@ -124,6 +121,7 @@ static elf_visibility_tag_t default_visibility = ELF_VISIBILITY_DEFAULT; #define POP_SCOPE() (assert(current_scope == new_scope), scope_pop(old_scope), environment_pop_to(top)) #define PUSH_EXTENSION() \ + (void)0; \ bool const old_gcc_extension = in_gcc_extension; \ while (next_if(T___extension__)) { \ in_gcc_extension = true; \ @@ -2583,9 +2581,6 @@ static type_t *parse_typeof(void) expression_t *expression = NULL; - bool old_type_prop = in_type_prop; - in_type_prop = true; - switch (token.type) { case T_IDENTIFIER: if (is_typedef_symbol(token.symbol)) { @@ -2598,7 +2593,6 @@ static type_t *parse_typeof(void) } break; } - in_type_prop = old_type_prop; rem_anchor_token(')'); expect(')', end_error); @@ -2780,12 +2774,11 @@ static entity_t *create_error_entity(symbol_t *symbol, entity_kind_tag_t kind) static void parse_declaration_specifiers(declaration_specifiers_t *specifiers) { - type_t *type = NULL; - type_qualifiers_t qualifiers = TYPE_QUALIFIER_NONE; - unsigned type_specifiers = 0; - bool newtype = false; - bool saw_error = false; - bool old_gcc_extension = in_gcc_extension; + type_t *type = NULL; + type_qualifiers_t qualifiers = TYPE_QUALIFIER_NONE; + unsigned type_specifiers = 0; + bool newtype = false; + bool saw_error = false; memset(specifiers, 0, sizeof(*specifiers)); specifiers->source_position = token.source_position; @@ -2857,11 +2850,6 @@ wrong_thread_storage_class: MATCH_TYPE_QUALIFIER(T___uptr, TYPE_QUALIFIER_UPTR); MATCH_TYPE_QUALIFIER(T___sptr, TYPE_QUALIFIER_SPTR); - case T___extension__: - next_token(); - in_gcc_extension = true; - break; - /* type specifiers */ #define MATCH_SPECIFIER(token, specifier, name) \ case token: \ @@ -3012,8 +3000,6 @@ wrong_thread_storage_class: finish_specifiers: specifiers->attributes = parse_attributes(specifiers->attributes); - in_gcc_extension = old_gcc_extension; - if (type == NULL || (saw_error && type_specifiers != 0)) { atomic_type_kind_t atomic_type; @@ -4358,10 +4344,8 @@ static void parse_init_declarator_rest(entity_t *entity) env.type = orig_type; env.must_be_constant = must_be_constant; env.entity = entity; - current_init_decl = entity; initializer_t *initializer = parse_initializer(&env); - current_init_decl = NULL; if (entity->kind == ENTITY_VARIABLE) { /* §6.7.5:22 array initializers for arrays with unknown size @@ -6294,11 +6278,6 @@ static expression_t *parse_reference(void) check_deprecated(&pos, entity); - if (entity == current_init_decl && !in_type_prop && entity->kind == ENTITY_VARIABLE) { - current_init_decl = NULL; - warningf(WARN_INIT_SELF, &pos, "variable '%#N' is initialized by itself", entity); - } - return expression; } @@ -7048,10 +7027,6 @@ static expression_t *parse_typeprop(expression_kind_t const kind) eat(kind == EXPR_SIZEOF ? T_sizeof : T___alignof__); - /* we only refer to a type property, mark this case */ - bool old = in_type_prop; - in_type_prop = true; - type_t *orig_type; expression_t *expression; if (token.type == '(' && is_declaration_specifier(look_ahead(1))) { @@ -7108,7 +7083,6 @@ typeprop_expression: } end_error: - in_type_prop = old; return tp_expression; } @@ -10431,7 +10405,7 @@ static void parse_external(void) case '&': /* & x; -> int& x; (and error later, because C++ has no implicit int) */ case '*': /* * x; -> int* x; */ - case '(':; /* (x); -> int (x); */ + case '(': /* (x); -> int (x); */ PUSH_EXTENSION(); parse_external_declaration(); POP_EXTENSION();