@@ -13,18 +13,12 @@ Author: Daniel Kroening, kroening@kroening.com
13
13
14
14
#include < util/c_types.h>
15
15
#include < util/config.h>
16
- #include < util/std_types.h>
16
+ #include < util/message.h>
17
+ #include < util/pointer_expr.h>
17
18
#include < util/string_constant.h>
18
19
19
20
#include " gcc_types.h"
20
21
21
- void ansi_c_convert_typet::read (const typet &type)
22
- {
23
- clear ();
24
- source_location=type.source_location ();
25
- read_rec (type);
26
- }
27
-
28
22
void ansi_c_convert_typet::read_rec (const typet &type)
29
23
{
30
24
if (type.id ()==ID_merged_type)
@@ -266,6 +260,8 @@ void ansi_c_convert_typet::read_rec(const typet &type)
266
260
267
261
void ansi_c_convert_typet::write (typet &type)
268
262
{
263
+ messaget log{message_handler};
264
+
269
265
type.clear ();
270
266
271
267
// first, do "other"
@@ -282,8 +278,8 @@ void ansi_c_convert_typet::write(typet &type)
282
278
gcc_float128_cnt || gcc_float128x_cnt ||
283
279
gcc_int128_cnt || bv_cnt)
284
280
{
285
- error ().source_location = source_location;
286
- error () << " illegal type modifier for defined type" << eom;
281
+ log. error ().source_location = source_location;
282
+ log. error () << " illegal type modifier for defined type" << messaget:: eom;
287
283
throw 0 ;
288
284
}
289
285
@@ -298,8 +294,8 @@ void ansi_c_convert_typet::write(typet &type)
298
294
299
295
if (other.size ()!=1 )
300
296
{
301
- error ().source_location = source_location;
302
- error () << " illegal combination of defined types" << eom;
297
+ log. error ().source_location = source_location;
298
+ log. error () << " illegal combination of defined types" << messaget:: eom;
303
299
throw 0 ;
304
300
}
305
301
@@ -319,9 +315,9 @@ void ansi_c_convert_typet::write(typet &type)
319
315
{
320
316
if (constructor && destructor)
321
317
{
322
- error ().source_location = source_location;
323
- error () << " combining constructor and destructor not supported"
324
- << eom;
318
+ log. error ().source_location = source_location;
319
+ log. error () << " combining constructor and destructor not supported"
320
+ << messaget:: eom;
325
321
throw 0 ;
326
322
}
327
323
@@ -331,9 +327,9 @@ void ansi_c_convert_typet::write(typet &type)
331
327
332
328
else if (type_p->id ()!=ID_empty)
333
329
{
334
- error ().source_location = source_location;
335
- error () << " constructor and destructor required to be type void, "
336
- << " found " << type_p->pretty () << eom;
330
+ log. error ().source_location = source_location;
331
+ log. error () << " constructor and destructor required to be type void, "
332
+ << " found " << type_p->pretty () << messaget:: eom;
337
333
throw 0 ;
338
334
}
339
335
@@ -342,9 +338,9 @@ void ansi_c_convert_typet::write(typet &type)
342
338
}
343
339
else if (constructor || destructor)
344
340
{
345
- error ().source_location = source_location;
346
- error () << " constructor and destructor required to be type void, "
347
- << " found " << type.pretty () << eom;
341
+ log. error ().source_location = source_location;
342
+ log. error () << " constructor and destructor required to be type void, "
343
+ << " found " << type.pretty () << messaget:: eom;
348
344
throw 0 ;
349
345
}
350
346
else if (gcc_float16_cnt ||
@@ -357,8 +353,9 @@ void ansi_c_convert_typet::write(typet &type)
357
353
gcc_int128_cnt || bv_cnt ||
358
354
short_cnt || char_cnt)
359
355
{
360
- error ().source_location =source_location;
361
- error () << " cannot combine integer type with floating-point type" << eom;
356
+ log.error ().source_location = source_location;
357
+ log.error () << " cannot combine integer type with floating-point type"
358
+ << messaget::eom;
362
359
throw 0 ;
363
360
}
364
361
@@ -368,8 +365,8 @@ void ansi_c_convert_typet::write(typet &type)
368
365
gcc_float64_cnt+gcc_float64x_cnt+
369
366
gcc_float128_cnt+gcc_float128x_cnt>=2 )
370
367
{
371
- error ().source_location = source_location;
372
- error () << " conflicting type modifiers" << eom;
368
+ log. error ().source_location = source_location;
369
+ log. error () << " conflicting type modifiers" << messaget:: eom;
373
370
throw 0 ;
374
371
}
375
372
@@ -398,15 +395,16 @@ void ansi_c_convert_typet::write(typet &type)
398
395
gcc_int128_cnt|| bv_cnt ||
399
396
short_cnt || char_cnt)
400
397
{
401
- error ().source_location =source_location;
402
- error () << " cannot combine integer type with floating-point type" << eom;
398
+ log.error ().source_location = source_location;
399
+ log.error () << " cannot combine integer type with floating-point type"
400
+ << messaget::eom;
403
401
throw 0 ;
404
402
}
405
403
406
404
if (double_cnt && float_cnt)
407
405
{
408
- error ().source_location = source_location;
409
- error () << " conflicting type modifiers" << eom;
406
+ log. error ().source_location = source_location;
407
+ log. error () << " conflicting type modifiers" << messaget:: eom;
410
408
throw 0 ;
411
409
}
412
410
@@ -423,15 +421,15 @@ void ansi_c_convert_typet::write(typet &type)
423
421
type=long_double_type ();
424
422
else
425
423
{
426
- error ().source_location = source_location;
427
- error () << " conflicting type modifiers" << eom;
424
+ log. error ().source_location = source_location;
425
+ log. error () << " conflicting type modifiers" << messaget:: eom;
428
426
throw 0 ;
429
427
}
430
428
}
431
429
else
432
430
{
433
- error ().source_location = source_location;
434
- error () << " illegal type modifier for float" << eom;
431
+ log. error ().source_location = source_location;
432
+ log. error () << " illegal type modifier for float" << messaget:: eom;
435
433
throw 0 ;
436
434
}
437
435
}
@@ -442,8 +440,9 @@ void ansi_c_convert_typet::write(typet &type)
442
440
gcc_float128_cnt || bv_cnt || proper_bool_cnt ||
443
441
char_cnt || long_cnt)
444
442
{
445
- error ().source_location =source_location;
446
- error () << " illegal type modifier for C boolean type" << eom;
443
+ log.error ().source_location = source_location;
444
+ log.error () << " illegal type modifier for C boolean type"
445
+ << messaget::eom;
447
446
throw 0 ;
448
447
}
449
448
@@ -456,8 +455,9 @@ void ansi_c_convert_typet::write(typet &type)
456
455
gcc_float128_cnt || bv_cnt ||
457
456
char_cnt || long_cnt)
458
457
{
459
- error ().source_location =source_location;
460
- error () << " illegal type modifier for proper boolean type" << eom;
458
+ log.error ().source_location = source_location;
459
+ log.error () << " illegal type modifier for proper boolean type"
460
+ << messaget::eom;
461
461
throw 0 ;
462
462
}
463
463
@@ -475,15 +475,15 @@ void ansi_c_convert_typet::write(typet &type)
475
475
int8_cnt || int16_cnt || int32_cnt || int64_cnt ||
476
476
gcc_float128_cnt || bv_cnt || proper_bool_cnt)
477
477
{
478
- error ().source_location = source_location;
479
- error () << " illegal type modifier for char type" << eom;
478
+ log. error ().source_location = source_location;
479
+ log. error () << " illegal type modifier for char type" << messaget:: eom;
480
480
throw 0 ;
481
481
}
482
482
483
483
if (signed_cnt && unsigned_cnt)
484
484
{
485
- error ().source_location = source_location;
486
- error () << " conflicting type modifiers" << eom;
485
+ log. error ().source_location = source_location;
486
+ log. error () << " conflicting type modifiers" << messaget:: eom;
487
487
throw 0 ;
488
488
}
489
489
else if (unsigned_cnt)
@@ -501,8 +501,8 @@ void ansi_c_convert_typet::write(typet &type)
501
501
502
502
if (signed_cnt && unsigned_cnt)
503
503
{
504
- error ().source_location = source_location;
505
- error () << " conflicting type modifiers" << eom;
504
+ log. error ().source_location = source_location;
505
+ log. error () << " conflicting type modifiers" << messaget:: eom;
506
506
throw 0 ;
507
507
}
508
508
else if (unsigned_cnt)
@@ -514,8 +514,8 @@ void ansi_c_convert_typet::write(typet &type)
514
514
{
515
515
if (long_cnt || char_cnt || short_cnt || gcc_int128_cnt || bv_cnt)
516
516
{
517
- error ().source_location = source_location;
518
- error () << " conflicting type modifiers" << eom;
517
+ log. error ().source_location = source_location;
518
+ log. error () << " conflicting type modifiers" << messaget:: eom;
519
519
throw 0 ;
520
520
}
521
521
@@ -571,8 +571,8 @@ void ansi_c_convert_typet::write(typet &type)
571
571
{
572
572
if (long_cnt || char_cnt)
573
573
{
574
- error ().source_location = source_location;
575
- error () << " conflicting type modifiers" << eom;
574
+ log. error ().source_location = source_location;
575
+ log. error () << " conflicting type modifiers" << messaget:: eom;
576
576
throw 0 ;
577
577
}
578
578
@@ -604,8 +604,8 @@ void ansi_c_convert_typet::write(typet &type)
604
604
}
605
605
else
606
606
{
607
- error ().source_location = source_location;
608
- error () << " illegal type modifier for integer type" << eom;
607
+ log. error ().source_location = source_location;
608
+ log. error () << " illegal type modifier for integer type" << messaget:: eom;
609
609
throw 0 ;
610
610
}
611
611
}
0 commit comments