}
}
-static void print_local_label(const local_label_statement_t *statement)
-{
- fputs("__label__ ", out);
-
- bool first = true;
- entity_t *entity = statement->labels_begin;
- for (;
- entity != statement->labels_end->base.next;
- entity = entity->base.next) {
- if (!first) {
- fputs(", ", out);
- } else {
- first = false;
- }
- fputs(entity->base.symbol->string, out);
- }
- fputs(";\n", out);
-}
-
static void print_typedef(const entity_t *entity)
{
fputs("typedef ", out);
case STATEMENT_LABEL:
print_label_statement(&statement->label);
break;
- case STATEMENT_LOCAL_LABEL:
- print_local_label(&statement->local_label);
- break;
case STATEMENT_GOTO:
print_goto_statement(&statement->gotos);
break;
case ENTITY_NAMESPACE:
print_namespace(&entity->namespacee);
return;
+ case ENTITY_LOCAL_LABEL:
+ fprintf(out, "__label__ %s;", entity->base.symbol->string);
+ return;
case ENTITY_LABEL:
case ENTITY_ENUM_VALUE:
- case ENTITY_LOCAL_LABEL:
panic("print_entity used on unexpected entity type");
case ENTITY_INVALID:
break;
typedef struct if_statement_t if_statement_t;
typedef struct switch_statement_t switch_statement_t;
typedef struct declaration_statement_t declaration_statement_t;
-typedef struct local_label_statement_t local_label_statement_t;
typedef struct expression_statement_t expression_statement_t;
typedef struct goto_statement_t goto_statement_t;
typedef struct label_statement_t label_statement_t;
case STATEMENT_LABEL:
label_to_firm(&statement->label);
return;
- case STATEMENT_LOCAL_LABEL:
- /* local labels transform the semantics of labels while parsing
- * they don't need any special treatment here */
- return;
case STATEMENT_GOTO:
goto_to_firm(&statement->gotos);
return;
STATEMENT_COMPOUND,
STATEMENT_RETURN,
STATEMENT_DECLARATION,
- STATEMENT_LOCAL_LABEL,
STATEMENT_IF,
STATEMENT_SWITCH,
STATEMENT_EXPRESSION,
entity_t *declarations_end;
};
-struct local_label_statement_t {
- statement_base_t base;
- entity_t *labels_begin;
- entity_t *labels_end;
-};
-
struct if_statement_t {
statement_base_t base;
expression_t *condition;
return_statement_t returns;
compound_statement_t compound;
declaration_statement_t declaration;
- local_label_statement_t local_label;
if_statement_t ifs;
switch_statement_t switchs;
goto_statement_t gotos;
[STATEMENT_COMPOUND] = sizeof(compound_statement_t),
[STATEMENT_RETURN] = sizeof(return_statement_t),
[STATEMENT_DECLARATION] = sizeof(declaration_statement_t),
- [STATEMENT_LOCAL_LABEL] = sizeof(local_label_statement_t),
[STATEMENT_IF] = sizeof(if_statement_t),
[STATEMENT_SWITCH] = sizeof(switch_statement_t),
[STATEMENT_EXPRESSION] = sizeof(expression_statement_t),
switch (stmt->kind) {
case STATEMENT_INVALID:
case STATEMENT_EMPTY:
- case STATEMENT_LOCAL_LABEL:
case STATEMENT_ASM:
next = stmt->base.next;
break;
case STATEMENT_INVALID:
case STATEMENT_EMPTY:
case STATEMENT_DECLARATION:
- case STATEMENT_LOCAL_LABEL:
case STATEMENT_EXPRESSION:
case STATEMENT_ASM:
case STATEMENT_RETURN:
walk_statements(stmt->ms_try.final_statement, callback, env);
return;
- case STATEMENT_LOCAL_LABEL:
case STATEMENT_INVALID:
case STATEMENT_EMPTY:
case STATEMENT_CONTINUE: