-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
C/C++ front-end: accept all floating-point extensions that GCC and Cl…
…ang support Testing with Compiler Explorer showed that Clang supports a subset of GCC's extensions, and GCC also supports some more extensions than what we previously covered.
- Loading branch information
1 parent
2d1c1a3
commit bf1159f
Showing
21 changed files
with
165 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,15 +12,12 @@ Author: Daniel Kroening, [email protected] | |
|
||
#include <string> | ||
|
||
void ansi_c_internal_additions( | ||
std::string &code, | ||
bool support_ts_18661_3_Floatn_types); | ||
void ansi_c_internal_additions(std::string &code, bool support_float16_type); | ||
void ansi_c_architecture_strings(std::string &code); | ||
|
||
extern const char clang_builtin_headers[]; | ||
extern const char cprover_builtin_headers[]; | ||
extern const char gcc_builtin_headers_types[]; | ||
extern const char gcc_builtin_headers_types_gcc7plus[]; | ||
extern const char gcc_builtin_headers_generic[]; | ||
extern const char gcc_builtin_headers_math[]; | ||
extern const char gcc_builtin_headers_mem_string[]; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
src/ansi-c/compiler_headers/gcc_builtin_headers_types_gcc7plus.h
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,19 +13,36 @@ Author: Daniel Kroening, [email protected] | |
|
||
#include <util/config.h> | ||
|
||
#include <ansi-c/gcc_version.h> | ||
|
||
cpp_parsert cpp_parser; | ||
|
||
bool cpp_parse(); | ||
|
||
bool cpp_parsert::parse() | ||
{ | ||
if(!support_float16.has_value()) | ||
{ | ||
if(config.ansi_c.preprocessor == configt::ansi_ct::preprocessort::GCC) | ||
{ | ||
gcc_versiont gcc_version; | ||
gcc_version.get("gcc"); | ||
support_float16 = gcc_version.flavor == gcc_versiont::flavort::GCC && | ||
gcc_version.is_at_least(13u); | ||
} | ||
else | ||
support_float16 = false; | ||
} | ||
|
||
// We use the ANSI-C scanner | ||
ansi_c_parser.cpp98=true; | ||
ansi_c_parser.cpp11 = | ||
config.cpp.cpp_standard == configt::cppt::cpp_standardt::CPP11 || | ||
config.cpp.cpp_standard == configt::cppt::cpp_standardt::CPP14 || | ||
config.cpp.cpp_standard == configt::cppt::cpp_standardt::CPP17; | ||
ansi_c_parser.ts_18661_3_Floatn_types=false; | ||
ansi_c_parser.ts_18661_3_Floatn_types = false; // these are still typedefs | ||
ansi_c_parser.float16_type = *support_float16; | ||
ansi_c_parser.bf16_type = *support_float16; | ||
ansi_c_parser.in=in; | ||
ansi_c_parser.mode=mode; | ||
ansi_c_parser.set_file(get_file()); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,8 @@ Author: Daniel Kroening, [email protected] | |
#include "cpp_parse_tree.h" | ||
#include "cpp_token_buffer.h" | ||
|
||
#include <optional> | ||
|
||
class cpp_parsert:public parsert | ||
{ | ||
public: | ||
|
@@ -34,10 +36,11 @@ class cpp_parsert:public parsert | |
asm_block_following=false; | ||
} | ||
|
||
cpp_parsert(): | ||
mode(configt::ansi_ct::flavourt::ANSI), | ||
recognize_wchar_t(true), | ||
asm_block_following(false) | ||
cpp_parsert() | ||
: mode(configt::ansi_ct::flavourt::ANSI), | ||
recognize_wchar_t(true), | ||
asm_block_following(false), | ||
support_float16(std::nullopt) | ||
{ | ||
} | ||
|
||
|
@@ -65,6 +68,9 @@ class cpp_parsert:public parsert | |
// scanner | ||
unsigned parenthesis_counter; | ||
bool asm_block_following; | ||
|
||
protected: | ||
std::optional<bool> support_float16; | ||
}; | ||
|
||
extern cpp_parsert cpp_parser; | ||
|
Oops, something went wrong.