F diff --git a/src/frontend/parse/parse_declaration.c b/src/frontend/parse/parse_declaration.c
--- a/src/frontend/parse/parse_declaration.c
+++ b/src/frontend/parse/parse_declaration.c
if(tag==NULL)
{
struct Struct_Union *body;
- body=get_struct_union_base(scope,ret->specifier);
- Scope_Push(scope,get_denoted_struct_union(id,body),translation_data);
+ body=get_struct_union_base(scope,ret->specifier,id);
+ Scope_Push(scope,get_denoted_struct_union(body),translation_data);
parse_struct_union_specifier_finish(translation_data,scope,body);
ret->struct_union=body;
}else
{
- ret->struct_union=get_struct_union_base(scope,ret->specifier);
+ ret->struct_union=get_struct_union_base(scope,ret->specifier,NULL);
parse_struct_union_specifier_finish(translation_data,scope,ret->struct_union);
if(ret->struct_union->is_finished==0)
{
if(enumerator==NULL)
{
struct Enum *body;
- body=get_enum_base();
- Scope_Push(scope,get_denoted_enum(id,body),translation_data);
+ body=get_enum_base(id);
+ Scope_Push(scope,get_denoted_enum(body),translation_data);
parse_enum_specifier_finish(translation_data,scope,body);
ret->enumerator=body;
}else
}else
{
+ /*tagless enumeration*/
+ ret->enumerator=get_enum_base(NULL);
parse_enum_specifier_finish(translation_data,scope,ret->enumerator);
}
break;
F diff --git a/src/semantics/identifiers/denoted.c b/src/semantics/identifiers/denoted.c
--- a/src/semantics/identifiers/denoted.c
+++ b/src/semantics/identifiers/denoted.c
return (struct Denoted*)ret;
}
- struct Denoted* get_denoted_enum(struct token *id,struct Enum *enumerator)
+ struct Denoted* get_denoted_enum(struct Enum *enumerator)
{
struct Denoted_Enum *ret;
ret=malloc(sizeof(struct Denoted_Enum));
ret->denotation=DT_Enum;
- ret->id=id;
ret->enumeration=enumerator;
return (struct Denoted*)ret;
}
- struct Denoted* get_denoted_struct_union(struct token *id,struct Struct_Union *struct_union)
+ struct Denoted* get_denoted_struct_union(struct Struct_Union *struct_union)
{
struct Denoted_Struct_Union *ret;
ret=malloc(sizeof(struct Denoted_Struct_Union));
ret->denotation=DT_Struct_Union_Tag;
- ret->id=id;
ret->struct_union=struct_union;
-
return (struct Denoted*)ret;
}
struct Denoted* get_denotation_prototype(struct Map *types)
F diff --git a/src/semantics/identifiers/denoted.h b/src/semantics/identifiers/denoted.h
--- a/src/semantics/identifiers/denoted.h
+++ b/src/semantics/identifiers/denoted.h
struct Denoted_Enum
{
enum Denotation_Type denotation;
- struct token *id;
-
struct Enum *enumeration;
};
struct Denoted_Enum_Const
struct Denoted_Struct_Union
{
enum Denotation_Type denotation;
- struct token *id;
-
struct Struct_Union *struct_union;
};
struct Denoted* get_denoted_typedef(struct Denoted_Base *base);
struct Denoted* get_denoted_enum_const_expr(struct token *id,struct Enum *parent,struct AST* expression,struct Translation_Data *translation_data);
struct Denoted* get_denoted_enum_const_num(struct token *id,struct Enum *parent,int value);
- struct Denoted* get_denoted_enum(struct token *id,struct Enum *enumerator);
- struct Denoted* get_denoted_struct_union(struct token *id,struct Struct_Union *struct_union);
+ struct Denoted* get_denoted_enum(struct Enum *enumerator);
+ struct Denoted* get_denoted_struct_union(struct Struct_Union *struct_union);
struct Denoted* extract_denoted(struct Denoted_Base *base,struct Denotation_Prototype *prototype,char allow_abstract);
struct Denoted* get_denotation_prototype(struct Map *types);
F diff --git a/src/semantics/value/type.c b/src/semantics/value/type.c
--- a/src/semantics/value/type.c
+++ b/src/semantics/value/type.c
return (struct Type*)ret;
}
}
- struct Struct_Union* get_struct_union_base(struct Scope *scope ,enum Type_Specifier struct_or_union)
+ struct Struct_Union* get_struct_union_base(struct Scope *scope ,enum Type_Specifier struct_or_union,struct token *id)
{
struct Struct_Union *ret;
ret->inner_namespace=(struct Normal_Scope*)get_normal_scope(scope,BLOCK_SCOPE);
ret->is_finished=0;
ret->has_constant_member=0;
+ ret->id;
return ret;
}
- struct Enum *get_enum_base()
+ struct Enum *get_enum_base(struct token *id)
{
struct Enum *ret;
ret=malloc(sizeof(struct Enum));
Queue_Init(ret->consts);
ret->is_finished=0;
+ ret->id;
return ret;
}
F diff --git a/src/semantics/value/type.h b/src/semantics/value/type.h
--- a/src/semantics/value/type.h
+++ b/src/semantics/value/type.h
{
enum Type_Specifier specifier;
struct Map *node;
+
+ struct token *id;
size_t size;
- /*queue of denoted objects for preserving the order of the members*/
+ /* queue of denoted objects for
+ * preserving the order of the members
+ * */
struct Queue *members;
struct Normal_Scope *inner_namespace;
struct Enum
{
enum Type_Specifier specifier;
+
+ struct token *id;
struct Queue *consts;
char is_finished;
};
struct Type* get_type_error(struct Type *type);
struct Type* get_struct_union_type(struct Denotation_Prototype *prototype);
- struct Struct_Union* get_struct_union_base(struct Scope *scope ,enum Type_Specifier struct_or_union);
- struct Enum *get_enum_base();
+ struct Struct_Union* get_struct_union_base(struct Scope *scope ,enum Type_Specifier struct_or_union,struct token *id);
+ struct Enum *get_enum_base(struct token *id);
struct Type* get_basic_type(struct Denotation_Prototype *prototype);
struct Type* get_pointer_type(struct Type *points_to,char is_const,char is_volatile);
struct Type* get_array_type(struct Type *array_of,struct AST* number_of_elements,struct Translation_Data *translation_data);