Rename the member statement of struct function_t to body.
authorChristoph Mallon <christoph.mallon@gmx.de>
Thu, 18 Oct 2012 07:37:43 +0000 (09:37 +0200)
committerChristoph Mallon <christoph.mallon@gmx.de>
Thu, 18 Oct 2012 07:37:43 +0000 (09:37 +0200)
ast.c
ast2firm.c
entity_t.h
parser.c
walk.c
wrappergen/write_fluffy.c
wrappergen/write_jna.c

diff --git a/ast.c b/ast.c
index 063ac47..ac0ac87 100644 (file)
--- a/ast.c
+++ b/ast.c
@@ -1344,9 +1344,9 @@ void print_declaration(const entity_t *entity)
                        print_type_ext(entity->declaration.type, entity->base.symbol,
                                        &entity->function.parameters);
 
-                       if (entity->function.statement != NULL) {
+                       if (entity->function.body != NULL) {
                                print_char('\n');
-                               print_indented_statement(entity->function.statement);
+                               print_indented_statement(entity->function.body);
                                print_char('\n');
                                return;
                        }
index 6084b36..47e19b9 100644 (file)
@@ -852,7 +852,7 @@ static bool declaration_is_definition(const entity_t *entity)
        case ENTITY_VARIABLE:
                return entity->declaration.storage_class != STORAGE_CLASS_EXTERN;
        case ENTITY_FUNCTION:
-               return entity->function.statement != NULL;
+               return entity->function.body != NULL;
        case ENTITY_PARAMETER:
        case ENTITY_COMPOUND_MEMBER:
                return false;
@@ -938,7 +938,7 @@ static ir_entity *get_function_entity(entity_t *entity, ir_type *owner_type)
 
        /* already an entity defined? */
        ir_entity *irentity = entitymap_get(&entitymap, symbol);
-       bool const has_body = entity->function.statement != NULL;
+       bool const has_body = entity->function.body != NULL;
        if (irentity != NULL) {
                goto entity_created;
        }
@@ -4351,7 +4351,7 @@ static void create_local_declaration(entity_t *entity)
                return;
        case STORAGE_CLASS_EXTERN:
                if (entity->kind == ENTITY_FUNCTION) {
-                       assert(entity->function.statement == NULL);
+                       assert(entity->function.body == NULL);
                        (void)get_function_entity(entity, NULL);
                } else {
                        create_global_variable(entity);
@@ -4362,7 +4362,7 @@ static void create_local_declaration(entity_t *entity)
        case STORAGE_CLASS_AUTO:
        case STORAGE_CLASS_REGISTER:
                if (entity->kind == ENTITY_FUNCTION) {
-                       if (entity->function.statement != NULL) {
+                       if (entity->function.body != NULL) {
                                ir_type *owner = get_irg_frame_type(current_ir_graph);
                                (void)get_function_entity(entity, owner);
                                entity->declaration.kind = DECLARATION_KIND_INNER_FUNCTION;
@@ -5110,7 +5110,7 @@ static int get_function_n_local_vars(entity_t *entity)
        count += count_local_variables(function->parameters.entities, NULL);
 
        /* count local variables declared in body */
-       walk_statements(function->statement, count_local_variables_in_stmt, &count);
+       walk_statements(function->body, count_local_variables_in_stmt, &count);
        return count;
 }
 
@@ -5245,7 +5245,7 @@ static void create_function(entity_t *entity)
        assert(entity->kind == ENTITY_FUNCTION);
        ir_entity *function_entity = get_function_entity(entity, current_outer_frame);
 
-       if (entity->function.statement == NULL)
+       if (entity->function.body == NULL)
                return;
 
        inner_functions     = NULL;
@@ -5292,7 +5292,7 @@ static void create_function(entity_t *entity)
        initialize_function_parameters(entity);
        current_static_link = entity->function.static_link;
 
-       statement_to_firm(entity->function.statement);
+       statement_to_firm(entity->function.body);
 
        ir_node *end_block = get_irg_end_block(irg);
 
index 58604dd..877a357 100644 (file)
@@ -245,7 +245,7 @@ struct function_t {
 
        builtin_kind_t btk;
        scope_t        parameters;
-       statement_t   *statement;
+       statement_t   *body;
        symbol_t      *actual_name;        /**< gnu extension __REDIRECT */
 
        /* ast2firm info */
index 128b7f2..6f3fecd 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -4571,8 +4571,7 @@ static void check_declarations(void)
                warn_unused_entity(WARN_UNUSED_PARAMETER, scope->entities, NULL);
        }
        if (is_warn_on(WARN_UNUSED_VARIABLE)) {
-               walk_statements(current_function->statement, check_unused_variables,
-                               NULL);
+               walk_statements(current_function->body, check_unused_variables, NULL);
        }
 }
 
@@ -5267,7 +5266,7 @@ static void parse_external_declaration(void)
                environment_push(parameter);
        }
 
-       if (function->statement != NULL) {
+       if (function->body != NULL) {
                parser_error_multiple_definition(entity, HERE);
                eat_block();
        } else {
@@ -5284,7 +5283,7 @@ static void parse_external_declaration(void)
                label_anchor = &label_first;
 
                statement_t *const body = parse_compound_statement(false);
-               function->statement = body;
+               function->body = body;
                first_err = true;
                check_labels();
                check_declarations();
@@ -9995,7 +9994,7 @@ static void check_unused_globals(void)
                                continue;
 
                        why = WARN_UNUSED_FUNCTION;
-                       s   = entity->function.statement != NULL ? "defined" : "declared";
+                       s   = entity->function.body != NULL ? "defined" : "declared";
                } else {
                        why = WARN_UNUSED_VARIABLE;
                        s   = "defined";
@@ -10231,7 +10230,7 @@ static void complete_incomplete_arrays(void)
 
 static void prepare_main_collect2(entity_t *const entity)
 {
-       PUSH_SCOPE(&entity->function.statement->compound.scope);
+       PUSH_SCOPE(&entity->function.body->compound.scope);
 
        // create call to __main
        symbol_t *symbol         = symbol_table_insert("__main");
@@ -10253,9 +10252,9 @@ static void prepare_main_collect2(entity_t *const entity)
        expr_statement->base.source_position  = builtin_source_position;
        expr_statement->expression.expression = call;
 
-       statement_t *statement = entity->function.statement;
-       assert(statement->kind == STATEMENT_COMPOUND);
-       compound_statement_t *compounds = &statement->compound;
+       statement_t *const body = entity->function.body;
+       assert(body->kind == STATEMENT_COMPOUND);
+       compound_statement_t *compounds = &body->compound;
 
        expr_statement->base.next = compounds->statements;
        compounds->statements     = expr_statement;
diff --git a/walk.c b/walk.c
index 9942903..c3d13ab 100644 (file)
--- a/walk.c
+++ b/walk.c
@@ -243,8 +243,8 @@ static void walk_entity(entity_t *entity, const walk_env_t *const env)
                return;
        case ENTITY_FUNCTION:
                walk_type(entity->declaration.type, env);
-               if (entity->function.statement != NULL)
-                       walk_statement(entity->function.statement, env);
+               if (entity->function.body != NULL)
+                       walk_statement(entity->function.body, env);
                return;
        case ENTITY_COMPOUND_MEMBER:
        case ENTITY_PARAMETER:
index 028adfd..6b5f448 100644 (file)
@@ -260,7 +260,7 @@ static void write_variable(const entity_t *entity)
 
 static void write_function(const entity_t *entity)
 {
-       if (entity->function.statement != NULL) {
+       if (entity->function.body != NULL) {
                fprintf(stderr, "Warning: can't convert function bodies (at %s)\n",
                        entity->base.symbol->string);
        }
index ac8b1a1..5e16edb 100644 (file)
@@ -404,7 +404,7 @@ static void write_variable(const entity_t *entity)
 
 static void write_function(const entity_t *entity)
 {
-       if (entity->function.statement != NULL) {
+       if (entity->function.body != NULL) {
                fprintf(stderr, "Warning: can't convert function bodies (at %s)\n",
                        entity->base.symbol->string);
                return;