@@ -19,21 +19,21 @@ void print_struct_alignment_problems(
19
19
const symbol_tablet &symbol_table,
20
20
std::ostream &out)
21
21
{
22
- forall_symbols (it, symbol_table.symbols )
23
- if (it->second .is_type && it->second .type .id ()==ID_struct)
22
+ for (const auto &symbol_pair : symbol_table.symbols )
23
+ {
24
+ if (symbol_pair.second .is_type && symbol_pair.second .type .id () == ID_struct)
24
25
{
25
- const struct_typet &str= to_struct_type (it-> second .type );
26
- const struct_typet::componentst &components= str.components ();
26
+ const struct_typet &str = to_struct_type (symbol_pair. second .type );
27
+ const struct_typet::componentst &components = str.components ();
27
28
28
- bool first_time_seen_in_struct= true ;
29
+ bool first_time_seen_in_struct = true ;
29
30
30
- for (struct_typet::componentst::const_iterator
31
- it_mem=components.begin ();
32
- it_mem!=components.end ();
31
+ for (struct_typet::componentst::const_iterator it_mem = components.begin ();
32
+ it_mem != components.end ();
33
33
it_mem++)
34
34
{
35
- mp_integer cumulated_length= 0 ;
36
- bool first_time_seen_from= true ;
35
+ mp_integer cumulated_length = 0 ;
36
+ bool first_time_seen_from = true ;
37
37
38
38
// if the instruction cannot be aligned to the address,
39
39
// try the next one
@@ -42,40 +42,39 @@ void print_struct_alignment_problems(
42
42
// || alignment(it_mem->type())%config.ansi_c.alignment!=0)
43
43
continue ;
44
44
45
- for (struct_typet::componentst::const_iterator
46
- it_next=it_mem;
47
- it_next!=components.end ();
45
+ for (struct_typet::componentst::const_iterator it_next = it_mem;
46
+ it_next != components.end ();
48
47
it_next++)
49
48
{
50
- const typet &it_type= it_next->type ();
49
+ const typet &it_type = it_next->type ();
51
50
const namespacet ns (symbol_table);
52
- mp_integer size= pointer_offset_size (it_type, ns);
51
+ mp_integer size = pointer_offset_size (it_type, ns);
53
52
54
- if (size< 0 )
55
- throw " type of unknown size:\n " + it_type.pretty ();
53
+ if (size < 0 )
54
+ throw " type of unknown size:\n " + it_type.pretty ();
56
55
57
- cumulated_length+= size;
56
+ cumulated_length += size;
58
57
// [it_mem;it_next] cannot be covered by an instruction
59
- if (cumulated_length> config.ansi_c .memory_operand_size )
58
+ if (cumulated_length > config.ansi_c .memory_operand_size )
60
59
{
61
60
// if interferences have been found, no need to check with
62
61
// starting from an already covered member
63
62
if (!first_time_seen_from)
64
- it_mem= it_next- 1 ;
63
+ it_mem = it_next - 1 ;
65
64
break ;
66
65
}
67
66
68
- if (it_mem!= it_next && !it_next->get_is_padding ())
67
+ if (it_mem != it_next && !it_next->get_is_padding ())
69
68
{
70
69
if (first_time_seen_in_struct)
71
70
{
72
- first_time_seen_in_struct= false ;
73
- first_time_seen_from= false ;
71
+ first_time_seen_in_struct = false ;
72
+ first_time_seen_from = false ;
74
73
75
74
out << " \n WARNING: "
76
75
<< " declaration of structure "
77
- << str.find_type (ID_tag).pretty ()
78
- << " at " << it-> second .location << ' \n ' ;
76
+ << str.find_type (ID_tag).pretty () << " at "
77
+ << symbol_pair. second .location << ' \n ' ;
79
78
}
80
79
81
80
out << " members " << it_mem->get_pretty_name () << " and "
@@ -84,12 +83,12 @@ void print_struct_alignment_problems(
84
83
}
85
84
}
86
85
}
87
- else if (it-> second .type .id ()== ID_array)
86
+ else if (symbol_pair. second .type .id () == ID_array)
88
87
{
89
88
// is this structure likely to introduce data races?
90
89
#if 0
91
90
const namespacet ns(symbol_table);
92
- const array_typet array=to_array_type(it-> second.type);
91
+ const array_typet array=to_array_type(symbol_pair. second.type);
93
92
const mp_integer size=
94
93
pointer_offset_size(array.subtype(), ns);
95
94
@@ -100,9 +99,10 @@ void print_struct_alignment_problems(
100
99
{
101
100
out << "\nWARNING: "
102
101
<< "declaration of an array at "
103
- << it-> second.location <<
102
+ << symbol_pair. second.location <<
104
103
<< "\nmight be concurrently accessed\n";
105
104
}
106
105
#endif
107
106
}
107
+ }
108
108
}
0 commit comments