diff options
author | Neil Booth <neil@daikokuya.demon.co.uk> | 2001-05-11 06:38:48 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2001-05-11 06:38:48 +0000 |
commit | 15b732b28893897ac585cf62e2646f001a22531f (patch) | |
tree | 1a696e8ab4e8b4b64edcb8b6dc6f47202bb5ddae /gcc/c-typeck.c | |
parent | 8e93d44655a8a0cee4a687ac973a54d847e4924b (diff) | |
download | gcc-15b732b28893897ac585cf62e2646f001a22531f.zip gcc-15b732b28893897ac585cf62e2646f001a22531f.tar.gz gcc-15b732b28893897ac585cf62e2646f001a22531f.tar.bz2 |
c-common.c (finish_label_expr): New function, lifted from from cp/semantics.c.
* c-common.c (finish_label_expr): New function, lifted from
from cp/semantics.c.
* c-common.h (finish_label_expr, lookup_label): New prototypes.
* c-parse.in: Move 3 blocks of parser code into new functions.
* c-typeck.c (simple_asm_stmt, c_cast_expr): New functions.
* c-tree.h (simple_asm_stmt, c_cast_expr): New prototypes.
(lookup_label): Remove.
From-SVN: r41959
Diffstat (limited to 'gcc/c-typeck.c')
-rw-r--r-- | gcc/c-typeck.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 33ac1169..3cbf6c6 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -3867,6 +3867,24 @@ build_c_cast (type, expr) return value; } + +/* Interpret a cast of expression EXPR to type TYPE. */ +tree +c_cast_expr (type, expr) + tree type, expr; +{ + int saved_wsp = warn_strict_prototypes; + + /* This avoids warnings about unprototyped casts on + integers. E.g. "#define SIG_DFL (void(*)())0". */ + if (TREE_CODE (expr) == INTEGER_CST) + warn_strict_prototypes = 0; + type = groktypename (type); + warn_strict_prototypes = saved_wsp; + + return build_c_cast (type, expr); +} + /* Build an assignment expression of lvalue LHS from value RHS. MODIFYCODE is the code for a binary operator that we use @@ -6763,6 +6781,33 @@ process_init_element (value) constructor_range_stack = 0; } +/* Build a simple asm-statement, from one string literal. */ +tree +simple_asm_stmt (expr) + tree expr; +{ + STRIP_NOPS (expr); + + if (TREE_CODE (expr) == ADDR_EXPR) + expr = TREE_OPERAND (expr, 0); + + if (TREE_CODE (expr) == STRING_CST) + { + tree stmt; + + if (TREE_CHAIN (expr)) + expr = combine_strings (expr); + stmt = add_stmt (build_stmt (ASM_STMT, NULL_TREE, expr, + NULL_TREE, NULL_TREE, + NULL_TREE)); + ASM_INPUT_P (stmt) = 1; + return stmt; + } + + error ("argument of `asm' is not a constant string"); + return NULL_TREE; +} + /* Build an asm-statement, whose components are a CV_QUALIFIER, a STRING, some OUTPUTS, some INPUTS, and some CLOBBERS. */ |