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