equal
deleted
inserted
replaced
39 #include "narrow_candidate_datatypes.hh" |
39 #include "narrow_candidate_datatypes.hh" |
40 #include "forced_narrow_candidate_datatypes.hh" |
40 #include "forced_narrow_candidate_datatypes.hh" |
41 #include "print_datatypes_error.hh" |
41 #include "print_datatypes_error.hh" |
42 #include "lvalue_check.hh" |
42 #include "lvalue_check.hh" |
43 #include "array_range_check.hh" |
43 #include "array_range_check.hh" |
|
44 #include "case_elements_check.hh" |
44 #include "constant_folding.hh" |
45 #include "constant_folding.hh" |
45 #include "declaration_check.hh" |
46 #include "declaration_check.hh" |
46 #include "enum_declaration_check.hh" |
47 #include "enum_declaration_check.hh" |
47 #include "remove_forward_dependencies.hh" |
48 #include "remove_forward_dependencies.hh" |
48 |
49 |
124 tree_root->accept(array_range_check); |
125 tree_root->accept(array_range_check); |
125 return array_range_check.get_error_count(); |
126 return array_range_check.get_error_count(); |
126 } |
127 } |
127 |
128 |
128 |
129 |
|
130 /* Case options check assumes that constant folding has been completed! |
|
131 * so be sure to call constant_folding() before calling this function! |
|
132 */ |
|
133 static int case_elements_check(symbol_c *tree_root){ |
|
134 case_elements_check_c case_elements_check(tree_root); |
|
135 tree_root->accept(case_elements_check); |
|
136 return case_elements_check.get_error_count(); |
|
137 } |
|
138 |
129 |
139 |
130 /* Removing forward dependencies only makes sense when stage1_2 is run with the pre-parsing option. |
140 /* Removing forward dependencies only makes sense when stage1_2 is run with the pre-parsing option. |
131 * This algorithm has no dependencies on other stage 3 algorithms. |
141 * This algorithm has no dependencies on other stage 3 algorithms. |
132 * Typically this is run last, just to show that the remaining algorithms also do not depend on the fact that |
142 * Typically this is run last, just to show that the remaining algorithms also do not depend on the fact that |
133 * the library_c (i.e. the source code) does not contain forward dependencies. |
143 * the library_c (i.e. the source code) does not contain forward dependencies. |
152 error_count += constant_propagation(tree_root); |
162 error_count += constant_propagation(tree_root); |
153 error_count += declaration_safety(tree_root); |
163 error_count += declaration_safety(tree_root); |
154 error_count += type_safety(tree_root); |
164 error_count += type_safety(tree_root); |
155 error_count += lvalue_check(tree_root); |
165 error_count += lvalue_check(tree_root); |
156 error_count += array_range_check(tree_root); |
166 error_count += array_range_check(tree_root); |
|
167 error_count += case_elements_check(tree_root); |
157 error_count += remove_forward_dependencies(tree_root, ordered_tree_root); |
168 error_count += remove_forward_dependencies(tree_root, ordered_tree_root); |
158 |
169 |
159 if (error_count > 0) { |
170 if (error_count > 0) { |
160 fprintf(stderr, "%d error(s) found. Bailing out!\n", error_count); |
171 fprintf(stderr, "%d error(s) found. Bailing out!\n", error_count); |
161 return -1; |
172 return -1; |