Bugfix
[libfirm] / ir / be / beasm_dump_globals.c
index 77b17a5..6a82367 100644 (file)
@@ -4,6 +4,15 @@
  * @date 19.01.2005
  */
 
+#include <ctype.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "irprog_t.h"
+#include "type.h"
+#include "xmalloc.h"
+
+
 #include "beasm_dump_globals.h"
 
 
@@ -200,8 +209,10 @@ static void asm_dump_global ( assembler_t *assembler, entity *ent)
 {
   type *ty            = get_entity_type(ent);
   const char *ld_name = get_entity_ld_name(ent);
-  int align, is_constant, h;
-  int i,j,size = 0;
+  int align, /*is_constant,*/ h;
+  int i, /*j,*/ size = 0;
+  ent_variability variability;
+  visibility  visibility;
 
   asm_segment_t target_segment = ASM_SEGMENT_DATA_INIT;
 
@@ -210,19 +221,19 @@ static void asm_dump_global ( assembler_t *assembler, entity *ent)
    */
 
   /* ignore methods, they are emitted later */
-  if(is_Method_type(ty))
+  if (is_Method_type(ty))
          return;
 
   /* get the properties of the entity */
-  ent_variability variability = get_entity_variability(ent);
-  ent_visibility  visibility  = get_entity_visibility(ent);
+  variability = get_entity_variability(ent);
+  visibility  = get_entity_visibility(ent);
 
   if (variability == variability_constant) {
      /* a constant entity, put it into the const segment */
      target_segment = ASM_SEGMENT_CONST;
   }
 
-  /* check, wether it is initialized, if yes create data */
+  /* check, whether it is initialized, if yes create data */
   if (variability != variability_uninitialized ) {
 
 /*     if (visibility == visibility_external_visible) {
@@ -299,22 +310,22 @@ static void asm_dump_global ( assembler_t *assembler, entity *ent)
                 */
 
                type_size = get_type_size_bytes(ty);
-               vals      = calloc(type_size, sizeof(*vals));
+               vals      = xcalloc(type_size, sizeof(*vals));
 
                /* collect the values and store them at the offsets */
                for(i = 0; i < get_compound_ent_n_values(ent); ++i) {
-                   int graph_length, aipos, offset, stepsize;
+                 int graph_length, aipos, offset/*, stepsize*/;
                    struct arr_info *ai;
-                   int found                 = 0;
+                   /*int found                 = 0;*/
                    int all_n                 = 1;
-                   entity *member            = get_compound_ent_value_member(ent, i);
+                   /*entity *member            = get_compound_ent_value_member(ent, i); */
                    compound_graph_path *path = get_compound_ent_value_path(ent, i);
                    entity *node              = get_compound_graph_path_node(path, 0);
-                   type *node_type           = get_entity_type(node);
+                   /*type *node_type           = get_entity_type(node);*/
 
                    /* get the access path to the costant value */
                    graph_length = get_compound_graph_path_length(path);
-                   ai = calloc(graph_length, sizeof(struct arr_info));
+                   ai = xcalloc(graph_length, sizeof(struct arr_info));
 
                    /* We wanna know how many arrays are on the path to the entity. We also have to know how
                     * many elements each array holds to calculate the offset for the entity. */