diff options
author | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-05-11 06:38:48 +0000 |
---|---|---|
committer | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-05-11 06:38:48 +0000 |
commit | d0a47c8d249dba52c8718c62d27990a4f18f2a34 (patch) | |
tree | 1a696e8ab4e8b4b64edcb8b6dc6f47202bb5ddae /gcc/c-common.c | |
parent | 84cadbf70ff877cd28c0febff558fab5aa0e4a31 (diff) | |
download | gcc-d0a47c8d249dba52c8718c62d27990a4f18f2a34.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@41959 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index a1dc31c3160..f037ecc9ae3 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -4193,6 +4193,39 @@ c_add_case_label (cases, cond, low_value, high_value) return case_label; } +/* Finish an expression taking the address of LABEL. Returns an + expression for the address. */ + +tree +finish_label_address_expr (label) + tree label; +{ + tree result; + + if (pedantic) + { + if (c_language == clk_cplusplus) + pedwarn ("ISO C++ forbids taking the address of a label"); + else + pedwarn ("ISO C forbids taking the address of a label"); + } + + label = lookup_label (label); + if (label == NULL_TREE) + result = null_pointer_node; + else + { + TREE_USED (label) = 1; + result = build1 (ADDR_EXPR, ptr_type_node, label); + TREE_CONSTANT (result) = 1; + /* The current function in not necessarily uninlinable. + Computed gotos are incompatible with inlining, but the value + here could be used only in a diagnostic, for example. */ + } + + return result; +} + /* Mark P (a stmt_tree) for GC. The use of a `void *' for the parameter allows this function to be used as a GC-marking function. */ |