@@ -13,18 +13,12 @@ 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
1920#include " gcc_types.h"
2021
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-
2822void ansi_c_convert_typet::read_rec (const typet &type)
2923{
3024 if (type.id ()==ID_merged_type)
@@ -286,6 +280,8 @@ void ansi_c_convert_typet::read_rec(const typet &type)
286280
287281void ansi_c_convert_typet::write (typet &type)
288282{
283+ messaget log{message_handler};
284+
289285 type.clear ();
290286
291287 // first, do "other"
@@ -302,8 +298,8 @@ void ansi_c_convert_typet::write(typet &type)
302298 gcc_float128_cnt || gcc_float128x_cnt ||
303299 gcc_int128_cnt || bv_cnt)
304300 {
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;
307303 throw 0 ;
308304 }
309305
@@ -318,8 +314,8 @@ void ansi_c_convert_typet::write(typet &type)
318314
319315 if (other.size ()!=1 )
320316 {
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;
323319 throw 0 ;
324320 }
325321
@@ -342,9 +338,9 @@ void ansi_c_convert_typet::write(typet &type)
342338 {
343339 if (constructor && destructor)
344340 {
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;
348344 throw 0 ;
349345 }
350346
@@ -354,9 +350,9 @@ void ansi_c_convert_typet::write(typet &type)
354350
355351 else if (type_p->id ()!=ID_empty)
356352 {
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;
360356 throw 0 ;
361357 }
362358
@@ -365,9 +361,9 @@ void ansi_c_convert_typet::write(typet &type)
365361 }
366362 else if (constructor || destructor)
367363 {
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;
371367 throw 0 ;
372368 }
373369 else if (gcc_float16_cnt ||
@@ -380,8 +376,9 @@ void ansi_c_convert_typet::write(typet &type)
380376 gcc_int128_cnt || bv_cnt ||
381377 short_cnt || char_cnt)
382378 {
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;
385382 throw 0 ;
386383 }
387384
@@ -391,8 +388,8 @@ void ansi_c_convert_typet::write(typet &type)
391388 gcc_float64_cnt+gcc_float64x_cnt+
392389 gcc_float128_cnt+gcc_float128x_cnt>=2 )
393390 {
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;
396393 throw 0 ;
397394 }
398395
@@ -421,15 +418,16 @@ void ansi_c_convert_typet::write(typet &type)
421418 gcc_int128_cnt|| bv_cnt ||
422419 short_cnt || char_cnt)
423420 {
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;
426424 throw 0 ;
427425 }
428426
429427 if (double_cnt && float_cnt)
430428 {
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;
433431 throw 0 ;
434432 }
435433
@@ -446,15 +444,15 @@ void ansi_c_convert_typet::write(typet &type)
446444 type=long_double_type ();
447445 else
448446 {
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;
451449 throw 0 ;
452450 }
453451 }
454452 else
455453 {
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;
458456 throw 0 ;
459457 }
460458 }
@@ -465,8 +463,9 @@ void ansi_c_convert_typet::write(typet &type)
465463 gcc_float128_cnt || bv_cnt || proper_bool_cnt ||
466464 char_cnt || long_cnt)
467465 {
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;
470469 throw 0 ;
471470 }
472471
@@ -479,8 +478,9 @@ void ansi_c_convert_typet::write(typet &type)
479478 gcc_float128_cnt || bv_cnt ||
480479 char_cnt || long_cnt)
481480 {
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;
484484 throw 0 ;
485485 }
486486
@@ -498,15 +498,15 @@ void ansi_c_convert_typet::write(typet &type)
498498 int8_cnt || int16_cnt || int32_cnt || int64_cnt ||
499499 gcc_float128_cnt || bv_cnt || proper_bool_cnt)
500500 {
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;
503503 throw 0 ;
504504 }
505505
506506 if (signed_cnt && unsigned_cnt)
507507 {
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;
510510 throw 0 ;
511511 }
512512 else if (unsigned_cnt)
@@ -524,8 +524,8 @@ void ansi_c_convert_typet::write(typet &type)
524524
525525 if (signed_cnt && unsigned_cnt)
526526 {
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;
529529 throw 0 ;
530530 }
531531 else if (unsigned_cnt)
@@ -537,8 +537,8 @@ void ansi_c_convert_typet::write(typet &type)
537537 {
538538 if (long_cnt || char_cnt || short_cnt || gcc_int128_cnt || bv_cnt)
539539 {
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;
542542 throw 0 ;
543543 }
544544
@@ -594,8 +594,8 @@ void ansi_c_convert_typet::write(typet &type)
594594 {
595595 if (long_cnt || char_cnt)
596596 {
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;
599599 throw 0 ;
600600 }
601601
@@ -627,8 +627,8 @@ void ansi_c_convert_typet::write(typet &type)
627627 }
628628 else
629629 {
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;
632632 throw 0 ;
633633 }
634634 }
0 commit comments