@@ -10,6 +10,7 @@ Author: Thomas Kiley
10
10
#include < util/cprover_prefix.h>
11
11
#include < util/prefix.h>
12
12
#include < util/symbol.h>
13
+ #include < sstream>
13
14
14
15
system_library_symbolst::system_library_symbolst ()
15
16
{
@@ -61,16 +62,28 @@ void system_library_symbolst::init_system_library_map()
61
62
" acos" , " acosh" , " asin" , " asinh" , " atan" , " atan2" , " atanh" ,
62
63
" cbrt" , " ceil" , " copysign" , " cos" , " cosh" , " erf" , " erfc" , " exp" ,
63
64
" exp2" , " expm1" , " fabs" , " fdim" , " floor" , " fma" , " fmax" , " fmin" ,
64
- " fmod" , " fpclassify" , " frexp" , " hypot" , " ilogb" , " isfinite" ,
65
- " isinf" , " isnan" , " isnormal" , " j0" , " j1" , " jn" , " ldexp" , " lgamma" ,
66
- " llrint" , " llround" , " log" , " log10" , " log1p" , " log2" , " logb" ,
67
- " lrint" , " lround" , " modf" , " nan" , " nearbyint" , " nextafter" , " pow" ,
68
- " remainder" , " remquo" , " rint" , " round" , " scalbln" , " scalbn" ,
69
- " signbit" , " sin" , " sinh" , " sqrt" , " tan" , " tanh" , " tgamma" ,
70
- " trunc" , " y0" , " y1" , " yn"
65
+ " fmod" , " fpclassify" , " fpclassifyl" , " fpclassifyf" , " frexp" ,
66
+ " hypot" , " ilogb" , " isfinite" , " isinf" , " isnan" , " isnormal" ,
67
+ " j0" , " j1" , " jn" , " ldexp" , " lgamma" , " llrint" , " llround" , " log" ,
68
+ " log10" , " log1p" , " log2" , " logb" , " lrint" , " lround" , " modf" , " nan" ,
69
+ " nearbyint" , " nextafter" , " pow" , " remainder" , " remquo" , " rint" ,
70
+ " round" , " scalbln" , " scalbn" , " signbit" , " sin" , " sinh" , " sqrt" ,
71
+ " tan" , " tanh" , " tgamma" , " trunc" , " y0" , " y1" , " yn" , " isinff" ,
72
+ " isinfl" , " isnanf" , " isnanl"
71
73
};
72
74
add_to_system_library (" math.h" , math_syms);
73
75
76
+ // for some reason the math functions can sometimes be prefixed with
77
+ // a double underscore
78
+ std::list<irep_idt> underscore_math_syms;
79
+ for (const irep_idt &math_sym : math_syms)
80
+ {
81
+ std::ostringstream underscore_id;
82
+ underscore_id << " __" << math_sym;
83
+ underscore_math_syms.push_back (irep_idt (underscore_id.str ()));
84
+ }
85
+ add_to_system_library (" math.h" , underscore_math_syms);
86
+
74
87
// pthread.h
75
88
std::list<irep_idt> pthread_syms=
76
89
{
@@ -140,7 +153,8 @@ void system_library_symbolst::init_system_library_map()
140
153
{
141
154
" strcat" , " strncat" , " strchr" , " strrchr" , " strcmp" , " strncmp" ,
142
155
" strcpy" , " strncpy" , " strerror" , " strlen" , " strpbrk" , " strspn" ,
143
- " strcspn" , " strstr" , " strtok"
156
+ " strcspn" , " strstr" , " strtok" , " strcasecmp" , " strncasecmp" , " strdup" ,
157
+ " memset"
144
158
};
145
159
add_to_system_library (" string.h" , string_syms);
146
160
@@ -189,6 +203,27 @@ void system_library_symbolst::init_system_library_map()
189
203
};
190
204
add_to_system_library (" sys/stat.h" , sys_stat_syms);
191
205
206
+ std::list<irep_idt> fenv_syms=
207
+ {
208
+ " fenv_t" , " fexcept_t" , " feclearexcept" , " fegetexceptflag" ,
209
+ " feraiseexcept" , " fesetexceptflag" , " fetestexcept" ,
210
+ " fegetround" , " fesetround" , " fegetenv" , " feholdexcept" ,
211
+ " fesetenv" , " feupdateenv"
212
+ };
213
+ add_to_system_library (" fenv.h" , fenv_syms);
214
+
215
+ std::list<irep_idt> errno_syms=
216
+ {
217
+ " __error" , " __errno_location" , " __errno"
218
+ };
219
+ add_to_system_library (" errno.c" , errno_syms);
220
+
221
+ std::list<irep_idt> noop_syms=
222
+ {
223
+ " __noop"
224
+ };
225
+ add_to_system_library (" noop.c" , noop_syms);
226
+
192
227
#if 0
193
228
// sys/types.h
194
229
std::list<irep_idt> sys_types_syms=
@@ -263,6 +298,17 @@ bool system_library_symbolst::is_symbol_internal_symbol(
263
298
name_str==" envp_size'" )
264
299
return true ;
265
300
301
+ // exclude nondet instructions
302
+ if (has_prefix (name_str, " nondet_" ))
303
+ {
304
+ return true ;
305
+ }
306
+
307
+ if (has_prefix (name_str, " __VERIFIER" ))
308
+ {
309
+ return true ;
310
+ }
311
+
266
312
const std::string &file_str=id2string (symbol.location .get_file ());
267
313
268
314
// don't dump internal GCC builtins
@@ -283,6 +329,15 @@ bool system_library_symbolst::is_symbol_internal_symbol(
283
329
return true ;
284
330
}
285
331
332
+ // don't dump asserts
333
+ else if (name_str==" __assert_fail" ||
334
+ name_str==" _assert" ||
335
+ name_str==" __assert_c99" ||
336
+ name_str==" _wassert" )
337
+ {
338
+ return true ;
339
+ }
340
+
286
341
if (name_str.find (" $link" )!=std::string::npos)
287
342
return false ;
288
343
0 commit comments