20 use_all_headers(false)
32 std::list<irep_idt> ctype_syms=
34 "isalnum",
"isalpha",
"isblank",
"iscntrl",
"isdigit",
"isgraph",
35 "islower",
"isprint",
"ispunct",
"isspace",
"isupper",
"isxdigit",
41 std::list<irep_idt> fcntl_syms=
43 "creat",
"fcntl",
"open"
48 std::list<irep_idt> locale_syms=
55 std::list<irep_idt> math_syms=
57 "acos",
"acosh",
"asin",
"asinh",
"atan",
"atan2",
"atanh",
58 "cbrt",
"ceil",
"copysign",
"cos",
"cosh",
"erf",
"erfc",
"exp",
59 "exp2",
"expm1",
"fabs",
"fdim",
"floor",
"fma",
"fmax",
"fmin",
60 "fmod",
"fpclassify",
"fpclassifyl",
"fpclassifyf",
"frexp",
61 "hypot",
"ilogb",
"isfinite",
"isinf",
"isnan",
"isnormal",
62 "j0",
"j1",
"jn",
"ldexp",
"lgamma",
"llrint",
"llround",
"log",
63 "log10",
"log1p",
"log2",
"logb",
"lrint",
"lround",
"modf",
"nan",
64 "nearbyint",
"nextafter",
"pow",
"remainder",
"remquo",
"rint",
65 "round",
"scalbln",
"scalbn",
"signbit",
"sin",
"sinh",
"sqrt",
66 "tan",
"tanh",
"tgamma",
"trunc",
"y0",
"y1",
"yn",
"isinff",
67 "isinfl",
"isnanf",
"isnanl"
73 std::list<irep_idt> underscore_math_syms;
74 for(
const irep_idt &math_sym : math_syms)
76 std::ostringstream underscore_id;
77 underscore_id <<
"__" << math_sym;
78 underscore_math_syms.push_back(
irep_idt(underscore_id.str()));
83 std::list<irep_idt> pthread_syms=
85 "pthread_cleanup_pop",
"pthread_cleanup_push",
86 "pthread_cond_broadcast",
"pthread_cond_destroy",
87 "pthread_cond_init",
"pthread_cond_signal",
88 "pthread_cond_timedwait",
"pthread_cond_wait",
"pthread_create",
89 "pthread_detach",
"pthread_equal",
"pthread_exit",
90 "pthread_getspecific",
"pthread_join",
"pthread_key_delete",
91 "pthread_mutex_destroy",
"pthread_mutex_init",
92 "pthread_mutex_lock",
"pthread_mutex_trylock",
93 "pthread_mutex_unlock",
"pthread_once",
"pthread_rwlock_destroy",
94 "pthread_rwlock_init",
"pthread_rwlock_rdlock",
95 "pthread_rwlock_unlock",
"pthread_rwlock_wrlock",
96 "pthread_rwlockattr_destroy",
"pthread_rwlockattr_getpshared",
97 "pthread_rwlockattr_init",
"pthread_rwlockattr_setpshared",
98 "pthread_self",
"pthread_setspecific",
100 "tag-__pthread_internal_list",
"tag-__pthread_mutex_s",
106 std::list<irep_idt> setjmp_syms=
108 "_longjmp",
"_setjmp",
"jmp_buf",
"longjmp",
"longjmperror",
"setjmp",
109 "siglongjmp",
"sigsetjmp"
114 std::list<irep_idt> stdio_syms=
116 "asprintf",
"clearerr",
"fclose",
"fdopen",
"feof",
"ferror",
117 "fflush",
"fgetc",
"fgetln",
"fgetpos",
"fgets",
"fgetwc",
118 "fgetws",
"fileno",
"fopen",
"fprintf",
"fpurge",
"fputc",
119 "fputs",
"fputwc",
"fputws",
"fread",
"freopen",
"fropen",
120 "fscanf",
"fseek",
"fsetpos",
"ftell",
"funopen",
"fwide",
121 "fwopen",
"fwprintf",
"fwrite",
"getc",
"getchar",
"getdelim",
122 "getline",
"gets",
"getw",
"getwc",
"getwchar",
"mkdtemp",
123 "mkstemp",
"mktemp",
"perror",
"printf",
"putc",
"putchar",
124 "puts",
"putw",
"putwc",
"putwchar",
"remove",
"rewind",
"scanf",
125 "setbuf",
"setbuffer",
"setlinebuf",
"setvbuf",
"snprintf",
126 "sprintf",
"sscanf",
"swprintf",
"sys_errlist",
127 "sys_nerr",
"tempnam",
"tmpfile",
"tmpnam",
"ungetc",
"ungetwc",
128 "vasprintf",
"vfprintf",
"vfscanf",
"vfwprintf",
"vprintf",
129 "vscanf",
"vsnprintf",
"vsprintf",
"vsscanf",
"vswprintf",
130 "vwprintf",
"wprintf",
132 "tag-__sFILE",
"tag-__sbuf",
133 "tag-_IO_FILE",
"tag-_IO_marker",
138 std::list<irep_idt> stdlib_syms=
140 "abort",
"abs",
"atexit",
"atof",
"atoi",
"atol",
"atoll",
141 "bsearch",
"calloc",
"div",
"exit",
"free",
"getenv",
"labs",
142 "ldiv",
"llabs",
"lldiv",
"malloc",
"mblen",
"mbstowcs",
"mbtowc",
143 "qsort",
"rand",
"realloc",
"srand",
"strtod",
"strtof",
"strtol",
144 "strtold",
"strtoll",
"strtoul",
"strtoull",
"system",
"wcstombs",
150 std::list<irep_idt> string_syms=
152 "strcat",
"strncat",
"strchr",
"strrchr",
"strcmp",
"strncmp",
153 "strcpy",
"strncpy",
"strerror",
"strlen",
"strpbrk",
"strspn",
154 "strcspn",
"strstr",
"strtok",
"strcasecmp",
"strncasecmp",
"strdup",
160 std::list<irep_idt> time_syms=
162 "asctime",
"asctime_r",
"ctime",
"ctime_r",
"difftime",
"gmtime",
163 "gmtime_r",
"localtime",
"localtime_r",
"mktime",
"strftime",
165 "tag-timespec",
"tag-timeval",
"tag-tm"
170 std::list<irep_idt> unistd_syms=
172 "_exit",
"access",
"alarm",
"chdir",
"chown",
"close",
"dup",
173 "dup2",
"execl",
"execle",
"execlp",
"execv",
"execve",
"execvp",
174 "fork",
"fpathconf",
"getcwd",
"getegid",
"geteuid",
"getgid",
175 "getgroups",
"getlogin",
"getpgrp",
"getpid",
"getppid",
"getuid",
176 "isatty",
"link",
"lseek",
"pathconf",
"pause",
"pipe",
"read",
177 "rmdir",
"setgid",
"setpgid",
"setsid",
"setuid",
"sleep",
178 "sysconf",
"tcgetpgrp",
"tcsetpgrp",
"ttyname",
"ttyname_r",
184 std::list<irep_idt> sys_select_syms=
193 std::list<irep_idt> sys_socket_syms=
195 "accept",
"bind",
"connect",
202 std::list<irep_idt> sys_stat_syms=
204 "fstat",
"lstat",
"stat",
210 std::list<irep_idt> fenv_syms=
212 "fenv_t",
"fexcept_t",
"feclearexcept",
"fegetexceptflag",
213 "feraiseexcept",
"fesetexceptflag",
"fetestexcept",
214 "fegetround",
"fesetround",
"fegetenv",
"feholdexcept",
215 "fesetenv",
"feupdateenv"
219 std::list<irep_idt> errno_syms=
221 "__error",
"__errno_location",
"__errno"
227 std::list<irep_idt> sys_types_syms=
234 std::list<irep_idt> sys_wait_syms=
247 std::list<irep_idt> symbols)
249 for(
const irep_idt &symbol : symbols)
262 std::set<std::string> &out_system_headers)
const
267 name_str==
"__func__" ||
268 name_str==
"__FUNCTION__" ||
269 name_str==
"__PRETTY_FUNCTION__" ||
273 name_str==
"envp_size'")
293 if(
has_prefix(file_str,
"gcc_builtin_headers_") &&
297 if(name_str==
"__builtin_va_start" ||
298 name_str==
"__builtin_va_end" ||
299 symbol.
name==ID_gcc_builtin_va_arg)
301 out_system_headers.insert(
"stdarg.h");
306 else if(name_str==
"__assert_fail" ||
307 name_str==
"_assert" ||
308 name_str==
"__assert_c99" ||
309 name_str==
"_wassert")
318 out_system_headers.insert(
id2string(it->second));
326 ((
has_prefix(file_str,
"/Library/Developer/") ||
327 has_prefix(file_str,
"/Applications/Xcode")) &&
328 file_str.find(
"/usr/include/") != std::string::npos))
330 if(file_str.find(
"/bits/") == std::string::npos)
334 file_str.find(
"/usr/include/") + std::string(
"/usr/include/").size();
335 out_system_headers.insert(file_str.substr(prefix_len));
342 file_str,
"C:\\Program Files (x86)\\Microsoft Visual Studio\\") ||
343 has_prefix(file_str,
"C:\\Program Files\\Microsoft Visual Studio\\")) &&
344 file_str.find(
"\\include\\") != std::string::npos)
347 file_str.find(
"\\include\\") + std::string(
"\\include\\").size();
348 out_system_headers.insert(file_str.substr(prefix_len));
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
const irep_idt & get_file() const
source_locationt location
Source code location of definition of symbol.
irep_idt name
The unique identifier.
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.
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 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.
system_library_symbolst()
std::map< irep_idt, irep_idt > system_library_map
bool has_prefix(const std::string &s, const std::string &prefix)
const std::string & id2string(const irep_idt &d)
bool has_suffix(const std::string &s, const std::string &suffix)