version 1.175, 2021/03/29 20:39:18 |
version 1.176, 2021/03/29 20:52:00 |
Line 216 struct brace_level { |
|
Line 216 struct brace_level { |
|
* See also: C99 6.7.8 "Initialization" |
* See also: C99 6.7.8 "Initialization" |
*/ |
*/ |
struct designator { |
struct designator { |
const char *name; /* for struct and union */ |
const char *dr_name; /* for struct and union */ |
/* TODO: add 'subscript' for arrays */ |
/* TODO: add 'dr_subscript' for arrays */ |
struct designator *next; |
struct designator *dr_next; |
}; |
}; |
|
|
/* |
/* |
Line 229 struct designator { |
|
Line 229 struct designator { |
|
* See also: C99 6.7.8 "Initialization" |
* See also: C99 6.7.8 "Initialization" |
*/ |
*/ |
struct designation { |
struct designation { |
struct designator *head; |
struct designator *dn_head; |
struct designator *tail; |
struct designator *dn_tail; |
}; |
}; |
|
|
struct initialization { |
struct initialization { |
Line 240 struct initialization { |
|
Line 240 struct initialization { |
|
* (parsed by yacc, expression trees built, but no initialization |
* (parsed by yacc, expression trees built, but no initialization |
* takes place). |
* takes place). |
*/ |
*/ |
bool initerr; |
bool in_err; |
|
|
/* The symbol that is to be initialized. */ |
/* The symbol that is to be initialized. */ |
sym_t *initsym; |
sym_t *in_sym; |
|
|
/* The innermost brace level. */ |
/* The innermost brace level. */ |
struct brace_level *brace_level; |
struct brace_level *in_brace_level; |
|
|
/* |
/* |
* The C99 designator, if any, for the current initialization |
* The C99 designator, if any, for the current initialization |
* expression. |
* expression. |
*/ |
*/ |
struct designation designation; |
struct designation in_designation; |
|
|
struct initialization *next; |
struct initialization *in_next; |
}; |
}; |
|
|
|
|
Line 425 check_init_expr(scl_t sclass, const type |
|
Line 425 check_init_expr(scl_t sclass, const type |
|
static struct designator * |
static struct designator * |
designator_new(const char *name) |
designator_new(const char *name) |
{ |
{ |
struct designator *d = xcalloc(1, sizeof *d); |
struct designator *dr; |
d->name = name; |
|
return d; |
dr = xcalloc(1, sizeof *dr); |
|
dr->dr_name = name; |
|
return dr; |
} |
} |
|
|
static void |
static void |
designator_free(struct designator *d) |
designator_free(struct designator *dr) |
{ |
{ |
|
|
free(d); |
free(dr); |
} |
} |
|
|
|
|
Line 442 designator_free(struct designator *d) |
|
Line 444 designator_free(struct designator *d) |
|
static void |
static void |
designation_debug(const struct designation *dn) |
designation_debug(const struct designation *dn) |
{ |
{ |
const struct designator *p; |
const struct designator *dr; |
|
|
if (dn->head == NULL) |
if (dn->dn_head == NULL) |
return; |
return; |
|
|
debug_indent(); |
debug_indent(); |
debug_printf("designation: "); |
debug_printf("designation: "); |
for (p = dn->head; p != NULL; p = p->next) |
for (dr = dn->dn_head; dr != NULL; dr = dr->dr_next) |
debug_printf(".%s", p->name); |
debug_printf(".%s", dr->dr_name); |
debug_printf("\n"); |
debug_printf("\n"); |
} |
} |
#else |
#else |
|
|
designation_add(struct designation *dn, struct designator *dr) |
designation_add(struct designation *dn, struct designator *dr) |
{ |
{ |
|
|
if (dn->head != NULL) { |
if (dn->dn_head != NULL) { |
dn->tail->next = dr; |
dn->dn_tail->dr_next = dr; |
dn->tail = dr; |
dn->dn_tail = dr; |
} else { |
} else { |
dn->head = dr; |
dn->dn_head = dr; |
dn->tail = dr; |
dn->dn_tail = dr; |
} |
} |
|
|
designation_debug(dn); |
designation_debug(dn); |
Line 480 designation_add(struct designation *dn, |
|
Line 482 designation_add(struct designation *dn, |
|
static void |
static void |
designation_shift_level(struct designation *dn) |
designation_shift_level(struct designation *dn) |
{ |
{ |
lint_assert(dn->head != NULL); |
lint_assert(dn->dn_head != NULL); |
|
|
if (dn->head == dn->tail) { |
if (dn->dn_head == dn->dn_tail) { |
designator_free(dn->head); |
designator_free(dn->dn_head); |
dn->head = NULL; |
dn->dn_head = NULL; |
dn->tail = NULL; |
dn->dn_tail = NULL; |
} else { |
} else { |
struct designator *head = dn->head; |
struct designator *head = dn->dn_head; |
dn->head = dn->head->next; |
dn->dn_head = dn->dn_head->dr_next; |
designator_free(head); |
designator_free(head); |
} |
} |
|
|
Line 765 initialization_new(sym_t *sym) |
|
Line 767 initialization_new(sym_t *sym) |
|
{ |
{ |
struct initialization *in = xcalloc(1, sizeof(*in)); |
struct initialization *in = xcalloc(1, sizeof(*in)); |
|
|
in->initsym = sym; |
in->in_sym = sym; |
|
|
return in; |
return in; |
} |
} |
Line 773 initialization_new(sym_t *sym) |
|
Line 775 initialization_new(sym_t *sym) |
|
static void |
static void |
initialization_free(struct initialization *in) |
initialization_free(struct initialization *in) |
{ |
{ |
struct brace_level *level, *next; |
struct brace_level *bl, *next; |
|
|
for (level = in->brace_level; level != NULL; level = next) { |
for (bl = in->in_brace_level; bl != NULL; bl = next) { |
next = level->bl_enclosing; |
next = bl->bl_enclosing; |
brace_level_free(level); |
brace_level_free(bl); |
} |
} |
|
|
free(in); |
free(in); |
Line 790 initialization_free(struct initializatio |
|
Line 792 initialization_free(struct initializatio |
|
static void |
static void |
initialization_debug(const struct initialization *in) |
initialization_debug(const struct initialization *in) |
{ |
{ |
if (in->brace_level == NULL) { |
if (in->in_brace_level == NULL) { |
debug_step("no brace level in the current initialization"); |
debug_step("no brace level in the current initialization"); |
return; |
return; |
} |
} |
|
|
size_t i = 0; |
size_t i = 0; |
for (const struct brace_level *level = in->brace_level; |
for (const struct brace_level *level = in->in_brace_level; |
level != NULL; level = level->bl_enclosing) { |
level != NULL; level = level->bl_enclosing) { |
debug_indent(); |
debug_indent(); |
debug_printf("brace level %zu: ", i); |
debug_printf("brace level %zu: ", i); |
Line 817 initialization_debug(const struct initia |
|
Line 819 initialization_debug(const struct initia |
|
static void |
static void |
initialization_init(struct initialization *in) |
initialization_init(struct initialization *in) |
{ |
{ |
if (in->initerr) |
if (in->in_err) |
return; |
return; |
|
|
debug_enter(); |
debug_enter(); |
Line 826 initialization_init(struct initializatio |
|
Line 828 initialization_init(struct initializatio |
|
* If the type which is to be initialized is an incomplete array, |
* If the type which is to be initialized is an incomplete array, |
* it must be duplicated. |
* it must be duplicated. |
*/ |
*/ |
if (in->initsym->s_type->t_tspec == ARRAY && is_incomplete(in->initsym->s_type)) |
if (in->in_sym->s_type->t_tspec == ARRAY && is_incomplete(in->in_sym->s_type)) |
in->initsym->s_type = duptyp(in->initsym->s_type); |
in->in_sym->s_type = duptyp(in->in_sym->s_type); |
/* TODO: does 'duptyp' create a memory leak? */ |
/* TODO: does 'duptyp' create a memory leak? */ |
|
|
in->brace_level = brace_level_new(NULL, in->initsym->s_type, 1, NULL); |
in->in_brace_level = brace_level_new(NULL, in->in_sym->s_type, 1, NULL); |
|
|
initialization_debug(in); |
initialization_debug(in); |
debug_leave(); |
debug_leave(); |
Line 839 initialization_init(struct initializatio |
|
Line 841 initialization_init(struct initializatio |
|
static void |
static void |
initialization_set_error(struct initialization *in) |
initialization_set_error(struct initialization *in) |
{ |
{ |
in->initerr = true; |
in->in_err = true; |
} |
} |
|
|
/* TODO: document me */ |
/* TODO: document me */ |
Line 847 initialization_set_error(struct initiali |
|
Line 849 initialization_set_error(struct initiali |
|
static bool |
static bool |
initialization_push_struct_or_union(struct initialization *in) |
initialization_push_struct_or_union(struct initialization *in) |
{ |
{ |
struct brace_level *level = in->brace_level; |
struct brace_level *level = in->in_brace_level; |
int cnt; |
int cnt; |
sym_t *m; |
sym_t *m; |
|
|
Line 859 initialization_push_struct_or_union(stru |
|
Line 861 initialization_push_struct_or_union(stru |
|
} |
} |
|
|
cnt = 0; |
cnt = 0; |
designation_debug(&in->designation); |
designation_debug(&in->in_designation); |
debug_step("lookup for '%s'%s", |
debug_step("lookup for '%s'%s", |
type_name(level->bl_type), |
type_name(level->bl_type), |
level->bl_seen_named_member ? ", seen named member" : ""); |
level->bl_seen_named_member ? ", seen named member" : ""); |
|
|
if (in->designation.head != NULL) |
if (in->in_designation.dn_head != NULL) |
m = brace_level_look_up_first_member_named(level, |
m = brace_level_look_up_first_member_named(level, |
in->designation.head->name, &cnt); |
in->in_designation.dn_head->dr_name, &cnt); |
else |
else |
m = brace_level_look_up_first_member_unnamed(level, &cnt); |
m = brace_level_look_up_first_member_unnamed(level, &cnt); |
|
|
if (in->designation.head != NULL) { |
if (in->in_designation.dn_head != NULL) { |
if (m == NULL) { |
if (m == NULL) { |
debug_step("pop struct"); |
debug_step("pop struct"); |
return true; |
return true; |
Line 879 initialization_push_struct_or_union(stru |
|
Line 881 initialization_push_struct_or_union(stru |
|
level->bl_subtype = m->s_type; |
level->bl_subtype = m->s_type; |
level->bl_seen_named_member = true; |
level->bl_seen_named_member = true; |
debug_step("named member '%s'", |
debug_step("named member '%s'", |
in->designation.head->name); |
in->in_designation.dn_head->dr_name); |
designation_shift_level(&in->designation); |
designation_shift_level(&in->in_designation); |
cnt = level->bl_type->t_tspec == STRUCT ? 2 : 1; |
cnt = level->bl_type->t_tspec == STRUCT ? 2 : 1; |
} |
} |
level->bl_brace = true; |
level->bl_brace = true; |
Line 901 initialization_push_struct_or_union(stru |
|
Line 903 initialization_push_struct_or_union(stru |
|
static void |
static void |
initialization_end_brace_level(struct initialization *in) |
initialization_end_brace_level(struct initialization *in) |
{ |
{ |
struct brace_level *level = in->brace_level; |
struct brace_level *level = in->in_brace_level; |
in->brace_level = level->bl_enclosing; |
in->in_brace_level = level->bl_enclosing; |
brace_level_free(level); |
brace_level_free(level); |
} |
} |
|
|
Line 915 initialization_push(struct initializatio |
|
Line 917 initialization_push(struct initializatio |
|
|
|
debug_enter(); |
debug_enter(); |
|
|
brace_level_extend_if_array_of_unknown_size(in->brace_level); |
brace_level_extend_if_array_of_unknown_size(in->in_brace_level); |
|
|
level = in->brace_level; |
level = in->in_brace_level; |
lint_assert(level->bl_remaining > 0); |
lint_assert(level->bl_remaining > 0); |
|
|
in->brace_level = brace_level_new(brace_level_subtype(level), NULL, 0, |
in->in_brace_level = brace_level_new(brace_level_subtype(level), NULL, 0, |
level); |
level); |
lint_assert(in->brace_level->bl_type != NULL); |
lint_assert(in->in_brace_level->bl_type != NULL); |
lint_assert(in->brace_level->bl_type->t_tspec != FUNC); |
lint_assert(in->in_brace_level->bl_type->t_tspec != FUNC); |
|
|
again: |
again: |
level = in->brace_level; |
level = in->in_brace_level; |
|
|
debug_step("expecting type '%s'", type_name(level->bl_type)); |
debug_step("expecting type '%s'", type_name(level->bl_type)); |
lint_assert(level->bl_type != NULL); |
lint_assert(level->bl_type != NULL); |
switch (level->bl_type->t_tspec) { |
switch (level->bl_type->t_tspec) { |
case ARRAY: |
case ARRAY: |
if (in->designation.head != NULL) { |
if (in->in_designation.dn_head != NULL) { |
debug_step("pop array, named member '%s'%s", |
debug_step("pop array, named member '%s'%s", |
in->designation.head->name, |
in->in_designation.dn_head->dr_name, |
level->bl_brace ? ", needs closing brace" : ""); |
level->bl_brace ? ", needs closing brace" : ""); |
goto pop; |
goto pop; |
} |
} |
|
|
goto pop; |
goto pop; |
break; |
break; |
default: |
default: |
if (in->designation.head != NULL) { |
if (in->in_designation.dn_head != NULL) { |
debug_step("pop scalar"); |
debug_step("pop scalar"); |
pop: |
pop: |
initialization_end_brace_level(in); |
initialization_end_brace_level(in); |
|
|
static void |
static void |
initialization_pop_item_named(struct initialization *in, const char *name) |
initialization_pop_item_named(struct initialization *in, const char *name) |
{ |
{ |
struct brace_level *level = in->brace_level; |
struct brace_level *level = in->in_brace_level; |
const sym_t *m; |
const sym_t *m; |
|
|
/* |
/* |
Line 994 initialization_pop_item_named(struct ini |
|
Line 996 initialization_pop_item_named(struct ini |
|
/* undefined struct/union member: %s */ |
/* undefined struct/union member: %s */ |
error(101, name); |
error(101, name); |
|
|
designation_shift_level(&in->designation); |
designation_shift_level(&in->in_designation); |
level->bl_seen_named_member = true; |
level->bl_seen_named_member = true; |
return; |
return; |
} |
} |
Line 1004 initialization_pop_item_named(struct ini |
|
Line 1006 initialization_pop_item_named(struct ini |
|
/* XXX: why ++? */ |
/* XXX: why ++? */ |
level->bl_remaining++; |
level->bl_remaining++; |
/* XXX: why is bl_seen_named_member not set? */ |
/* XXX: why is bl_seen_named_member not set? */ |
designation_shift_level(&in->designation); |
designation_shift_level(&in->in_designation); |
} |
} |
|
|
/* TODO: think of a better name than 'pop' */ |
/* TODO: think of a better name than 'pop' */ |
Line 1015 initialization_pop_item(struct initializ |
|
Line 1017 initialization_pop_item(struct initializ |
|
|
|
debug_enter(); |
debug_enter(); |
|
|
level = in->brace_level; |
level = in->in_brace_level; |
debug_indent(); |
debug_indent(); |
debug_printf("popping: "); |
debug_printf("popping: "); |
brace_level_debug(level); |
brace_level_debug(level); |
|
|
in->brace_level = level->bl_enclosing; |
in->in_brace_level = level->bl_enclosing; |
brace_level_free(level); |
brace_level_free(level); |
level = in->brace_level; |
level = in->in_brace_level; |
lint_assert(level != NULL); |
lint_assert(level != NULL); |
|
|
level->bl_remaining--; |
level->bl_remaining--; |
lint_assert(level->bl_remaining >= 0); |
lint_assert(level->bl_remaining >= 0); |
debug_step("%d elements remaining", level->bl_remaining); |
debug_step("%d elements remaining", level->bl_remaining); |
|
|
if (in->designation.head != NULL && in->designation.head->name != NULL) |
if (in->in_designation.dn_head != NULL && in->in_designation.dn_head->dr_name != NULL) |
initialization_pop_item_named(in, in->designation.head->name); |
initialization_pop_item_named(in, in->in_designation.dn_head->dr_name); |
else |
else |
brace_level_pop_item_unnamed(level); |
brace_level_pop_item_unnamed(level); |
|
|
Line 1048 initialization_pop_nobrace(struct initia |
|
Line 1050 initialization_pop_nobrace(struct initia |
|
{ |
{ |
|
|
debug_enter(); |
debug_enter(); |
while (!in->brace_level->bl_brace && |
while (!in->in_brace_level->bl_brace && |
in->brace_level->bl_remaining == 0 && |
in->in_brace_level->bl_remaining == 0 && |
!in->brace_level->bl_array_of_unknown_size) |
!in->in_brace_level->bl_array_of_unknown_size) |
initialization_pop_item(in); |
initialization_pop_item(in); |
debug_leave(); |
debug_leave(); |
} |
} |
Line 1067 initialization_next_brace(struct initial |
|
Line 1069 initialization_next_brace(struct initial |
|
debug_enter(); |
debug_enter(); |
initialization_debug(in); |
initialization_debug(in); |
|
|
if (!in->initerr && |
if (!in->in_err && |
!brace_level_check_too_many_initializers(in->brace_level)) |
!brace_level_check_too_many_initializers(in->in_brace_level)) |
initialization_set_error(in); |
initialization_set_error(in); |
|
|
if (!in->initerr) |
if (!in->in_err) |
initialization_push(in); |
initialization_push(in); |
|
|
if (!in->initerr) { |
if (!in->in_err) { |
in->brace_level->bl_brace = true; |
in->in_brace_level->bl_brace = true; |
designation_debug(&in->designation); |
designation_debug(&in->in_designation); |
if (in->brace_level->bl_type != NULL) |
if (in->in_brace_level->bl_type != NULL) |
debug_step("expecting type '%s'", |
debug_step("expecting type '%s'", |
type_name(in->brace_level->bl_type)); |
type_name(in->in_brace_level->bl_type)); |
} |
} |
|
|
initialization_debug(in); |
initialization_debug(in); |
Line 1105 check_no_auto_aggregate(scl_t sclass, co |
|
Line 1107 check_no_auto_aggregate(scl_t sclass, co |
|
static void |
static void |
initialization_lbrace(struct initialization *in) |
initialization_lbrace(struct initialization *in) |
{ |
{ |
if (in->initerr) |
if (in->in_err) |
return; |
return; |
|
|
debug_enter(); |
debug_enter(); |
initialization_debug(in); |
initialization_debug(in); |
|
|
check_no_auto_aggregate(in->initsym->s_scl, in->brace_level); |
check_no_auto_aggregate(in->in_sym->s_scl, in->in_brace_level); |
|
|
/* |
/* |
* Remove all entries which cannot be used for further initializers |
* Remove all entries which cannot be used for further initializers |
Line 1137 initialization_rbrace(struct initializat |
|
Line 1139 initialization_rbrace(struct initializat |
|
{ |
{ |
bool brace; |
bool brace; |
|
|
if (in->initerr) |
if (in->in_err) |
return; |
return; |
|
|
debug_enter(); |
debug_enter(); |
do { |
do { |
brace = in->brace_level->bl_brace; |
brace = in->in_brace_level->bl_brace; |
/* TODO: improve wording of the debug message */ |
/* TODO: improve wording of the debug message */ |
debug_step("loop brace=%d", brace); |
debug_step("loop brace=%d", brace); |
initialization_pop_item(in); |
initialization_pop_item(in); |
Line 1184 initialization_add_designator_subscript( |
|
Line 1186 initialization_add_designator_subscript( |
|
/* XXX: This call is wrong here, it must be somewhere else. */ |
/* XXX: This call is wrong here, it must be somewhere else. */ |
initialization_pop_nobrace(in); |
initialization_pop_nobrace(in); |
|
|
level = in->brace_level; |
level = in->in_brace_level; |
if (level->bl_array_of_unknown_size) { |
if (level->bl_array_of_unknown_size) { |
/* No +1 here, extend_if_array_of_unknown_size will add it. */ |
/* No +1 here, extend_if_array_of_unknown_size will add it. */ |
int auto_dim = (int)range.hi; |
int auto_dim = (int)range.hi; |
Line 1220 initialization_init_array_using_string(s |
|
Line 1222 initialization_init_array_using_string(s |
|
|
|
debug_enter(); |
debug_enter(); |
|
|
level = in->brace_level; |
level = in->in_brace_level; |
strg = tn->tn_string; |
strg = tn->tn_string; |
|
|
/* |
/* |
Line 1232 initialization_init_array_using_string(s |
|
Line 1234 initialization_init_array_using_string(s |
|
|
|
/* Put the array at top of stack */ |
/* Put the array at top of stack */ |
initialization_push(in); |
initialization_push(in); |
level = in->brace_level; |
level = in->in_brace_level; |
|
|
} else if (is_string_array(level->bl_type, strg->st_tspec)) { |
} else if (is_string_array(level->bl_type, strg->st_tspec)) { |
debug_step("type is an array"); |
debug_step("type is an array"); |
Line 1288 initialization_init_using_assign(struct |
|
Line 1290 initialization_init_using_assign(struct |
|
{ |
{ |
tnode_t *ln, *tn; |
tnode_t *ln, *tn; |
|
|
if (in->initsym->s_type->t_tspec == ARRAY) |
if (in->in_sym->s_type->t_tspec == ARRAY) |
return false; |
return false; |
if (in->brace_level->bl_enclosing != NULL) |
if (in->in_brace_level->bl_enclosing != NULL) |
return false; |
return false; |
|
|
debug_step("handing over to ASSIGN"); |
debug_step("handing over to ASSIGN"); |
|
|
ln = new_name_node(in->initsym, 0); |
ln = new_name_node(in->in_sym, 0); |
ln->tn_type = tduptyp(ln->tn_type); |
ln->tn_type = tduptyp(ln->tn_type); |
ln->tn_type->t_const = false; |
ln->tn_type->t_const = false; |
|
|
Line 1312 initialization_next_nobrace(struct initi |
|
Line 1314 initialization_next_nobrace(struct initi |
|
{ |
{ |
debug_enter(); |
debug_enter(); |
|
|
if (in->brace_level->bl_type == NULL && |
if (in->in_brace_level->bl_type == NULL && |
!is_scalar(in->brace_level->bl_subtype->t_tspec)) { |
!is_scalar(in->in_brace_level->bl_subtype->t_tspec)) { |
/* {}-enclosed initializer required */ |
/* {}-enclosed initializer required */ |
error(181); |
error(181); |
/* XXX: maybe set initerr here */ |
/* XXX: maybe set initerr here */ |
} |
} |
|
|
if (!in->initerr && |
if (!in->in_err && |
!brace_level_check_too_many_initializers(in->brace_level)) |
!brace_level_check_too_many_initializers(in->in_brace_level)) |
initialization_set_error(in); |
initialization_set_error(in); |
|
|
while (!in->initerr) { |
while (!in->in_err) { |
struct brace_level *level = in->brace_level; |
struct brace_level *level = in->in_brace_level; |
|
|
if (tn->tn_type->t_tspec == STRUCT && |
if (tn->tn_type->t_tspec == STRUCT && |
level->bl_type == tn->tn_type && |
level->bl_type == tn->tn_type && |
Line 1352 initialization_expr(struct initializatio |
|
Line 1354 initialization_expr(struct initializatio |
|
|
|
debug_enter(); |
debug_enter(); |
initialization_debug(in); |
initialization_debug(in); |
designation_debug(&in->designation); |
designation_debug(&in->in_designation); |
debug_step("expr:"); |
debug_step("expr:"); |
debug_node(tn, debug_ind + 1); |
debug_node(tn, debug_ind + 1); |
|
|
if (in->initerr || tn == NULL) |
if (in->in_err || tn == NULL) |
goto done; |
goto done; |
|
|
sclass = in->initsym->s_scl; |
sclass = in->in_sym->s_scl; |
if ((sclass == AUTO || sclass == REG) && |
if ((sclass == AUTO || sclass == REG) && |
initialization_init_using_assign(in, tn)) |
initialization_init_using_assign(in, tn)) |
goto done; |
goto done; |
Line 1372 initialization_expr(struct initializatio |
|
Line 1374 initialization_expr(struct initializatio |
|
} |
} |
|
|
initialization_next_nobrace(in, tn); |
initialization_next_nobrace(in, tn); |
if (in->initerr || tn == NULL) |
if (in->in_err || tn == NULL) |
goto done_debug; |
goto done_debug; |
|
|
/* Using initsym here is better than nothing. */ |
/* Using initsym here is better than nothing. */ |
check_init_expr(sclass, in->brace_level->bl_type, in->initsym, tn); |
check_init_expr(sclass, in->in_brace_level->bl_type, in->in_sym, tn); |
|
|
in->brace_level->bl_remaining--; |
in->in_brace_level->bl_remaining--; |
debug_step("%d elements remaining", in->brace_level->bl_remaining); |
debug_step("%d elements remaining", in->in_brace_level->bl_remaining); |
|
|
done_debug: |
done_debug: |
initialization_debug(in); |
initialization_debug(in); |
|
|
done: |
done: |
while (in->designation.head != NULL) |
while (in->in_designation.dn_head != NULL) |
designation_shift_level(&in->designation); |
designation_shift_level(&in->in_designation); |
|
|
debug_leave(); |
debug_leave(); |
} |
} |
|
|
current_initerr(void) |
current_initerr(void) |
{ |
{ |
|
|
return ¤t_init()->initerr; |
return ¤t_init()->in_err; |
} |
} |
|
|
sym_t ** |
sym_t ** |
current_initsym(void) |
current_initsym(void) |
{ |
{ |
|
|
return ¤t_init()->initsym; |
return ¤t_init()->in_sym; |
} |
} |
|
|
void |
void |
Line 1420 begin_initialization(sym_t *sym) |
|
Line 1422 begin_initialization(sym_t *sym) |
|
|
|
debug_step("begin initialization of '%s'", type_name(sym->s_type)); |
debug_step("begin initialization of '%s'", type_name(sym->s_type)); |
in = initialization_new(sym); |
in = initialization_new(sym); |
in->next = init; |
in->in_next = init; |
init = in; |
init = in; |
} |
} |
|
|
Line 1430 end_initialization(void) |
|
Line 1432 end_initialization(void) |
|
struct initialization *in; |
struct initialization *in; |
|
|
in = init; |
in = init; |
init = init->next; |
init = init->in_next; |
initialization_free(in); |
initialization_free(in); |
debug_step("end initialization"); |
debug_step("end initialization"); |
} |
} |
|
|
add_designator_member(sbuf_t *sb) |
add_designator_member(sbuf_t *sb) |
{ |
{ |
|
|
designation_add(¤t_init()->designation, |
designation_add(¤t_init()->in_designation, |
designator_new(sb->sb_name)); |
designator_new(sb->sb_name)); |
} |
} |
|
|