@@ -140,8 +140,6 @@ bool c_typecheck_baset::gcc_types_compatible_p(
140
140
if (type1.id ()==ID_c_enum)
141
141
{
142
142
if (type2.id ()==ID_c_enum) // both are enums
143
- // We don't need to remove the typedef flag here since as it is an enum
144
- // we have already followed the enum tag to get to the underlying enum
145
143
return type1==type2; // compares the tag
146
144
else if (type2==type1.subtype ())
147
145
return true ;
@@ -186,13 +184,12 @@ bool c_typecheck_baset::gcc_types_compatible_p(
186
184
}
187
185
else
188
186
{
189
- if (are_types_equal_ignoring_typedef ( type1, type2) )
187
+ if (type1== type2)
190
188
{
191
189
// Need to distinguish e.g. long int from int or
192
190
// long long int from long int.
193
191
// The rules appear to match those of C++.
194
- // Isn't this explictly handled by checking type1==type2 (since
195
- // operator== recursively checks all sub types).
192
+
196
193
if (type1.get (ID_C_c_type)==type2.get (ID_C_c_type))
197
194
return true ;
198
195
}
@@ -203,38 +200,6 @@ bool c_typecheck_baset::gcc_types_compatible_p(
203
200
204
201
/* ******************************************************************\
205
202
206
- Function: c_typecheck_baset::are_types_equal_ignoring_typedef
207
-
208
- Inputs:
209
- type1 - the first type to compare
210
- type2 - the second type to compare
211
-
212
- Outputs: True if the types are equal
213
-
214
- Purpose: To check whether two types are equal, ignoring if they have a
215
- different typedef tag. We do this by explictly removing the
216
- ID_C_typedef from the type before comparing. Then we just use
217
- operator== to compare the resultant types.
218
-
219
- \*******************************************************************/
220
- bool c_typecheck_baset::are_types_equal_ignoring_typedef (
221
- const typet type1, const typet &type2)
222
- {
223
- typet non_typedefd_type1=type1;
224
- typet non_typedefd_type2=type2;
225
- if (type1.get (ID_C_typedef)!=ID_nil)
226
- {
227
- non_typedefd_type1.remove (ID_C_typedef);
228
- }
229
- if (type2.get (ID_C_typedef)!=ID_nil)
230
- {
231
- non_typedefd_type2.remove (ID_C_typedef);
232
- }
233
- return non_typedefd_type1==non_typedefd_type2;
234
- }
235
-
236
- /* ******************************************************************\
237
-
238
203
Function: c_typecheck_baset::typecheck_expr_main
239
204
240
205
Inputs:
0 commit comments