mirror of
https://github.com/autc04/Retro68.git
synced 2024-11-28 05:51:04 +00:00
fix plain C pascal strings
This commit is contained in:
parent
281135ccfa
commit
4007b27d05
@ -7340,6 +7340,7 @@ c_parser_string_literal (c_parser *parser, bool translate, bool wide_ok)
|
||||
location_t loc, last_tok_loc;
|
||||
enum cpp_ttype type;
|
||||
tree value, string_tree;
|
||||
bool pascal_string = false;
|
||||
|
||||
tok = c_parser_peek_token (parser);
|
||||
loc = tok->location;
|
||||
@ -7420,11 +7421,23 @@ c_parser_string_literal (c_parser *parser, bool translate, bool wide_ok)
|
||||
warning (OPT_Wtraditional,
|
||||
"traditional C rejects string constant concatenation");
|
||||
|
||||
if (!strncmp((const char*)strs[0].text, "\"\\p", 3))
|
||||
{
|
||||
pascal_string = true;
|
||||
/* replace \p by a valid escape sequence */
|
||||
((unsigned char*)strs[0].text)[2] = 'n';
|
||||
}
|
||||
|
||||
if ((type == CPP_STRING || wide_ok)
|
||||
&& ((translate
|
||||
? cpp_interpret_string : cpp_interpret_string_notranslate)
|
||||
(parse_in, strs, count, &istr, type)))
|
||||
{
|
||||
if (pascal_string)
|
||||
{
|
||||
/* put the real string length in */
|
||||
((unsigned char*)istr.text)[0] = (unsigned char) (istr.len - 2);
|
||||
}
|
||||
value = build_string (istr.len, (const char *) istr.text);
|
||||
free (CONST_CAST (unsigned char *, istr.text));
|
||||
if (count > 1)
|
||||
@ -7475,7 +7488,10 @@ c_parser_string_literal (c_parser *parser, bool translate, bool wide_ok)
|
||||
default:
|
||||
case CPP_STRING:
|
||||
case CPP_UTF8STRING:
|
||||
TREE_TYPE (value) = char_array_type_node;
|
||||
if (pascal_string)
|
||||
TREE_TYPE (value) = uchar_array_type_node;
|
||||
else
|
||||
TREE_TYPE (value) = char_array_type_node;
|
||||
break;
|
||||
case CPP_STRING16:
|
||||
TREE_TYPE (value) = char16_array_type_node;
|
||||
|
Loading…
Reference in New Issue
Block a user