@@ -19,13 +19,6 @@ Author: Daniel Kroening, kroening@kroening.com
19
19
20
20
#include " gcc_types.h"
21
21
22
- void ansi_c_convert_typet::read (const typet &type)
23
- {
24
- clear ();
25
- source_location=type.source_location ();
26
- read_rec (type);
27
- }
28
-
29
22
void ansi_c_convert_typet::read_rec (const typet &type)
30
23
{
31
24
if (type.id ()==ID_merged_type)
@@ -299,6 +292,8 @@ void ansi_c_convert_typet::read_rec(const typet &type)
299
292
300
293
void ansi_c_convert_typet::write (typet &type)
301
294
{
295
+ messaget log{message_handler};
296
+
302
297
type.clear ();
303
298
304
299
// first, do "other"
@@ -315,8 +310,8 @@ void ansi_c_convert_typet::write(typet &type)
315
310
gcc_float128_cnt || gcc_float128x_cnt ||
316
311
gcc_int128_cnt || bv_cnt)
317
312
{
318
- error ().source_location = source_location;
319
- error () << " illegal type modifier for defined type" << eom;
313
+ log. error ().source_location = source_location;
314
+ log. error () << " illegal type modifier for defined type" << messaget:: eom;
320
315
throw 0 ;
321
316
}
322
317
@@ -331,8 +326,8 @@ void ansi_c_convert_typet::write(typet &type)
331
326
332
327
if (other.size ()!=1 )
333
328
{
334
- error ().source_location = source_location;
335
- error () << " illegal combination of defined types" << eom;
329
+ log. error ().source_location = source_location;
330
+ log. error () << " illegal combination of defined types" << messaget:: eom;
336
331
throw 0 ;
337
332
}
338
333
@@ -363,9 +358,9 @@ void ansi_c_convert_typet::write(typet &type)
363
358
{
364
359
if (constructor && destructor)
365
360
{
366
- error ().source_location = source_location;
367
- error () << " combining constructor and destructor not supported"
368
- << eom;
361
+ log. error ().source_location = source_location;
362
+ log. error () << " combining constructor and destructor not supported"
363
+ << messaget:: eom;
369
364
throw 0 ;
370
365
}
371
366
@@ -375,9 +370,9 @@ void ansi_c_convert_typet::write(typet &type)
375
370
376
371
else if (type_p->id ()!=ID_empty)
377
372
{
378
- error ().source_location = source_location;
379
- error () << " constructor and destructor required to be type void, "
380
- << " found " << type_p->pretty () << eom;
373
+ log. error ().source_location = source_location;
374
+ log. error () << " constructor and destructor required to be type void, "
375
+ << " found " << type_p->pretty () << messaget:: eom;
381
376
throw 0 ;
382
377
}
383
378
@@ -386,9 +381,9 @@ void ansi_c_convert_typet::write(typet &type)
386
381
}
387
382
else if (constructor || destructor)
388
383
{
389
- error ().source_location = source_location;
390
- error () << " constructor and destructor required to be type void, "
391
- << " found " << type.pretty () << eom;
384
+ log. error ().source_location = source_location;
385
+ log. error () << " constructor and destructor required to be type void, "
386
+ << " found " << type.pretty () << messaget:: eom;
392
387
throw 0 ;
393
388
}
394
389
else if (gcc_float16_cnt ||
@@ -401,8 +396,9 @@ void ansi_c_convert_typet::write(typet &type)
401
396
gcc_int128_cnt || bv_cnt ||
402
397
short_cnt || char_cnt)
403
398
{
404
- error ().source_location =source_location;
405
- error () << " cannot combine integer type with floating-point type" << eom;
399
+ log.error ().source_location = source_location;
400
+ log.error () << " cannot combine integer type with floating-point type"
401
+ << messaget::eom;
406
402
throw 0 ;
407
403
}
408
404
@@ -412,8 +408,8 @@ void ansi_c_convert_typet::write(typet &type)
412
408
gcc_float64_cnt+gcc_float64x_cnt+
413
409
gcc_float128_cnt+gcc_float128x_cnt>=2 )
414
410
{
415
- error ().source_location = source_location;
416
- error () << " conflicting type modifiers" << eom;
411
+ log. error ().source_location = source_location;
412
+ log. error () << " conflicting type modifiers" << messaget:: eom;
417
413
throw 0 ;
418
414
}
419
415
@@ -442,15 +438,16 @@ void ansi_c_convert_typet::write(typet &type)
442
438
gcc_int128_cnt|| bv_cnt ||
443
439
short_cnt || char_cnt)
444
440
{
445
- error ().source_location =source_location;
446
- error () << " cannot combine integer type with floating-point type" << eom;
441
+ log.error ().source_location = source_location;
442
+ log.error () << " cannot combine integer type with floating-point type"
443
+ << messaget::eom;
447
444
throw 0 ;
448
445
}
449
446
450
447
if (double_cnt && float_cnt)
451
448
{
452
- error ().source_location = source_location;
453
- error () << " conflicting type modifiers" << eom;
449
+ log. error ().source_location = source_location;
450
+ log. error () << " conflicting type modifiers" << messaget:: eom;
454
451
throw 0 ;
455
452
}
456
453
@@ -467,15 +464,15 @@ void ansi_c_convert_typet::write(typet &type)
467
464
type=long_double_type ();
468
465
else
469
466
{
470
- error ().source_location = source_location;
471
- error () << " conflicting type modifiers" << eom;
467
+ log. error ().source_location = source_location;
468
+ log. error () << " conflicting type modifiers" << messaget:: eom;
472
469
throw 0 ;
473
470
}
474
471
}
475
472
else
476
473
{
477
- error ().source_location = source_location;
478
- error () << " illegal type modifier for float" << eom;
474
+ log. error ().source_location = source_location;
475
+ log. error () << " illegal type modifier for float" << messaget:: eom;
479
476
throw 0 ;
480
477
}
481
478
}
@@ -486,8 +483,9 @@ void ansi_c_convert_typet::write(typet &type)
486
483
gcc_float128_cnt || bv_cnt || proper_bool_cnt ||
487
484
char_cnt || long_cnt)
488
485
{
489
- error ().source_location =source_location;
490
- error () << " illegal type modifier for C boolean type" << eom;
486
+ log.error ().source_location = source_location;
487
+ log.error () << " illegal type modifier for C boolean type"
488
+ << messaget::eom;
491
489
throw 0 ;
492
490
}
493
491
@@ -500,8 +498,9 @@ void ansi_c_convert_typet::write(typet &type)
500
498
gcc_float128_cnt || bv_cnt ||
501
499
char_cnt || long_cnt)
502
500
{
503
- error ().source_location =source_location;
504
- error () << " illegal type modifier for proper boolean type" << eom;
501
+ log.error ().source_location = source_location;
502
+ log.error () << " illegal type modifier for proper boolean type"
503
+ << messaget::eom;
505
504
throw 0 ;
506
505
}
507
506
@@ -519,15 +518,15 @@ void ansi_c_convert_typet::write(typet &type)
519
518
int8_cnt || int16_cnt || int32_cnt || int64_cnt ||
520
519
gcc_float128_cnt || bv_cnt || proper_bool_cnt)
521
520
{
522
- error ().source_location = source_location;
523
- error () << " illegal type modifier for char type" << eom;
521
+ log. error ().source_location = source_location;
522
+ log. error () << " illegal type modifier for char type" << messaget:: eom;
524
523
throw 0 ;
525
524
}
526
525
527
526
if (signed_cnt && unsigned_cnt)
528
527
{
529
- error ().source_location = source_location;
530
- error () << " conflicting type modifiers" << eom;
528
+ log. error ().source_location = source_location;
529
+ log. error () << " conflicting type modifiers" << messaget:: eom;
531
530
throw 0 ;
532
531
}
533
532
else if (unsigned_cnt)
@@ -545,8 +544,8 @@ void ansi_c_convert_typet::write(typet &type)
545
544
546
545
if (signed_cnt && unsigned_cnt)
547
546
{
548
- error ().source_location = source_location;
549
- error () << " conflicting type modifiers" << eom;
547
+ log. error ().source_location = source_location;
548
+ log. error () << " conflicting type modifiers" << messaget:: eom;
550
549
throw 0 ;
551
550
}
552
551
else if (unsigned_cnt)
@@ -558,8 +557,8 @@ void ansi_c_convert_typet::write(typet &type)
558
557
{
559
558
if (long_cnt || char_cnt || short_cnt || gcc_int128_cnt || bv_cnt)
560
559
{
561
- error ().source_location = source_location;
562
- error () << " conflicting type modifiers" << eom;
560
+ log. error ().source_location = source_location;
561
+ log. error () << " conflicting type modifiers" << messaget:: eom;
563
562
throw 0 ;
564
563
}
565
564
@@ -615,8 +614,8 @@ void ansi_c_convert_typet::write(typet &type)
615
614
{
616
615
if (long_cnt || char_cnt)
617
616
{
618
- error ().source_location = source_location;
619
- error () << " conflicting type modifiers" << eom;
617
+ log. error ().source_location = source_location;
618
+ log. error () << " conflicting type modifiers" << messaget:: eom;
620
619
throw 0 ;
621
620
}
622
621
@@ -648,8 +647,8 @@ void ansi_c_convert_typet::write(typet &type)
648
647
}
649
648
else
650
649
{
651
- error ().source_location = source_location;
652
- error () << " illegal type modifier for integer type" << eom;
650
+ log. error ().source_location = source_location;
651
+ log. error () << " illegal type modifier for integer type" << messaget:: eom;
653
652
throw 0 ;
654
653
}
655
654
}
0 commit comments