projects
/
cparser
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3104cdc
)
Correctly register declarations for compound types and enums.
author
Christoph Mallon
<christoph.mallon@gmx.de>
Tue, 11 Dec 2007 21:04:01 +0000
(21:04 +0000)
committer
Christoph Mallon
<christoph.mallon@gmx.de>
Tue, 11 Dec 2007 21:04:01 +0000
(21:04 +0000)
[r18677]
parser.c
patch
|
blob
|
history
diff --git
a/parser.c
b/parser.c
index
2326c0a
..
0dfaec2
100644
(file)
--- a/
parser.c
+++ b/
parser.c
@@
-1281,7
+1281,7
@@
static initializer_t *parse_initializer(type_t *type)
return result;
}
return result;
}
-
+static declaration_t *append_declaration(declaration_t *declaration);
static declaration_t *parse_compound_type_specifier(bool is_struct)
{
static declaration_t *parse_compound_type_specifier(bool is_struct)
{
@@
-1330,7
+1330,11
@@
static declaration_t *parse_compound_type_specifier(bool is_struct)
}
declaration->source_position = token.source_position;
declaration->symbol = symbol;
}
declaration->source_position = token.source_position;
declaration->symbol = symbol;
- record_declaration(declaration);
+ declaration->parent_context = context;
+ if (symbol != NULL) {
+ environment_push(declaration);
+ }
+ append_declaration(declaration);
}
if(token.type == '{') {
}
if(token.type == '{') {
@@
-1425,6
+1429,7
@@
static type_t *parse_enum_specifier(void)
declaration->namespc = NAMESPACE_ENUM;
declaration->source_position = token.source_position;
declaration->symbol = symbol;
declaration->namespc = NAMESPACE_ENUM;
declaration->source_position = token.source_position;
declaration->symbol = symbol;
+ declaration->parent_context = context;
}
type_t *const type = allocate_type_zero(TYPE_ENUM);
}
type_t *const type = allocate_type_zero(TYPE_ENUM);
@@
-1434,7
+1439,8
@@
static type_t *parse_enum_specifier(void)
if(declaration->init.is_defined) {
errorf(HERE, "multiple definitions of enum %Y", symbol);
}
if(declaration->init.is_defined) {
errorf(HERE, "multiple definitions of enum %Y", symbol);
}
- record_declaration(declaration);
+ environment_push(declaration);
+ append_declaration(declaration);
declaration->init.is_defined = 1;
parse_enum_entries(&type->enumt);
declaration->init.is_defined = 1;
parse_enum_entries(&type->enumt);