/** 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;
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;
#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; \
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)) {
}
break;
}
- in_type_prop = old_type_prop;
rem_anchor_token(')');
expect(')', end_error);
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;
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: \
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;
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
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;
}
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))) {
}
end_error:
- in_type_prop = old;
return tp_expression;
}
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();