File tree 7 files changed +24
-7
lines changed
7 files changed +24
-7
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ bool ansi_c_languaget::parse(
76
76
ansi_c_parser.set_message_handler (get_message_handler ());
77
77
ansi_c_parser.for_has_scope =config.ansi_c .for_has_scope ;
78
78
ansi_c_parser.ts_18661_3_Floatn_types =config.ansi_c .ts_18661_3_Floatn_types ;
79
+ ansi_c_parser.Float128_type =config.ansi_c .Float128_type ;
79
80
ansi_c_parser.cpp98 =false ; // it's not C++
80
81
ansi_c_parser.cpp11 =false ; // it's not C++
81
82
ansi_c_parser.mode =config.ansi_c .mode ;
Original file line number Diff line number Diff line change @@ -36,7 +36,8 @@ class ansi_c_parsert:public parsert
36
36
cpp98 (false ),
37
37
cpp11 (false ),
38
38
for_has_scope (false ),
39
- ts_18661_3_Floatn_types(false )
39
+ ts_18661_3_Floatn_types(false ),
40
+ Float128_type(false )
40
41
{
41
42
}
42
43
@@ -81,6 +82,9 @@ class ansi_c_parsert:public parsert
81
82
// ISO/IEC TS 18661-3:2015
82
83
bool ts_18661_3_Floatn_types;
83
84
85
+ // Does the compiler version emulated provide _Float128?
86
+ bool Float128_type;
87
+
84
88
typedef ansi_c_identifiert identifiert;
85
89
typedef ansi_c_scopet scopet;
86
90
Original file line number Diff line number Diff line change @@ -47,11 +47,11 @@ extern int yyansi_cdebug;
47
47
int make_identifier ()
48
48
{
49
49
loc ();
50
-
50
+
51
51
// deal with universal charater names
52
52
std::string final_base_name;
53
53
final_base_name.reserve (yyleng);
54
-
54
+
55
55
for (const char *p=yytext; *p!=0 ; p++)
56
56
{
57
57
if (p[0 ]==' \\ ' && (p[1 ]==' u' || p[1 ]==' U' ))
@@ -62,18 +62,18 @@ int make_identifier()
62
62
unsigned letter=hex_to_unsigned (p, digits);
63
63
for (; *p!=0 && digits>0 ; digits--, p++);
64
64
p--; // go back for p++ later
65
-
65
+
66
66
std::basic_string<unsigned > utf32;
67
67
utf32+=letter;
68
-
68
+
69
69
// turn into utf-8
70
70
std::string utf8_value=utf32_to_utf8 (utf32);
71
71
final_base_name+=utf8_value;
72
72
}
73
73
else
74
74
final_base_name+=*p;
75
75
}
76
-
76
+
77
77
if (PARSER.cpp98 )
78
78
{
79
79
stack (yyansi_clval).id (ID_symbol);
@@ -503,7 +503,7 @@ void ansi_c_scanner_init()
503
503
return make_identifier ();
504
504
}
505
505
506
- " _Float128" { if (PARSER.ts_18661_3_Floatn_types )
506
+ " _Float128" { if (PARSER.Float128_type )
507
507
{ loc (); return TOK_GCC_FLOAT128; }
508
508
else
509
509
return make_identifier ();
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ bool cpp_parsert::parse()
25
25
config.cpp .cpp_standard ==configt::cppt::cpp_standardt::CPP11 ||
26
26
config.cpp .cpp_standard ==configt::cppt::cpp_standardt::CPP14;
27
27
ansi_c_parser.ts_18661_3_Floatn_types =false ;
28
+ ansi_c_parser.Float128_type = false ;
28
29
ansi_c_parser.in =in;
29
30
ansi_c_parser.mode =mode;
30
31
ansi_c_parser.set_file (get_file ());
Original file line number Diff line number Diff line change @@ -530,6 +530,13 @@ int gcc_modet::doit()
530
530
gcc_version.is_at_least (7 ))
531
531
config.ansi_c .ts_18661_3_Floatn_types =true ;
532
532
533
+ int gcc_float128_minor_version =
534
+ config.ansi_c .arch == " x86_64" ? 3 : 5 ;
535
+
536
+ config.ansi_c .Float128_type =
537
+ gcc_version.flavor ==gcc_versiont::flavort::GCC &&
538
+ gcc_version.is_at_least (4 , gcc_float128_minor_version);
539
+
533
540
// -fshort-double makes double the same as float
534
541
if (cmdline.isset (" fshort-double" ))
535
542
config.ansi_c .double_width =config.ansi_c .single_width ;
Original file line number Diff line number Diff line change @@ -912,6 +912,9 @@ bool configt::set(const cmdlinet &cmdline)
912
912
ansi_c.preprocessor =ansi_ct::preprocessort::GCC;
913
913
}
914
914
915
+ if (ansi_c.preprocessor == ansi_ct::preprocessort::GCC)
916
+ ansi_c.Float128_type = true ;
917
+
915
918
set_arch (arch);
916
919
917
920
if (os==" windows" )
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ class configt
43
43
bool char_is_unsigned, wchar_t_is_unsigned;
44
44
bool for_has_scope;
45
45
bool ts_18661_3_Floatn_types; // ISO/IEC TS 18661-3:2015
46
+ bool Float128_type;
46
47
bool single_precision_constant;
47
48
enum class c_standardt { C89, C99, C11 } c_standard;
48
49
static c_standardt default_c_standard ();
You can’t perform that action at this time.
0 commit comments