File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ Author: CM Wintersteiger
1111
1212#include " format_strings.h"
1313
14+ #include < util/exception_utils.h>
1415#include < util/std_types.h>
1516#include < util/std_expr.h>
1617
@@ -37,7 +38,9 @@ void parse_flags(
3738 curtok.flags .push_back (format_tokent::flag_typet::SIGNED_SPACE); break ;
3839 case ' +' :
3940 curtok.flags .push_back (format_tokent::flag_typet::SIGN); break ;
40- default : throw 0 ;
41+ default :
42+ throw unsupported_operation_exceptiont (
43+ std::string (" unsupported format specifier flag: `" ) + *it + " '" );
4144 }
4245 it++;
4346 }
@@ -175,7 +178,8 @@ void parse_conversion_specifier(
175178 }
176179
177180 default :
178- throw std::string (" unsupported format conversion specifier: `" )+*it+" '" ;
181+ throw unsupported_operation_exceptiont (
182+ std::string (" unsupported format conversion specifier: `" ) + *it + " '" );
179183 }
180184 it++;
181185}
@@ -210,7 +214,11 @@ format_token_listt parse_format_string(const std::string &arg_string)
210214 for ( ; it!=arg_string.end () && *it!=' %' ; it++)
211215 tmp+=*it;
212216
213- assert (!token_list.empty ());
217+ INVARIANT (
218+ !token_list.empty () &&
219+ token_list.back ().type == format_tokent::token_typet::TEXT,
220+ " must already have a TEXT token at the back of the token list" );
221+
214222 token_list.back ().value =tmp;
215223 }
216224 }
You can’t perform that action at this time.
0 commit comments