firm_vrfy_failure_msg = #expr " && " string; \
return (ret); \
} \
-} while(0)
+} while (0)
#define ASSERT_AND_RET_DBG(expr, string, ret, blk) \
do { \
} \
return (ret); \
} \
-} while(0)
+} while (0)
#endif /* NDEBUG */
* Show diagnostic if an entity overwrites another one not
* in direct superclasses.
*/
-static void show_ent_not_supertp(ir_entity *ent, ir_entity *ovw) {
+static void show_ent_not_supertp(ir_entity *ent, ir_entity *ovw)
+{
ir_type *owner = get_entity_owner(ent);
ir_type *ov_own = get_entity_owner(ovw);
int i;
/**
* Show diagnostic if an entity overwrites a wrong number of things.
*/
-static void show_ent_overwrite_cnt(ir_entity *ent) {
+static void show_ent_overwrite_cnt(ir_entity *ent)
+{
ir_type *owner = get_entity_owner(ent);
int i, j, k, found, show_stp = 0;
/**
* Check a class
*/
-static int check_class(ir_type *tp) {
+static int check_class(ir_type *tp)
+{
int i, j, k;
int found;
/**
* Check an array.
*/
-static int check_array(ir_type *tp) {
+static int check_array(ir_type *tp)
+{
int i, n_dim = get_array_n_dimensions(tp);
for (i = 0; i < n_dim; ++i) {
/**
* Check a primitive.
*/
-static int check_primitive(ir_type *tp) {
+static int check_primitive(ir_type *tp)
+{
ASSERT_AND_RET_DBG(
is_mode(get_type_mode(tp)),
"Primitive type without mode",
* return
* 0 if no error encountered
*/
-int check_type(ir_type *tp) {
+int check_type(ir_type *tp)
+{
switch (get_type_tpop_code(tp)) {
case tpo_class:
return check_class(tp);
/**
* checks the visited flag
*/
-static int check_visited_flag(ir_graph *irg, ir_node *n) {
+static int check_visited_flag(ir_graph *irg, ir_node *n)
+{
ASSERT_AND_RET_DBG(
get_irn_visited(n) <= get_irg_visited(irg),
"Visited flag of node is larger than that of corresponding irg.",
/**
* called by the walker
*/
-static void on_irg_storage(ir_node *n, void *env) {
+static void on_irg_storage(ir_node *n, void *env)
+{
struct myenv *myenv = env;
/* We also test whether the setting of the visited flag is legal. */
/*
* 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.ent);
if (is_type(tore.typ)) {
int res = no_error;
ir_type *constructors;
ir_type *destructors;
+ ir_type *thread_locals;
int i;
static ident *empty = NULL;
constructors = get_segment_type(IR_SEGMENT_CONSTRUCTORS);
for (i = get_compound_n_members(constructors)-1; i >= 0; --i) {
- ir_entity *entity = get_compound_member(constructors, i);
+ const ir_entity *entity = get_compound_member(constructors, i);
ASSERT_AND_RET(get_entity_linkage(entity) & IR_LINKAGE_HIDDEN_USER,
"entity without LINKAGE_HIDDEN_USER in constructors is pointless",
1);
/* Mach-O doesn't like labels in this section */
ASSERT_AND_RET(get_entity_ld_ident(entity),
- "entity in constructors should have ld_ident ''", 1);
+ "entity in constructors should have ld_ident=''", 1);
}
destructors = get_segment_type(IR_SEGMENT_DESTRUCTORS);
for (i = get_compound_n_members(destructors)-1; i >= 0; --i) {
- ir_entity *entity = get_compound_member(destructors, i);
+ const ir_entity *entity = get_compound_member(destructors, i);
ASSERT_AND_RET(get_entity_linkage(entity) & IR_LINKAGE_HIDDEN_USER,
"entity without LINKAGE_HIDDEN_USER in destructors is pointless",
1);
/* Mach-O doesn't like labels in this section */
ASSERT_AND_RET(get_entity_ld_ident(entity),
- "entity in destructors should have ld_ident ''", 1);
+ "entity in destructors should have ld_ident=''", 1);
+ }
+ thread_locals = get_segment_type(IR_SEGMENT_THREAD_LOCAL);
+ for (i = get_compound_n_members(thread_locals)-1; i >= 0; --i) {
+ const ir_entity *entity = get_compound_member(thread_locals, i);
+ /* this is odd and should not be allowed I think */
+ ASSERT_AND_RET(!is_method_entity(entity),
+ "method in THREAD_LOCAL segment", 1);
+ ASSERT_AND_RET(! (get_entity_linkage(entity) & IR_LINKAGE_CONSTANT),
+ "thread locals must not be constant", 1);
}
return res;