-
Notifications
You must be signed in to change notification settings - Fork 273
on-demand definitions for compiler-built-in functions #1910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4a5b952
1711345
15ec42f
80ee0b1
17d9897
2c8ae92
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,11 @@ Author: Daniel Kroening, [email protected] | |
|
||
#include <util/config.h> | ||
|
||
const char gcc_builtin_headers_types[]= | ||
"# 1 \"gcc_builtin_headers_types.h\"\n" | ||
#include "gcc_builtin_headers_types.inc" | ||
; // NOLINT(whitespace/semicolon) | ||
|
||
const char gcc_builtin_headers_generic[]= | ||
"# 1 \"gcc_builtin_headers_generic.h\"\n" | ||
#include "gcc_builtin_headers_generic.inc" | ||
|
@@ -89,6 +94,10 @@ const char clang_builtin_headers[]= | |
#include "clang_builtin_headers.inc" | ||
; // NOLINT(whitespace/semicolon) | ||
|
||
const char windows_builtin_headers[]= | ||
"int __noop();\n" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this have a file name as the others do? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seemed unnecessary luxury for two lines. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One day those 2 lines will be 10 and no-one will notice that they should have inserted the file name. It's near zero cost right now, but it might prove costly later. |
||
"int __assume(int);\n"; | ||
|
||
static std::string architecture_string(const std::string &value, const char *s) | ||
{ | ||
return std::string("const char *__CPROVER_architecture_")+ | ||
|
@@ -257,13 +266,7 @@ void ansi_c_internal_additions(std::string &code) | |
config.ansi_c.mode==configt::ansi_ct::flavourt::APPLE || | ||
config.ansi_c.mode==configt::ansi_ct::flavourt::ARM) | ||
{ | ||
code+=gcc_builtin_headers_generic; | ||
code+=gcc_builtin_headers_math; | ||
code+=gcc_builtin_headers_mem_string; | ||
code+=gcc_builtin_headers_omp; | ||
code+=gcc_builtin_headers_tm; | ||
code+=gcc_builtin_headers_ubsan; | ||
code+=clang_builtin_headers; | ||
code+=gcc_builtin_headers_types; | ||
|
||
// there are many more, e.g., look at | ||
// https://developer.apple.com/library/mac/#documentation/developertools/gcc-4.0.1/gcc/Target-Builtins.html | ||
|
@@ -274,37 +277,6 @@ void ansi_c_internal_additions(std::string &code) | |
{ | ||
if(config.ansi_c.mode==configt::ansi_ct::flavourt::APPLE) | ||
code+="typedef double __float128;\n"; // clang doesn't do __float128 | ||
|
||
code+=gcc_builtin_headers_ia32; | ||
code+=gcc_builtin_headers_ia32_2; | ||
code+=gcc_builtin_headers_ia32_3; | ||
code+=gcc_builtin_headers_ia32_4; | ||
} | ||
else if(config.ansi_c.arch=="arm64" || | ||
config.ansi_c.arch=="armel" || | ||
config.ansi_c.arch=="armhf" || | ||
config.ansi_c.arch=="arm") | ||
{ | ||
code+=gcc_builtin_headers_arm; | ||
} | ||
else if(config.ansi_c.arch=="alpha") | ||
{ | ||
code+=gcc_builtin_headers_alpha; | ||
} | ||
else if(config.ansi_c.arch=="mips64el" || | ||
config.ansi_c.arch=="mipsn32el" || | ||
config.ansi_c.arch=="mipsel" || | ||
config.ansi_c.arch=="mips64" || | ||
config.ansi_c.arch=="mipsn32" || | ||
config.ansi_c.arch=="mips") | ||
{ | ||
code+=gcc_builtin_headers_mips; | ||
} | ||
else if(config.ansi_c.arch=="powerpc" || | ||
config.ansi_c.arch=="ppc64" || | ||
config.ansi_c.arch=="ppc64le") | ||
{ | ||
code+=gcc_builtin_headers_power; | ||
} | ||
|
||
// On 64-bit systems, gcc has typedefs | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,17 +15,24 @@ Author: Daniel Kroening, [email protected] | |
void ansi_c_internal_additions(std::string &code); | ||
void ansi_c_architecture_strings(std::string &code); | ||
|
||
extern const char clang_builtin_headers[]; | ||
extern const char gcc_builtin_headers_types[]; | ||
extern const char gcc_builtin_headers_generic[]; | ||
extern const char gcc_builtin_headers_math[]; | ||
extern const char gcc_builtin_headers_mem_string[]; | ||
extern const char gcc_builtin_headers_omp[]; | ||
extern const char gcc_builtin_headers_tm[]; | ||
extern const char gcc_builtin_headers_ubsan[]; | ||
extern const char clang_builtin_headers[]; | ||
extern const char gcc_builtin_headers_ia32[]; | ||
extern const char gcc_builtin_headers_ia32_2[]; | ||
extern const char gcc_builtin_headers_ia32_3[]; | ||
extern const char gcc_builtin_headers_ia32_4[]; | ||
extern const char gcc_builtin_headers_alpha[]; | ||
extern const char gcc_builtin_headers_arm[]; | ||
extern const char gcc_builtin_headers_mips[]; | ||
extern const char gcc_builtin_headers_power[]; | ||
extern const char arm_builtin_headers[]; | ||
extern const char cw_builtin_headers[]; | ||
extern const char windows_builtin_headers[]; | ||
|
||
#endif // CPROVER_ANSI_C_ANSI_C_INTERNAL_ADDITIONS_H |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While at this, would it be possible to introduce a Makefile variable holding all the header files? As is, the same list of files appears three times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done