aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.demon.co.uk>2001-12-10 20:08:59 +0000
committerNeil Booth <neil@gcc.gnu.org>2001-12-10 20:08:59 +0000
commita23c9413df6f956abfda9d7e73e70a7109ae7be7 (patch)
tree388abb74ae9bdd4ee8004d380c37d8256154a4ec /gcc/cp
parentd01f3474229a6b3b89085ff009ba85515c95b285 (diff)
downloadgcc-a23c9413df6f956abfda9d7e73e70a7109ae7be7.zip
gcc-a23c9413df6f956abfda9d7e73e70a7109ae7be7.tar.gz
gcc-a23c9413df6f956abfda9d7e73e70a7109ae7be7.tar.bz2
c-lex.c, [...]: Revert concatenation changes.
* c-lex.c, c-parse.in, c-typeck.c: Revert concatenation changes. cp: * parse.y, semantics.c: Similarly. From-SVN: r47848
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/parse.y46
-rw-r--r--gcc/cp/semantics.c3
3 files changed, 35 insertions, 18 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ea344c4..a8c08a2 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,7 @@
+2001-12-10 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * parse.y, semantics.c: Similarly.
+
2001-12-04 Nathan Sidwell <nathan@codesourcery.com>
PR g++/87
diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y
index e5bedd3..a27f288 100644
--- a/gcc/cp/parse.y
+++ b/gcc/cp/parse.y
@@ -259,7 +259,8 @@ cp_parse_init ()
yylval contains an IDENTIFIER_NODE which indicates which one. */
%token VAR_FUNC_NAME
-/* String constants as arrays of a suitable type. */
+/* String constants in raw form.
+ yylval is a STRING_CST node. */
%token STRING
/* "...", used for functions with variable arglists. */
@@ -328,7 +329,7 @@ cp_parse_init ()
%type <ttype> PFUNCNAME maybe_identifier
%type <ttype> paren_expr_or_null nontrivial_exprlist SELFNAME
%type <ttype> expr_no_commas expr_no_comma_rangle
-%type <ttype> cast_expr unary_expr primary STRING
+%type <ttype> cast_expr unary_expr primary string STRING
%type <ttype> reserved_declspecs boolean.literal
%type <ttype> reserved_typespecquals
%type <ttype> SCSPEC TYPESPEC CV_QUALIFIER maybe_cv_qualifier
@@ -496,8 +497,9 @@ extdef:
{ do_pending_inlines (); }
| template_def
{ do_pending_inlines (); }
- | asm_keyword '(' STRING ')' ';'
- { assemble_asm ($3); }
+ | asm_keyword '(' string ')' ';'
+ { if (TREE_CHAIN ($3)) $3 = combine_strings ($3);
+ assemble_asm ($3); }
| extern_lang_string '{' extdefs_opt '}'
{ pop_lang_context (); }
| extern_lang_string .hush_warning fndef .warning_ok eat_saved_input
@@ -1545,8 +1547,9 @@ primary:
}
| CONSTANT
| boolean.literal
- | STRING
+ | string
{
+ $$ = combine_strings ($$);
/* combine_strings doesn't set up TYPE_MAIN_VARIANT of
a const array the way we want, so fix it. */
if (flag_const_strings)
@@ -1748,6 +1751,13 @@ boolean.literal:
{ $$ = boolean_false_node; }
;
+/* Produces a STRING_CST with perhaps more STRING_CSTs chained onto it. */
+string:
+ STRING
+ | string STRING
+ { $$ = chainon ($$, $2); }
+ ;
+
nodecls:
/* empty */
{
@@ -2031,8 +2041,8 @@ nomods_initdecls:
maybeasm:
/* empty */
{ $$ = NULL_TREE; }
- | asm_keyword '(' STRING ')'
- { $$ = $3; }
+ | asm_keyword '(' string ')'
+ { if (TREE_CHAIN ($3)) $3 = combine_strings ($3); $$ = $3; }
;
initdcl:
@@ -3429,27 +3439,27 @@ simple_stmt:
{ $$ = finish_return_stmt (NULL_TREE); }
| RETURN_KEYWORD expr ';'
{ $$ = finish_return_stmt ($2); }
- | asm_keyword maybe_cv_qualifier '(' STRING ')' ';'
+ | asm_keyword maybe_cv_qualifier '(' string ')' ';'
{ $$ = finish_asm_stmt ($2, $4, NULL_TREE, NULL_TREE,
NULL_TREE);
ASM_INPUT_P ($$) = 1; }
/* This is the case with just output operands. */
- | asm_keyword maybe_cv_qualifier '(' STRING ':' asm_operands ')' ';'
+ | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ')' ';'
{ $$ = finish_asm_stmt ($2, $4, $6, NULL_TREE, NULL_TREE); }
/* This is the case with input operands as well. */
- | asm_keyword maybe_cv_qualifier '(' STRING ':' asm_operands ':'
+ | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':'
asm_operands ')' ';'
{ $$ = finish_asm_stmt ($2, $4, $6, $8, NULL_TREE); }
- | asm_keyword maybe_cv_qualifier '(' STRING SCOPE asm_operands ')' ';'
+ | asm_keyword maybe_cv_qualifier '(' string SCOPE asm_operands ')' ';'
{ $$ = finish_asm_stmt ($2, $4, NULL_TREE, $6, NULL_TREE); }
/* This is the case with clobbered registers as well. */
- | asm_keyword maybe_cv_qualifier '(' STRING ':' asm_operands ':'
+ | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':'
asm_operands ':' asm_clobbers ')' ';'
{ $$ = finish_asm_stmt ($2, $4, $6, $8, $10); }
- | asm_keyword maybe_cv_qualifier '(' STRING SCOPE asm_operands ':'
+ | asm_keyword maybe_cv_qualifier '(' string SCOPE asm_operands ':'
asm_clobbers ')' ';'
{ $$ = finish_asm_stmt ($2, $4, NULL_TREE, $6, $8); }
- | asm_keyword maybe_cv_qualifier '(' STRING ':' asm_operands SCOPE
+ | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands SCOPE
asm_clobbers ')' ';'
{ $$ = finish_asm_stmt ($2, $4, $6, NULL_TREE, $8); }
| GOTO '*' expr ';'
@@ -3604,10 +3614,10 @@ asm_operand:
;
asm_clobbers:
- STRING
- { $$ = tree_cons (NULL_TREE, $1, NULL_TREE);}
- | asm_clobbers ',' STRING
- { $$ = tree_cons (NULL_TREE, $3, $1); }
+ string
+ { $$ = tree_cons (NULL_TREE, combine_strings ($1), NULL_TREE);}
+ | asm_clobbers ',' string
+ { $$ = tree_cons (NULL_TREE, combine_strings ($3), $1); }
;
/* This is what appears inside the parens in a function declarator.
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 776f06f..b0bb25b 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -883,6 +883,9 @@ finish_asm_stmt (cv_qualifier, string, output_operands,
tree r;
tree t;
+ if (TREE_CHAIN (string))
+ string = combine_strings (string);
+
if (cv_qualifier != NULL_TREE
&& cv_qualifier != ridpointers[(int) RID_VOLATILE])
{