@@ -13,6 +13,7 @@ Author: Daniel Kroening, kroening@kroening.com
1313
1414#include < util/c_types.h>
1515#include < util/config.h>
16+ #include < util/message.h>
1617#include < util/std_types.h>
1718#include < util/string_constant.h>
1819
@@ -286,6 +287,8 @@ void ansi_c_convert_typet::read_rec(const typet &type)
286287
287288void ansi_c_convert_typet::write (typet &type)
288289{
290+ messaget log{message_handler};
291+
289292 type.clear ();
290293
291294 // first, do "other"
@@ -302,8 +305,8 @@ void ansi_c_convert_typet::write(typet &type)
302305 gcc_float128_cnt || gcc_float128x_cnt ||
303306 gcc_int128_cnt || bv_cnt)
304307 {
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;
307310 throw 0 ;
308311 }
309312
@@ -318,8 +321,8 @@ void ansi_c_convert_typet::write(typet &type)
318321
319322 if (other.size ()!=1 )
320323 {
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;
323326 throw 0 ;
324327 }
325328
@@ -342,9 +345,9 @@ void ansi_c_convert_typet::write(typet &type)
342345 {
343346 if (constructor && destructor)
344347 {
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;
348351 throw 0 ;
349352 }
350353
@@ -354,9 +357,9 @@ void ansi_c_convert_typet::write(typet &type)
354357
355358 else if (type_p->id ()!=ID_empty)
356359 {
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;
360363 throw 0 ;
361364 }
362365
@@ -365,9 +368,9 @@ void ansi_c_convert_typet::write(typet &type)
365368 }
366369 else if (constructor || destructor)
367370 {
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;
371374 throw 0 ;
372375 }
373376 else if (gcc_float16_cnt ||
@@ -380,8 +383,9 @@ void ansi_c_convert_typet::write(typet &type)
380383 gcc_int128_cnt || bv_cnt ||
381384 short_cnt || char_cnt)
382385 {
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;
385389 throw 0 ;
386390 }
387391
@@ -391,8 +395,8 @@ void ansi_c_convert_typet::write(typet &type)
391395 gcc_float64_cnt+gcc_float64x_cnt+
392396 gcc_float128_cnt+gcc_float128x_cnt>=2 )
393397 {
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;
396400 throw 0 ;
397401 }
398402
@@ -421,15 +425,16 @@ void ansi_c_convert_typet::write(typet &type)
421425 gcc_int128_cnt|| bv_cnt ||
422426 short_cnt || char_cnt)
423427 {
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;
426431 throw 0 ;
427432 }
428433
429434 if (double_cnt && float_cnt)
430435 {
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;
433438 throw 0 ;
434439 }
435440
@@ -446,15 +451,15 @@ void ansi_c_convert_typet::write(typet &type)
446451 type=long_double_type ();
447452 else
448453 {
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;
451456 throw 0 ;
452457 }
453458 }
454459 else
455460 {
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;
458463 throw 0 ;
459464 }
460465 }
@@ -465,8 +470,9 @@ void ansi_c_convert_typet::write(typet &type)
465470 gcc_float128_cnt || bv_cnt || proper_bool_cnt ||
466471 char_cnt || long_cnt)
467472 {
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;
470476 throw 0 ;
471477 }
472478
@@ -479,8 +485,9 @@ void ansi_c_convert_typet::write(typet &type)
479485 gcc_float128_cnt || bv_cnt ||
480486 char_cnt || long_cnt)
481487 {
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;
484491 throw 0 ;
485492 }
486493
@@ -498,15 +505,15 @@ void ansi_c_convert_typet::write(typet &type)
498505 int8_cnt || int16_cnt || int32_cnt || int64_cnt ||
499506 gcc_float128_cnt || bv_cnt || proper_bool_cnt)
500507 {
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;
503510 throw 0 ;
504511 }
505512
506513 if (signed_cnt && unsigned_cnt)
507514 {
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;
510517 throw 0 ;
511518 }
512519 else if (unsigned_cnt)
@@ -524,8 +531,8 @@ void ansi_c_convert_typet::write(typet &type)
524531
525532 if (signed_cnt && unsigned_cnt)
526533 {
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;
529536 throw 0 ;
530537 }
531538 else if (unsigned_cnt)
@@ -537,8 +544,8 @@ void ansi_c_convert_typet::write(typet &type)
537544 {
538545 if (long_cnt || char_cnt || short_cnt || gcc_int128_cnt || bv_cnt)
539546 {
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;
542549 throw 0 ;
543550 }
544551
@@ -594,8 +601,8 @@ void ansi_c_convert_typet::write(typet &type)
594601 {
595602 if (long_cnt || char_cnt)
596603 {
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;
599606 throw 0 ;
600607 }
601608
@@ -627,8 +634,8 @@ void ansi_c_convert_typet::write(typet &type)
627634 }
628635 else
629636 {
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;
632639 throw 0 ;
633640 }
634641 }
0 commit comments