aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-parse.in
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c-parse.in')
-rw-r--r--gcc/c-parse.in37
1 files changed, 27 insertions, 10 deletions
diff --git a/gcc/c-parse.in b/gcc/c-parse.in
index 5944085..e628aa5 100644
--- a/gcc/c-parse.in
+++ b/gcc/c-parse.in
@@ -1432,8 +1432,11 @@ attributes:
;
attribute:
- ATTRIBUTE '(' '(' attribute_list ')' ')'
- { $$ = $4; }
+ ATTRIBUTE stop_string_translation
+ '(' '(' attribute_list ')' ')' start_string_translation
+ { $$ = $5; }
+ | ATTRIBUTE error start_string_translation
+ {}
;
attribute_list:
@@ -2480,8 +2483,9 @@ label: CASE expr_no_commas ':'
/* simple_asm_expr is used in restricted contexts, where a full
expression with inputs and outputs does not make sense. */
simple_asm_expr:
- ASM_KEYWORD '(' STRING ')'
- { $$ = $3; }
+ ASM_KEYWORD stop_string_translation
+ '(' STRING ')' start_string_translation
+ { $$ = $4; }
;
/* maybeasm: used for assembly names for declarations */
@@ -2495,14 +2499,17 @@ maybeasm:
asmdef:
simple_asm_expr ';'
{ assemble_asm ($1); }
+ | ASM_KEYWORD error start_string_translation ';'
+ {}
;
/* Full-blown asm statement with inputs, outputs, clobbers, and
volatile tag allowed. */
asm_stmt:
- ASM_KEYWORD maybe_volatile '(' asm_argument ')' ';'
+ ASM_KEYWORD maybe_volatile stop_string_translation
+ '(' asm_argument ')' start_string_translation ';'
{ stmt_count++;
- $$ = build_asm_stmt ($2, $4); }
+ $$ = build_asm_stmt ($2, $5); }
;
asm_argument:
@@ -2550,12 +2557,13 @@ nonnull_asm_operands:
;
asm_operand:
- STRING '(' expr ')'
- { $$ = build_tree_list (build_tree_list (NULL_TREE, $1), $3); }
- | '[' identifier ']' STRING '(' expr ')'
+ STRING start_string_translation '(' expr ')' stop_string_translation
+ { $$ = build_tree_list (build_tree_list (NULL_TREE, $1), $4); }
+ | '[' identifier ']' STRING start_string_translation
+ '(' expr ')' stop_string_translation
{ $2 = build_string (IDENTIFIER_LENGTH ($2),
IDENTIFIER_POINTER ($2));
- $$ = build_tree_list (build_tree_list ($2, $4), $6); }
+ $$ = build_tree_list (build_tree_list ($2, $4), $7); }
;
asm_clobbers:
@@ -2564,6 +2572,15 @@ asm_clobbers:
| asm_clobbers ',' STRING
{ $$ = tree_cons (NULL_TREE, $3, $1); }
;
+
+stop_string_translation:
+ { c_lex_string_translate = false; }
+ ;
+
+start_string_translation:
+ { c_lex_string_translate = true; }
+ ;
+
/* This is what appears inside the parens in a function declarator.
Its value is a list of ..._TYPE nodes. Attributes must appear here