- get_Block_cfgpred_arr() IS supported, but should not be in the official
[libfirm] / ir / tr / trvrfy.c
index 80836c9..301ea9a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
+ * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
  *
  * This file is part of libFirm.
  *
@@ -24,9 +24,7 @@
  * @author  Michael Beck, Goetz Lindenmaier
  * @version $Id$
  */
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include "irgraph_t.h"  /* for checking whether constant code is allocated
                            on proper obstack */
@@ -34,7 +32,6 @@
 #include "irprintf.h"
 #include "irgwalk.h"
 
-static const char *firm_vrfy_failure_msg;
 
 #ifdef NDEBUG
 /*
@@ -77,6 +74,10 @@ do { \
 
 #endif /* NDEBUG */
 
+#ifndef NDEBUG
+
+static const char *firm_vrfy_failure_msg;
+
 /**
  * Show diagnostic if an entity overwrites another one not
  * in direct superclasses.
@@ -137,6 +138,17 @@ static void show_ent_overwrite_cnt(ir_entity *ent) {
        }
 }
 
+/**
+ * Shows a wrong entity allocation
+ */
+static void show_ent_alloc_error(ir_entity *ent) {
+       ir_fprintf(stderr, "%+e owner %t has allocation %s\n",
+               ent, get_entity_type(ent),
+               get_allocation_name(get_entity_allocation(ent)));
+}
+
+#endif /* #ifndef NDEBUG */
+
 /**
  * Check a class
  */
@@ -297,10 +309,12 @@ static int constants_on_wrong_irg(ir_entity *ent) {
        if (get_entity_variability(ent) == variability_uninitialized) return 0;
 
        if (is_compound_entity(ent)) {
-               int i;
-               for (i = get_compound_ent_n_values(ent) - 1; i >= 0; --i) {
-                       if (constant_on_wrong_irg(get_compound_ent_value(ent, i)))
-                               return 1;
+               if(!ent->has_initializer) {
+                       int i;
+                       for (i = get_compound_ent_n_values(ent) - 1; i >= 0; --i) {
+                               if (constant_on_wrong_irg(get_compound_ent_value(ent, i)))
+                                       return 1;
+                       }
                }
        } else {
                /* Might not be set if entity belongs to a description or is external allocated. */
@@ -319,15 +333,6 @@ static int constants_on_wrong_irg(ir_entity *ent) {
        return 0;
 }
 
-/**
- * Shows a wrong entity allocation
- */
-static void show_ent_alloc_error(ir_entity *ent) {
-       ir_fprintf(stderr, "%+e owner %t has allocation %s\n",
-               ent, get_entity_type(ent),
-               get_allocation_name(get_entity_allocation(ent)));
-}
-
 /*
  * Check an entity. Currently, we check only if initialized constants
  * are build on the const irg graph.
@@ -410,14 +415,14 @@ int check_entity(ir_entity *ent) {
 /*
  * check types and entities
  */
-static void check_tore(type_or_ent *tore, void *env) {
+static void check_tore(type_or_ent tore, void *env) {
        int *res = env;
-       assert(tore);
-       if (is_type(tore)) {
-               *res = check_type((ir_type *)tore);
+       assert(tore.ent);
+       if (is_type(tore.typ)) {
+               *res = check_type(tore.typ);
        } else {
-               assert(is_entity(tore));
-               *res = check_entity((ir_entity *)tore);
+               assert(is_entity(tore.ent));
+               *res = check_entity(tore.ent);
        }
 }