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)
@@ -286,6 +280,8 @@ void ansi_c_convert_typet::read_rec(const typet &type)
286
280
287
281
void ansi_c_convert_typet::write (typet &type)
288
282
{
283
+ messaget log {message_handler};
284
+
289
285
type.clear ();
290
286
291
287
// first, do "other"
@@ -302,8 +298,8 @@ void ansi_c_convert_typet::write(typet &type)
302
298
gcc_float128_cnt || gcc_float128x_cnt ||
303
299
gcc_int128_cnt || bv_cnt)
304
300
{
305
- error ().source_location = source_location;
306
- error () << " illegal type modifier for defined type" << eom;
301
+ log . error ().source_location = source_location;
302
+ log . error () << " illegal type modifier for defined type" << messaget:: eom;
307
303
throw 0 ;
308
304
}
309
305
@@ -318,8 +314,8 @@ void ansi_c_convert_typet::write(typet &type)
318
314
319
315
if (other.size ()!=1 )
320
316
{
321
- error ().source_location = source_location;
322
- error () << " illegal combination of defined types" << eom;
317
+ log . error ().source_location = source_location;
318
+ log . error () << " illegal combination of defined types" << messaget:: eom;
323
319
throw 0 ;
324
320
}
325
321
@@ -342,9 +338,9 @@ void ansi_c_convert_typet::write(typet &type)
342
338
{
343
339
if (constructor && destructor)
344
340
{
345
- error ().source_location = source_location;
346
- error () << " combining constructor and destructor not supported"
347
- << eom;
341
+ log . error ().source_location = source_location;
342
+ log . error () << " combining constructor and destructor not supported"
343
+ << messaget:: eom;
348
344
throw 0 ;
349
345
}
350
346
@@ -354,9 +350,9 @@ void ansi_c_convert_typet::write(typet &type)
354
350
355
351
else if (type_p->id ()!=ID_empty)
356
352
{
357
- error ().source_location = source_location;
358
- error () << " constructor and destructor required to be type void, "
359
- << " found " << type_p->pretty () << eom;
353
+ log . error ().source_location = source_location;
354
+ log . error () << " constructor and destructor required to be type void, "
355
+ << " found " << type_p->pretty () << messaget:: eom;
360
356
throw 0 ;
361
357
}
362
358
@@ -365,9 +361,9 @@ void ansi_c_convert_typet::write(typet &type)
365
361
}
366
362
else if (constructor || destructor)
367
363
{
368
- error ().source_location = source_location;
369
- error () << " constructor and destructor required to be type void, "
370
- << " found " << type.pretty () << eom;
364
+ log . error ().source_location = source_location;
365
+ log . error () << " constructor and destructor required to be type void, "
366
+ << " found " << type.pretty () << messaget:: eom;
371
367
throw 0 ;
372
368
}
373
369
else if (gcc_float16_cnt ||
@@ -380,8 +376,9 @@ void ansi_c_convert_typet::write(typet &type)
380
376
gcc_int128_cnt || bv_cnt ||
381
377
short_cnt || char_cnt)
382
378
{
383
- error ().source_location =source_location;
384
- error () << " cannot combine integer type with floating-point type" << eom;
379
+ log .error ().source_location = source_location;
380
+ log .error () << " cannot combine integer type with floating-point type"
381
+ << messaget::eom;
385
382
throw 0 ;
386
383
}
387
384
@@ -391,8 +388,8 @@ void ansi_c_convert_typet::write(typet &type)
391
388
gcc_float64_cnt+gcc_float64x_cnt+
392
389
gcc_float128_cnt+gcc_float128x_cnt>=2 )
393
390
{
394
- error ().source_location = source_location;
395
- error () << " conflicting type modifiers" << eom;
391
+ log . error ().source_location = source_location;
392
+ log . error () << " conflicting type modifiers" << messaget:: eom;
396
393
throw 0 ;
397
394
}
398
395
@@ -421,15 +418,16 @@ void ansi_c_convert_typet::write(typet &type)
421
418
gcc_int128_cnt|| bv_cnt ||
422
419
short_cnt || char_cnt)
423
420
{
424
- error ().source_location =source_location;
425
- error () << " cannot combine integer type with floating-point type" << eom;
421
+ log .error ().source_location = source_location;
422
+ log .error () << " cannot combine integer type with floating-point type"
423
+ << messaget::eom;
426
424
throw 0 ;
427
425
}
428
426
429
427
if (double_cnt && float_cnt)
430
428
{
431
- error ().source_location = source_location;
432
- error () << " conflicting type modifiers" << eom;
429
+ log . error ().source_location = source_location;
430
+ log . error () << " conflicting type modifiers" << messaget:: eom;
433
431
throw 0 ;
434
432
}
435
433
@@ -446,15 +444,15 @@ void ansi_c_convert_typet::write(typet &type)
446
444
type=long_double_type ();
447
445
else
448
446
{
449
- error ().source_location = source_location;
450
- error () << " conflicting type modifiers" << eom;
447
+ log . error ().source_location = source_location;
448
+ log . error () << " conflicting type modifiers" << messaget:: eom;
451
449
throw 0 ;
452
450
}
453
451
}
454
452
else
455
453
{
456
- error ().source_location = source_location;
457
- error () << " illegal type modifier for float" << eom;
454
+ log . error ().source_location = source_location;
455
+ log . error () << " illegal type modifier for float" << messaget:: eom;
458
456
throw 0 ;
459
457
}
460
458
}
@@ -465,8 +463,9 @@ void ansi_c_convert_typet::write(typet &type)
465
463
gcc_float128_cnt || bv_cnt || proper_bool_cnt ||
466
464
char_cnt || long_cnt)
467
465
{
468
- error ().source_location =source_location;
469
- error () << " illegal type modifier for C boolean type" << eom;
466
+ log .error ().source_location = source_location;
467
+ log .error () << " illegal type modifier for C boolean type"
468
+ << messaget::eom;
470
469
throw 0 ;
471
470
}
472
471
@@ -479,8 +478,9 @@ void ansi_c_convert_typet::write(typet &type)
479
478
gcc_float128_cnt || bv_cnt ||
480
479
char_cnt || long_cnt)
481
480
{
482
- error ().source_location =source_location;
483
- error () << " illegal type modifier for proper boolean type" << eom;
481
+ log .error ().source_location = source_location;
482
+ log .error () << " illegal type modifier for proper boolean type"
483
+ << messaget::eom;
484
484
throw 0 ;
485
485
}
486
486
@@ -498,15 +498,15 @@ void ansi_c_convert_typet::write(typet &type)
498
498
int8_cnt || int16_cnt || int32_cnt || int64_cnt ||
499
499
gcc_float128_cnt || bv_cnt || proper_bool_cnt)
500
500
{
501
- error ().source_location = source_location;
502
- error () << " illegal type modifier for char type" << eom;
501
+ log . error ().source_location = source_location;
502
+ log . error () << " illegal type modifier for char type" << messaget:: eom;
503
503
throw 0 ;
504
504
}
505
505
506
506
if (signed_cnt && unsigned_cnt)
507
507
{
508
- error ().source_location = source_location;
509
- error () << " conflicting type modifiers" << eom;
508
+ log . error ().source_location = source_location;
509
+ log . error () << " conflicting type modifiers" << messaget:: eom;
510
510
throw 0 ;
511
511
}
512
512
else if (unsigned_cnt)
@@ -524,8 +524,8 @@ void ansi_c_convert_typet::write(typet &type)
524
524
525
525
if (signed_cnt && unsigned_cnt)
526
526
{
527
- error ().source_location = source_location;
528
- error () << " conflicting type modifiers" << eom;
527
+ log . error ().source_location = source_location;
528
+ log . error () << " conflicting type modifiers" << messaget:: eom;
529
529
throw 0 ;
530
530
}
531
531
else if (unsigned_cnt)
@@ -537,8 +537,8 @@ void ansi_c_convert_typet::write(typet &type)
537
537
{
538
538
if (long_cnt || char_cnt || short_cnt || gcc_int128_cnt || bv_cnt)
539
539
{
540
- error ().source_location = source_location;
541
- error () << " conflicting type modifiers" << eom;
540
+ log . error ().source_location = source_location;
541
+ log . error () << " conflicting type modifiers" << messaget:: eom;
542
542
throw 0 ;
543
543
}
544
544
@@ -594,8 +594,8 @@ void ansi_c_convert_typet::write(typet &type)
594
594
{
595
595
if (long_cnt || char_cnt)
596
596
{
597
- error ().source_location = source_location;
598
- error () << " conflicting type modifiers" << eom;
597
+ log . error ().source_location = source_location;
598
+ log . error () << " conflicting type modifiers" << messaget:: eom;
599
599
throw 0 ;
600
600
}
601
601
@@ -627,8 +627,8 @@ void ansi_c_convert_typet::write(typet &type)
627
627
}
628
628
else
629
629
{
630
- error ().source_location = source_location;
631
- error () << " illegal type modifier for integer type" << eom;
630
+ log . error ().source_location = source_location;
631
+ log . error () << " illegal type modifier for integer type" << messaget:: eom;
632
632
throw 0 ;
633
633
}
634
634
}
0 commit comments