13
13
14
14
#include < util/c_types.h>
15
15
#include < util/config.h>
16
+ #include < util/message.h>
16
17
#include < util/std_types.h>
17
18
#include < util/string_constant.h>
18
19
@@ -286,6 +287,8 @@ void ansi_c_convert_typet::read_rec(const typet &type)
286
287
287
288
void ansi_c_convert_typet::write (typet &type)
288
289
{
290
+ messaget log {message_handler};
291
+
289
292
type.clear ();
290
293
291
294
// first, do "other"
@@ -302,8 +305,8 @@ void ansi_c_convert_typet::write(typet &type)
302
305
gcc_float128_cnt || gcc_float128x_cnt ||
303
306
gcc_int128_cnt || bv_cnt)
304
307
{
305
- error ().source_location = source_location;
306
- error () << " illegal type modifier for defined type" << eom;
308
+ log . error ().source_location = source_location;
309
+ log . error () << " illegal type modifier for defined type" << messaget:: eom;
307
310
throw 0 ;
308
311
}
309
312
@@ -318,8 +321,8 @@ void ansi_c_convert_typet::write(typet &type)
318
321
319
322
if (other.size ()!=1 )
320
323
{
321
- error ().source_location = source_location;
322
- error () << " illegal combination of defined types" << eom;
324
+ log . error ().source_location = source_location;
325
+ log . error () << " illegal combination of defined types" << messaget:: eom;
323
326
throw 0 ;
324
327
}
325
328
@@ -342,9 +345,9 @@ void ansi_c_convert_typet::write(typet &type)
342
345
{
343
346
if (constructor && destructor)
344
347
{
345
- error ().source_location = source_location;
346
- error () << " combining constructor and destructor not supported"
347
- << eom;
348
+ log . error ().source_location = source_location;
349
+ log . error () << " combining constructor and destructor not supported"
350
+ << messaget:: eom;
348
351
throw 0 ;
349
352
}
350
353
@@ -354,9 +357,9 @@ void ansi_c_convert_typet::write(typet &type)
354
357
355
358
else if (type_p->id ()!=ID_empty)
356
359
{
357
- error ().source_location = source_location;
358
- error () << " constructor and destructor required to be type void, "
359
- << " found " << type_p->pretty () << eom;
360
+ log . error ().source_location = source_location;
361
+ log . error () << " constructor and destructor required to be type void, "
362
+ << " found " << type_p->pretty () << messaget:: eom;
360
363
throw 0 ;
361
364
}
362
365
@@ -365,9 +368,9 @@ void ansi_c_convert_typet::write(typet &type)
365
368
}
366
369
else if (constructor || destructor)
367
370
{
368
- error ().source_location = source_location;
369
- error () << " constructor and destructor required to be type void, "
370
- << " found " << type.pretty () << eom;
371
+ log . error ().source_location = source_location;
372
+ log . error () << " constructor and destructor required to be type void, "
373
+ << " found " << type.pretty () << messaget:: eom;
371
374
throw 0 ;
372
375
}
373
376
else if (gcc_float16_cnt ||
@@ -380,8 +383,9 @@ void ansi_c_convert_typet::write(typet &type)
380
383
gcc_int128_cnt || bv_cnt ||
381
384
short_cnt || char_cnt)
382
385
{
383
- error ().source_location =source_location;
384
- error () << " cannot combine integer type with floating-point type" << eom;
386
+ log .error ().source_location = source_location;
387
+ log .error () << " cannot combine integer type with floating-point type"
388
+ << messaget::eom;
385
389
throw 0 ;
386
390
}
387
391
@@ -391,8 +395,8 @@ void ansi_c_convert_typet::write(typet &type)
391
395
gcc_float64_cnt+gcc_float64x_cnt+
392
396
gcc_float128_cnt+gcc_float128x_cnt>=2 )
393
397
{
394
- error ().source_location = source_location;
395
- error () << " conflicting type modifiers" << eom;
398
+ log . error ().source_location = source_location;
399
+ log . error () << " conflicting type modifiers" << messaget:: eom;
396
400
throw 0 ;
397
401
}
398
402
@@ -421,15 +425,16 @@ void ansi_c_convert_typet::write(typet &type)
421
425
gcc_int128_cnt|| bv_cnt ||
422
426
short_cnt || char_cnt)
423
427
{
424
- error ().source_location =source_location;
425
- error () << " cannot combine integer type with floating-point type" << eom;
428
+ log .error ().source_location = source_location;
429
+ log .error () << " cannot combine integer type with floating-point type"
430
+ << messaget::eom;
426
431
throw 0 ;
427
432
}
428
433
429
434
if (double_cnt && float_cnt)
430
435
{
431
- error ().source_location = source_location;
432
- error () << " conflicting type modifiers" << eom;
436
+ log . error ().source_location = source_location;
437
+ log . error () << " conflicting type modifiers" << messaget:: eom;
433
438
throw 0 ;
434
439
}
435
440
@@ -446,15 +451,15 @@ void ansi_c_convert_typet::write(typet &type)
446
451
type=long_double_type ();
447
452
else
448
453
{
449
- error ().source_location = source_location;
450
- error () << " conflicting type modifiers" << eom;
454
+ log . error ().source_location = source_location;
455
+ log . error () << " conflicting type modifiers" << messaget:: eom;
451
456
throw 0 ;
452
457
}
453
458
}
454
459
else
455
460
{
456
- error ().source_location = source_location;
457
- error () << " illegal type modifier for float" << eom;
461
+ log . error ().source_location = source_location;
462
+ log . error () << " illegal type modifier for float" << messaget:: eom;
458
463
throw 0 ;
459
464
}
460
465
}
@@ -465,8 +470,9 @@ void ansi_c_convert_typet::write(typet &type)
465
470
gcc_float128_cnt || bv_cnt || proper_bool_cnt ||
466
471
char_cnt || long_cnt)
467
472
{
468
- error ().source_location =source_location;
469
- error () << " illegal type modifier for C boolean type" << eom;
473
+ log .error ().source_location = source_location;
474
+ log .error () << " illegal type modifier for C boolean type"
475
+ << messaget::eom;
470
476
throw 0 ;
471
477
}
472
478
@@ -479,8 +485,9 @@ void ansi_c_convert_typet::write(typet &type)
479
485
gcc_float128_cnt || bv_cnt ||
480
486
char_cnt || long_cnt)
481
487
{
482
- error ().source_location =source_location;
483
- error () << " illegal type modifier for proper boolean type" << eom;
488
+ log .error ().source_location = source_location;
489
+ log .error () << " illegal type modifier for proper boolean type"
490
+ << messaget::eom;
484
491
throw 0 ;
485
492
}
486
493
@@ -498,15 +505,15 @@ void ansi_c_convert_typet::write(typet &type)
498
505
int8_cnt || int16_cnt || int32_cnt || int64_cnt ||
499
506
gcc_float128_cnt || bv_cnt || proper_bool_cnt)
500
507
{
501
- error ().source_location = source_location;
502
- error () << " illegal type modifier for char type" << eom;
508
+ log . error ().source_location = source_location;
509
+ log . error () << " illegal type modifier for char type" << messaget:: eom;
503
510
throw 0 ;
504
511
}
505
512
506
513
if (signed_cnt && unsigned_cnt)
507
514
{
508
- error ().source_location = source_location;
509
- error () << " conflicting type modifiers" << eom;
515
+ log . error ().source_location = source_location;
516
+ log . error () << " conflicting type modifiers" << messaget:: eom;
510
517
throw 0 ;
511
518
}
512
519
else if (unsigned_cnt)
@@ -524,8 +531,8 @@ void ansi_c_convert_typet::write(typet &type)
524
531
525
532
if (signed_cnt && unsigned_cnt)
526
533
{
527
- error ().source_location = source_location;
528
- error () << " conflicting type modifiers" << eom;
534
+ log . error ().source_location = source_location;
535
+ log . error () << " conflicting type modifiers" << messaget:: eom;
529
536
throw 0 ;
530
537
}
531
538
else if (unsigned_cnt)
@@ -537,8 +544,8 @@ void ansi_c_convert_typet::write(typet &type)
537
544
{
538
545
if (long_cnt || char_cnt || short_cnt || gcc_int128_cnt || bv_cnt)
539
546
{
540
- error ().source_location = source_location;
541
- error () << " conflicting type modifiers" << eom;
547
+ log . error ().source_location = source_location;
548
+ log . error () << " conflicting type modifiers" << messaget:: eom;
542
549
throw 0 ;
543
550
}
544
551
@@ -594,8 +601,8 @@ void ansi_c_convert_typet::write(typet &type)
594
601
{
595
602
if (long_cnt || char_cnt)
596
603
{
597
- error ().source_location = source_location;
598
- error () << " conflicting type modifiers" << eom;
604
+ log . error ().source_location = source_location;
605
+ log . error () << " conflicting type modifiers" << messaget:: eom;
599
606
throw 0 ;
600
607
}
601
608
@@ -627,8 +634,8 @@ void ansi_c_convert_typet::write(typet &type)
627
634
}
628
635
else
629
636
{
630
- error ().source_location = source_location;
631
- error () << " illegal type modifier for integer type" << eom;
637
+ log . error ().source_location = source_location;
638
+ log . error () << " illegal type modifier for integer type" << messaget:: eom;
632
639
throw 0 ;
633
640
}
634
641
}
0 commit comments