summaryrefslogtreecommitdiff
path: root/gcc/c-parse.in
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.demon.co.uk>2001-12-08 19:13:04 +0000
committerNeil Booth <neil@gcc.gnu.org>2001-12-08 19:13:04 +0000
commit78e7853794e3f161805694034afb628de9345461 (patch)
tree9dd5e947d351d17759c2d2a3ed6897d33603a496 /gcc/c-parse.in
parent46af705afa95d7876d1048e8425b1180acd238a6 (diff)
downloadgcc-78e7853794e3f161805694034afb628de9345461.tar.gz
c-parse.in: Take string literals in assembler constructs, not expressions.
* c-parse.in: Take string literals in assembler constructs, not expressions. * c-typeck.c (build_asm_stmt, simple_asm_stmt): No need to check the strings are STRING_CSTs. From-SVN: r47795
Diffstat (limited to 'gcc/c-parse.in')
-rw-r--r--gcc/c-parse.in20
1 files changed, 7 insertions, 13 deletions
diff --git a/gcc/c-parse.in b/gcc/c-parse.in
index fadef4e23ee..324300d00e8 100644
--- a/gcc/c-parse.in
+++ b/gcc/c-parse.in
@@ -99,7 +99,7 @@ end ifobjc
yylval is the node for the constant. */
%token CONSTANT
-/* String constants as arrays of the appropriate character type. */
+/* A STRING_CST with type an array of the appropriate character type. */
%token STRING OBJC_STRING
/* "...", used for functions with variable arglists. */
@@ -348,14 +348,8 @@ extdef:
ifobjc
| objcdef
end ifobjc
- | ASM_KEYWORD '(' expr ')' ';'
- { STRIP_NOPS ($3);
- if ((TREE_CODE ($3) == ADDR_EXPR
- && TREE_CODE (TREE_OPERAND ($3, 0)) == STRING_CST)
- || TREE_CODE ($3) == STRING_CST)
- assemble_asm ($3);
- else
- error ("argument of `asm' is not a constant string"); }
+ | ASM_KEYWORD '(' STRING ')' ';'
+ { assemble_asm ($3); }
| extension extdef
{ RESTORE_WARN_FLAGS ($1); }
;
@@ -2306,20 +2300,20 @@ stmt:
| RETURN expr ';'
{ stmt_count++;
$$ = c_expand_return ($2); }
- | ASM_KEYWORD maybe_type_qual '(' expr ')' ';'
+ | ASM_KEYWORD maybe_type_qual '(' STRING ')' ';'
{ stmt_count++;
$$ = simple_asm_stmt ($4); }
/* This is the case with just output operands. */
- | ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ')' ';'
+ | ASM_KEYWORD maybe_type_qual '(' STRING ':' asm_operands ')' ';'
{ stmt_count++;
$$ = build_asm_stmt ($2, $4, $6, NULL_TREE, NULL_TREE); }
/* This is the case with input operands as well. */
- | ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ':'
+ | ASM_KEYWORD maybe_type_qual '(' STRING ':' asm_operands ':'
asm_operands ')' ';'
{ stmt_count++;
$$ = build_asm_stmt ($2, $4, $6, $8, NULL_TREE); }
/* This is the case with clobbered registers as well. */
- | ASM_KEYWORD maybe_type_qual '(' expr ':' asm_operands ':'
+ | ASM_KEYWORD maybe_type_qual '(' STRING ':' asm_operands ':'
asm_operands ':' asm_clobbers ')' ';'
{ stmt_count++;
$$ = build_asm_stmt ($2, $4, $6, $8, $10); }