This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] fix exec-charset
On Thu, 2004-02-12 at 17:01, Zack Weinberg wrote:
> Eric Christopher <echristo@redhat.com> writes:
>
> > As Zack promised here's the patch that fixes exec-charset. Tested by
> > bootstrapping on x86-linux and hand testing with IBM1047 as an execution
> > character set.
>
> 1) I think you missed extern "C" in the cp/parser.c changes.
Here are the c++ parser changes for someone to look at again. My
knowledge here isn't as great as I'd like :)
None of this addresses Joseph's concerns.
-eric
--
Eric Christopher <echristo@redhat.com>
Index: parser.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/parser.c,v
retrieving revision 1.172
diff -u -p -w -r1.172 parser.c
--- parser.c 9 Feb 2004 14:55:59 -0000 1.172
+++ parser.c 13 Feb 2004 02:05:01 -0000
@@ -6320,6 +6320,11 @@ cp_parser_declaration (cp_parser* parser
/* Try to figure out what kind of declaration is present. */
token1 = *cp_lexer_peek_token (parser->lexer);
+
+ /* We can turn this off up here because we won't encounter
+ strings in a declaration. */
+ c_lex_string_translate = false;
+
if (token1.type != CPP_EOF)
token2 = *cp_lexer_peek_nth_token (parser->lexer, 2);
@@ -6328,6 +6333,8 @@ cp_parser_declaration (cp_parser* parser
if (token1.keyword == RID_EXTERN
&& cp_parser_is_string_literal (&token2))
cp_parser_linkage_specification (parser);
+
+
/* If the next token is `template', then we have either a template
declaration, an explicit instantiation, or an explicit
specialization. */
@@ -6372,6 +6379,8 @@ cp_parser_declaration (cp_parser* parser
else
/* Try to parse a block-declaration, or a function-definition. */
cp_parser_block_declaration (parser, /*statement_p=*/false);
+
+ c_lex_string_translate = true;
}
/* Parse a block-declaration.
@@ -9741,9 +9750,10 @@ cp_parser_asm_definition (cp_parser* par
/* Look for the opening `('. */
cp_parser_require (parser, CPP_OPEN_PAREN, "`('");
/* Look for the string. */
+ c_lex_string_translate = false;
token = cp_parser_require (parser, CPP_STRING, "asm body");
if (!token)
- return;
+ goto finish;
string = token->value;
/* If we're allowing GNU extensions, check for the extended assembly
syntax. Unfortunately, the `:' tokens need not be separated by
@@ -9837,6 +9847,9 @@ cp_parser_asm_definition (cp_parser* par
}
else
assemble_asm (string);
+
+ finish:
+ c_lex_string_translate = true;
}
/* Declarators [gram.dcl.decl] */
@@ -13396,6 +13409,7 @@ cp_parser_attribute_list (cp_parser* par
{
tree attribute_list = NULL_TREE;
+ c_lex_string_translate = false;
while (true)
{
cp_token *token;
@@ -13441,6 +13455,7 @@ cp_parser_attribute_list (cp_parser* par
/* Consume the comma and keep going. */
cp_lexer_consume_token (parser->lexer);
}
+ c_lex_string_translate = true;
/* We built up the list in reverse order. */
return nreverse (attribute_list);