diff options
Diffstat (limited to 'gcc/pretty-print.c')
-rw-r--r-- | gcc/pretty-print.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/gcc/pretty-print.c b/gcc/pretty-print.c index d6098a74745..3f5b4f16af5 100644 --- a/gcc/pretty-print.c +++ b/gcc/pretty-print.c @@ -231,8 +231,7 @@ pp_base_format_text (pretty_printer *pp, text_info *text) break; } /* We don't support precision beyond that of "long long". */ - if (precision > 2) - abort(); + gcc_assert (precision <= 2); if (quoted) pp_string (pp, open_quote); @@ -319,10 +318,10 @@ pp_base_format_text (pretty_printer *pp, text_info *text) int n; const char *s; /* We handle no precision specifier but '%.*s'. */ - if (*++text->format_spec != '*') - abort (); - else if (*++text->format_spec != 's') - abort (); + ++text->format_spec; + gcc_assert (*text->format_spec == '*'); + ++text->format_spec; + gcc_assert (*text->format_spec == 's'); n = va_arg (*text->args_ptr, int); s = va_arg (*text->args_ptr, const char *); pp_append_text (pp, s, s + n); @@ -330,14 +329,16 @@ pp_base_format_text (pretty_printer *pp, text_info *text) break; default: - if (!pp_format_decoder (pp) || !(*pp_format_decoder (pp)) (pp, text)) - { - /* Hmmm. The client failed to install a format translator - but called us with an unrecognized format. Or, maybe, the - translated string just contains an invalid format, or - has formats in the wrong order. Sorry. */ - abort (); - } + { + bool ok; + + /* Make sure there's a format translator. */ + gcc_assert (pp_format_decoder (pp)); + ok = pp_format_decoder (pp) (pp, text); + /* and make sure it recognized the format. */ + gcc_assert (ok); + break; + } } if (quoted) pp_string (pp, close_quote); |