aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.demon.co.uk>2001-05-11 06:38:48 +0000
committerNeil Booth <neil@gcc.gnu.org>2001-05-11 06:38:48 +0000
commit15b732b28893897ac585cf62e2646f001a22531f (patch)
tree1a696e8ab4e8b4b64edcb8b6dc6f47202bb5ddae /gcc/c-common.c
parent8e93d44655a8a0cee4a687ac973a54d847e4924b (diff)
downloadgcc-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-common.c')
-rw-r--r--gcc/c-common.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index a1dc31c..f037ecc 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. */