@@ -14,20 +14,14 @@ Author: Daniel Kroening, kroening@kroening.com
14
14
#include < util/arith_tools.h>
15
15
#include < util/c_types.h>
16
16
#include < util/config.h>
17
+ #include < util/message.h>
17
18
#include < util/namespace.h>
18
19
#include < util/simplify_expr.h>
19
20
#include < util/std_types.h>
20
21
#include < util/string_constant.h>
21
22
22
23
#include " gcc_types.h"
23
24
24
- void ansi_c_convert_typet::read (const typet &type)
25
- {
26
- clear ();
27
- source_location=type.source_location ();
28
- read_rec (type);
29
- }
30
-
31
25
void ansi_c_convert_typet::read_rec (const typet &type)
32
26
{
33
27
if (type.id ()==ID_merged_type)
@@ -269,6 +263,8 @@ void ansi_c_convert_typet::read_rec(const typet &type)
269
263
270
264
void ansi_c_convert_typet::write (typet &type)
271
265
{
266
+ messaget log{message_handler};
267
+
272
268
type.clear ();
273
269
274
270
// first, do "other"
@@ -285,8 +281,8 @@ void ansi_c_convert_typet::write(typet &type)
285
281
gcc_float128_cnt || gcc_float128x_cnt ||
286
282
gcc_int128_cnt || bv_cnt)
287
283
{
288
- error ().source_location = source_location;
289
- error () << " illegal type modifier for defined type" << eom;
284
+ log. error ().source_location = source_location;
285
+ log. error () << " illegal type modifier for defined type" << messaget:: eom;
290
286
throw 0 ;
291
287
}
292
288
@@ -301,8 +297,8 @@ void ansi_c_convert_typet::write(typet &type)
301
297
302
298
if (other.size ()!=1 )
303
299
{
304
- error ().source_location = source_location;
305
- error () << " illegal combination of defined types" << eom;
300
+ log. error ().source_location = source_location;
301
+ log. error () << " illegal combination of defined types" << messaget:: eom;
306
302
throw 0 ;
307
303
}
308
304
@@ -322,9 +318,9 @@ void ansi_c_convert_typet::write(typet &type)
322
318
{
323
319
if (constructor && destructor)
324
320
{
325
- error ().source_location = source_location;
326
- error () << " combining constructor and destructor not supported"
327
- << eom;
321
+ log. error ().source_location = source_location;
322
+ log. error () << " combining constructor and destructor not supported"
323
+ << messaget:: eom;
328
324
throw 0 ;
329
325
}
330
326
@@ -334,9 +330,9 @@ void ansi_c_convert_typet::write(typet &type)
334
330
335
331
else if (type_p->id ()!=ID_empty)
336
332
{
337
- error ().source_location = source_location;
338
- error () << " constructor and destructor required to be type void, "
339
- << " found " << type_p->pretty () << eom;
333
+ log. error ().source_location = source_location;
334
+ log. error () << " constructor and destructor required to be type void, "
335
+ << " found " << type_p->pretty () << messaget:: eom;
340
336
throw 0 ;
341
337
}
342
338
@@ -345,9 +341,9 @@ void ansi_c_convert_typet::write(typet &type)
345
341
}
346
342
else if (constructor || destructor)
347
343
{
348
- error ().source_location = source_location;
349
- error () << " constructor and destructor required to be type void, "
350
- << " found " << type.pretty () << eom;
344
+ log. error ().source_location = source_location;
345
+ log. error () << " constructor and destructor required to be type void, "
346
+ << " found " << type.pretty () << messaget:: eom;
351
347
throw 0 ;
352
348
}
353
349
else if (gcc_float16_cnt ||
@@ -360,8 +356,9 @@ void ansi_c_convert_typet::write(typet &type)
360
356
gcc_int128_cnt || bv_cnt ||
361
357
short_cnt || char_cnt)
362
358
{
363
- error ().source_location =source_location;
364
- error () << " cannot combine integer type with floating-point type" << eom;
359
+ log.error ().source_location = source_location;
360
+ log.error () << " cannot combine integer type with floating-point type"
361
+ << messaget::eom;
365
362
throw 0 ;
366
363
}
367
364
@@ -371,8 +368,8 @@ void ansi_c_convert_typet::write(typet &type)
371
368
gcc_float64_cnt+gcc_float64x_cnt+
372
369
gcc_float128_cnt+gcc_float128x_cnt>=2 )
373
370
{
374
- error ().source_location = source_location;
375
- error () << " conflicting type modifiers" << eom;
371
+ log. error ().source_location = source_location;
372
+ log. error () << " conflicting type modifiers" << messaget:: eom;
376
373
throw 0 ;
377
374
}
378
375
@@ -401,15 +398,16 @@ void ansi_c_convert_typet::write(typet &type)
401
398
gcc_int128_cnt|| bv_cnt ||
402
399
short_cnt || char_cnt)
403
400
{
404
- error ().source_location =source_location;
405
- error () << " cannot combine integer type with floating-point type" << eom;
401
+ log.error ().source_location = source_location;
402
+ log.error () << " cannot combine integer type with floating-point type"
403
+ << messaget::eom;
406
404
throw 0 ;
407
405
}
408
406
409
407
if (double_cnt && float_cnt)
410
408
{
411
- error ().source_location = source_location;
412
- error () << " conflicting type modifiers" << eom;
409
+ log. error ().source_location = source_location;
410
+ log. error () << " conflicting type modifiers" << messaget:: eom;
413
411
throw 0 ;
414
412
}
415
413
@@ -426,15 +424,15 @@ void ansi_c_convert_typet::write(typet &type)
426
424
type=long_double_type ();
427
425
else
428
426
{
429
- error ().source_location = source_location;
430
- error () << " conflicting type modifiers" << eom;
427
+ log. error ().source_location = source_location;
428
+ log. error () << " conflicting type modifiers" << messaget:: eom;
431
429
throw 0 ;
432
430
}
433
431
}
434
432
else
435
433
{
436
- error ().source_location = source_location;
437
- error () << " illegal type modifier for float" << eom;
434
+ log. error ().source_location = source_location;
435
+ log. error () << " illegal type modifier for float" << messaget:: eom;
438
436
throw 0 ;
439
437
}
440
438
}
@@ -445,8 +443,9 @@ void ansi_c_convert_typet::write(typet &type)
445
443
gcc_float128_cnt || bv_cnt || proper_bool_cnt ||
446
444
char_cnt || long_cnt)
447
445
{
448
- error ().source_location =source_location;
449
- error () << " illegal type modifier for C boolean type" << eom;
446
+ log.error ().source_location = source_location;
447
+ log.error () << " illegal type modifier for C boolean type"
448
+ << messaget::eom;
450
449
throw 0 ;
451
450
}
452
451
@@ -459,8 +458,9 @@ void ansi_c_convert_typet::write(typet &type)
459
458
gcc_float128_cnt || bv_cnt ||
460
459
char_cnt || long_cnt)
461
460
{
462
- error ().source_location =source_location;
463
- error () << " illegal type modifier for proper boolean type" << eom;
461
+ log.error ().source_location = source_location;
462
+ log.error () << " illegal type modifier for proper boolean type"
463
+ << messaget::eom;
464
464
throw 0 ;
465
465
}
466
466
@@ -478,15 +478,15 @@ void ansi_c_convert_typet::write(typet &type)
478
478
int8_cnt || int16_cnt || int32_cnt || int64_cnt ||
479
479
gcc_float128_cnt || bv_cnt || proper_bool_cnt)
480
480
{
481
- error ().source_location = source_location;
482
- error () << " illegal type modifier for char type" << eom;
481
+ log. error ().source_location = source_location;
482
+ log. error () << " illegal type modifier for char type" << messaget:: eom;
483
483
throw 0 ;
484
484
}
485
485
486
486
if (signed_cnt && unsigned_cnt)
487
487
{
488
- error ().source_location = source_location;
489
- error () << " conflicting type modifiers" << eom;
488
+ log. error ().source_location = source_location;
489
+ log. error () << " conflicting type modifiers" << messaget:: eom;
490
490
throw 0 ;
491
491
}
492
492
else if (unsigned_cnt)
@@ -504,8 +504,8 @@ void ansi_c_convert_typet::write(typet &type)
504
504
505
505
if (signed_cnt && unsigned_cnt)
506
506
{
507
- error ().source_location = source_location;
508
- error () << " conflicting type modifiers" << eom;
507
+ log. error ().source_location = source_location;
508
+ log. error () << " conflicting type modifiers" << messaget:: eom;
509
509
throw 0 ;
510
510
}
511
511
else if (unsigned_cnt)
@@ -517,8 +517,8 @@ void ansi_c_convert_typet::write(typet &type)
517
517
{
518
518
if (long_cnt || char_cnt || short_cnt || gcc_int128_cnt || bv_cnt)
519
519
{
520
- error ().source_location = source_location;
521
- error () << " conflicting type modifiers" << eom;
520
+ log. error ().source_location = source_location;
521
+ log. error () << " conflicting type modifiers" << messaget:: eom;
522
522
throw 0 ;
523
523
}
524
524
@@ -574,8 +574,8 @@ void ansi_c_convert_typet::write(typet &type)
574
574
{
575
575
if (long_cnt || char_cnt)
576
576
{
577
- error ().source_location = source_location;
578
- error () << " conflicting type modifiers" << eom;
577
+ log. error ().source_location = source_location;
578
+ log. error () << " conflicting type modifiers" << messaget:: eom;
579
579
throw 0 ;
580
580
}
581
581
@@ -607,8 +607,8 @@ void ansi_c_convert_typet::write(typet &type)
607
607
}
608
608
else
609
609
{
610
- error ().source_location = source_location;
611
- error () << " illegal type modifier for integer type" << eom;
610
+ log. error ().source_location = source_location;
611
+ log. error () << " illegal type modifier for integer type" << messaget:: eom;
612
612
throw 0 ;
613
613
}
614
614
}
0 commit comments