21 use_all_headers(false)
33 std::list<irep_idt> ctype_syms=
35 "isalnum",
"isalpha",
"isblank",
"iscntrl",
"isdigit",
"isgraph",
36 "islower",
"isprint",
"ispunct",
"isspace",
"isupper",
"isxdigit",
42 std::list<irep_idt> fcntl_syms=
44 "creat",
"fcntl",
"open" 49 std::list<irep_idt> locale_syms=
56 std::list<irep_idt> math_syms=
58 "acos",
"acosh",
"asin",
"asinh",
"atan",
"atan2",
"atanh",
59 "cbrt",
"ceil",
"copysign",
"cos",
"cosh",
"erf",
"erfc",
"exp",
60 "exp2",
"expm1",
"fabs",
"fdim",
"floor",
"fma",
"fmax",
"fmin",
61 "fmod",
"fpclassify",
"fpclassifyl",
"fpclassifyf",
"frexp",
62 "hypot",
"ilogb",
"isfinite",
"isinf",
"isnan",
"isnormal",
63 "j0",
"j1",
"jn",
"ldexp",
"lgamma",
"llrint",
"llround",
"log",
64 "log10",
"log1p",
"log2",
"logb",
"lrint",
"lround",
"modf",
"nan",
65 "nearbyint",
"nextafter",
"pow",
"remainder",
"remquo",
"rint",
66 "round",
"scalbln",
"scalbn",
"signbit",
"sin",
"sinh",
"sqrt",
67 "tan",
"tanh",
"tgamma",
"trunc",
"y0",
"y1",
"yn",
"isinff",
68 "isinfl",
"isnanf",
"isnanl" 74 std::list<irep_idt> underscore_math_syms;
75 for(
const irep_idt &math_sym : math_syms)
77 std::ostringstream underscore_id;
78 underscore_id <<
"__" << math_sym;
79 underscore_math_syms.push_back(
irep_idt(underscore_id.str()));
84 std::list<irep_idt> pthread_syms=
86 "pthread_cleanup_pop",
"pthread_cleanup_push",
87 "pthread_cond_broadcast",
"pthread_cond_destroy",
88 "pthread_cond_init",
"pthread_cond_signal",
89 "pthread_cond_timedwait",
"pthread_cond_wait",
"pthread_create",
90 "pthread_detach",
"pthread_equal",
"pthread_exit",
91 "pthread_getspecific",
"pthread_join",
"pthread_key_delete",
92 "pthread_mutex_destroy",
"pthread_mutex_init",
93 "pthread_mutex_lock",
"pthread_mutex_trylock",
94 "pthread_mutex_unlock",
"pthread_once",
"pthread_rwlock_destroy",
95 "pthread_rwlock_init",
"pthread_rwlock_rdlock",
96 "pthread_rwlock_unlock",
"pthread_rwlock_wrlock",
97 "pthread_rwlockattr_destroy",
"pthread_rwlockattr_getpshared",
98 "pthread_rwlockattr_init",
"pthread_rwlockattr_setpshared",
99 "pthread_self",
"pthread_setspecific",
101 "tag-__pthread_internal_list",
"tag-__pthread_mutex_s",
107 std::list<irep_idt> setjmp_syms=
109 "_longjmp",
"_setjmp",
"jmp_buf",
"longjmp",
"longjmperror",
"setjmp",
110 "siglongjmp",
"sigsetjmp" 115 std::list<irep_idt> stdio_syms=
117 "asprintf",
"clearerr",
"fclose",
"fdopen",
"feof",
"ferror",
118 "fflush",
"fgetc",
"fgetln",
"fgetpos",
"fgets",
"fgetwc",
119 "fgetws",
"fileno",
"fopen",
"fprintf",
"fpurge",
"fputc",
120 "fputs",
"fputwc",
"fputws",
"fread",
"freopen",
"fropen",
121 "fscanf",
"fseek",
"fsetpos",
"ftell",
"funopen",
"fwide",
122 "fwopen",
"fwprintf",
"fwrite",
"getc",
"getchar",
"getdelim",
123 "getline",
"gets",
"getw",
"getwc",
"getwchar",
"mkdtemp",
124 "mkstemp",
"mktemp",
"perror",
"printf",
"putc",
"putchar",
125 "puts",
"putw",
"putwc",
"putwchar",
"remove",
"rewind",
"scanf",
126 "setbuf",
"setbuffer",
"setlinebuf",
"setvbuf",
"snprintf",
127 "sprintf",
"sscanf",
"swprintf",
"sys_errlist",
128 "sys_nerr",
"tempnam",
"tmpfile",
"tmpnam",
"ungetc",
"ungetwc",
129 "vasprintf",
"vfprintf",
"vfscanf",
"vfwprintf",
"vprintf",
130 "vscanf",
"vsnprintf",
"vsprintf",
"vsscanf",
"vswprintf",
131 "vwprintf",
"wprintf",
133 "tag-__sFILE",
"tag-__sbuf",
134 "tag-_IO_FILE",
"tag-_IO_marker",
139 std::list<irep_idt> stdlib_syms=
141 "abort",
"abs",
"atexit",
"atof",
"atoi",
"atol",
"atoll",
142 "bsearch",
"calloc",
"div",
"exit",
"free",
"getenv",
"labs",
143 "ldiv",
"llabs",
"lldiv",
"malloc",
"mblen",
"mbstowcs",
"mbtowc",
144 "qsort",
"rand",
"realloc",
"srand",
"strtod",
"strtof",
"strtol",
145 "strtold",
"strtoll",
"strtoul",
"strtoull",
"system",
"wcstombs",
151 std::list<irep_idt> string_syms=
153 "strcat",
"strncat",
"strchr",
"strrchr",
"strcmp",
"strncmp",
154 "strcpy",
"strncpy",
"strerror",
"strlen",
"strpbrk",
"strspn",
155 "strcspn",
"strstr",
"strtok",
"strcasecmp",
"strncasecmp",
"strdup",
161 std::list<irep_idt> time_syms=
163 "asctime",
"asctime_r",
"ctime",
"ctime_r",
"difftime",
"gmtime",
164 "gmtime_r",
"localtime",
"localtime_r",
"mktime",
"strftime",
166 "tag-timespec",
"tag-timeval",
"tag-tm" 171 std::list<irep_idt> unistd_syms=
173 "_exit",
"access",
"alarm",
"chdir",
"chown",
"close",
"dup",
174 "dup2",
"execl",
"execle",
"execlp",
"execv",
"execve",
"execvp",
175 "fork",
"fpathconf",
"getcwd",
"getegid",
"geteuid",
"getgid",
176 "getgroups",
"getlogin",
"getpgrp",
"getpid",
"getppid",
"getuid",
177 "isatty",
"link",
"lseek",
"pathconf",
"pause",
"pipe",
"read",
178 "rmdir",
"setgid",
"setpgid",
"setsid",
"setuid",
"sleep",
179 "sysconf",
"tcgetpgrp",
"tcsetpgrp",
"ttyname",
"ttyname_r",
185 std::list<irep_idt> sys_select_syms=
194 std::list<irep_idt> sys_socket_syms=
196 "accept",
"bind",
"connect",
203 std::list<irep_idt> sys_stat_syms=
205 "fstat",
"lstat",
"stat",
211 std::list<irep_idt> fenv_syms=
213 "fenv_t",
"fexcept_t",
"feclearexcept",
"fegetexceptflag",
214 "feraiseexcept",
"fesetexceptflag",
"fetestexcept",
215 "fegetround",
"fesetround",
"fegetenv",
"feholdexcept",
216 "fesetenv",
"feupdateenv" 220 std::list<irep_idt> errno_syms=
222 "__error",
"__errno_location",
"__errno" 228 std::list<irep_idt> sys_types_syms=
235 std::list<irep_idt> sys_wait_syms=
248 std::list<irep_idt> symbols)
250 for(
const irep_idt &symbol : symbols)
265 std::set<std::string> &out_system_headers)
const 279 std::set<std::string> &out_system_headers)
const 284 name_str==
"__func__" ||
285 name_str==
"__FUNCTION__" ||
286 name_str==
"__PRETTY_FUNCTION__" ||
290 name_str==
"envp_size'")
310 if(
has_prefix(file_str,
"gcc_builtin_headers_") &&
314 if(name_str==
"__builtin_va_start" ||
315 name_str==
"__builtin_va_end" ||
316 symbol.
name==ID_gcc_builtin_va_arg)
318 out_system_headers.insert(
"stdarg.h");
323 else if(name_str==
"__assert_fail" ||
324 name_str==
"_assert" ||
325 name_str==
"__assert_c99" ||
326 name_str==
"_wassert")
335 out_system_headers.insert(
id2string(it->second));
342 if(file_str.find(
"/bits/")==std::string::npos)
346 out_system_headers.insert(file_str.substr(prefix_len));
The type of an expression, extends irept.
irep_idt name
The unique identifier.
const std::string & id2string(const irep_idt &d)
bool is_symbol_internal_symbol(const symbolt &symbol, std::set< std::string > &out_system_headers) const
To find out if a symbol is an internal symbol.
unsignedbv_typet size_type()
system_library_symbolst()
bool has_prefix(const std::string &s, const std::string &prefix)
bool is_type_internal(const typet &type, std::set< std::string > &out_system_headers) const
Helper function to call is_symbol_internal_symbol on a nameless fake symbol with the given type...
dstringt has one field, an unsigned integer no which is an index into a static table of strings...
typet type
Type of symbol.
source_locationt location
Source code location of definition of symbol.
const irep_idt & get_file() const
void init_system_library_map()
To generate a map of header file names -> list of symbols The symbol names are reserved as the header...
bool has_suffix(const std::string &s, const std::string &suffix)
void add_to_system_library(irep_idt header_file, std::list< irep_idt > symbols)
To add the symbols from a specific header file to the system library map.
std::map< irep_idt, irep_idt > system_library_map
Defines typet, type_with_subtypet and type_with_subtypest.