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
11
11
12
12
#include " format_strings.h"
13
13
14
+ #include < util/exception_utils.h>
14
15
#include < util/std_types.h>
15
16
#include < util/std_expr.h>
16
17
@@ -37,7 +38,9 @@ void parse_flags(
37
38
curtok.flags .push_back (format_tokent::flag_typet::SIGNED_SPACE); break ;
38
39
case ' +' :
39
40
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 + " '" );
41
44
}
42
45
it++;
43
46
}
@@ -175,7 +178,8 @@ void parse_conversion_specifier(
175
178
}
176
179
177
180
default :
178
- throw std::string (" unsupported format conversion specifier: `" )+*it+" '" ;
181
+ throw unsupported_operation_exceptiont (
182
+ std::string (" unsupported format conversion specifier: `" ) + *it + " '" );
179
183
}
180
184
it++;
181
185
}
@@ -210,7 +214,11 @@ format_token_listt parse_format_string(const std::string &arg_string)
210
214
for ( ; it!=arg_string.end () && *it!=' %' ; it++)
211
215
tmp+=*it;
212
216
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
+
214
222
token_list.back ().value =tmp;
215
223
}
216
224
}
You can’t perform that action at this time.
0 commit comments