Commit 34f4db93 by Alexandre Petit-Bianco Committed by Alexandre Petit-Bianco

parse.h: DECL_P renamed JDECL_P.

Mon Feb  8 11:50:50 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>
	* parse.h: DECL_P renamed JDECL_P.
        * parse.y: DECL_P replaced by JDECL_P.
        (build_array_from_name): Always use pointer's type.
        (patch_bc_statement): Extra code to search continue target in a
        for loop. Fixed comments. Continue target is current loop when
        unlabeled.

From-SVN: r25082
parent 9691f3a1
Mon Feb 8 11:50:50 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.h: DECL_P renamed JDECL_P.
* parse.y: DECL_P replaced by JDECL_P.
(build_array_from_name): Always use pointer's type.
(patch_bc_statement): Extra code to search continue target in a
for loop. Fixed comments. Continue target is current loop when
unlabeled.
1999-02-05 Andrew Haley <aph@cygnus.com> 1999-02-05 Andrew Haley <aph@cygnus.com>
* class.c (make_class_data): The superclass of an interface should * class.c (make_class_data): The superclass of an interface should
......
...@@ -5315,10 +5315,9 @@ build_array_from_name (type, type_wfl, name, ret_name) ...@@ -5315,10 +5315,9 @@ build_array_from_name (type, type_wfl, name, ret_name)
{ {
name = get_identifier (&more_dims [string]); name = get_identifier (&more_dims [string]);
/* If type already is a reference on an array, get the base type */ /* If we have a pointer, use its type */
if ((TREE_CODE (type) == POINTER_TYPE) && if (TREE_CODE (type) == POINTER_TYPE)
TYPE_ARRAY_P (TREE_TYPE (type))) type = TREE_TYPE (type);
type = TREE_TYPE (type);
/* Building the first dimension of a primitive type uses this /* Building the first dimension of a primitive type uses this
function */ function */
...@@ -8741,14 +8740,14 @@ resolve_field_access (qual_wfl, field_decl, field_type) ...@@ -8741,14 +8740,14 @@ resolve_field_access (qual_wfl, field_decl, field_type)
} }
/* We might have been trying to resolve field.method(). In which /* We might have been trying to resolve field.method(). In which
case, the resolution is over and decl is the answer */ case, the resolution is over and decl is the answer */
else if (DECL_P (decl) && IDENTIFIER_LOCAL_VALUE (DECL_NAME (decl)) == decl) else if (JDECL_P (decl) && IDENTIFIER_LOCAL_VALUE (DECL_NAME (decl)) == decl)
field_ref = decl; field_ref = decl;
else if (DECL_P (decl)) else if (JDECL_P (decl))
{ {
int static_final_found = 0; int static_final_found = 0;
if (!type_found) if (!type_found)
type_found = DECL_CONTEXT (decl); type_found = DECL_CONTEXT (decl);
is_static = DECL_P (decl) && FIELD_STATIC (decl); is_static = JDECL_P (decl) && FIELD_STATIC (decl);
if (FIELD_FINAL (decl) if (FIELD_FINAL (decl)
&& JPRIMITIVE_TYPE_P (TREE_TYPE (decl)) && JPRIMITIVE_TYPE_P (TREE_TYPE (decl))
&& DECL_LANG_SPECIFIC (decl) && DECL_LANG_SPECIFIC (decl)
...@@ -8813,7 +8812,7 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found) ...@@ -8813,7 +8812,7 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found)
case NEW_CLASS_EXPR: case NEW_CLASS_EXPR:
/* If the access to the function call is a non static field, /* If the access to the function call is a non static field,
build the code to access it. */ build the code to access it. */
if (DECL_P (decl) && !FIELD_STATIC (decl)) if (JDECL_P (decl) && !FIELD_STATIC (decl))
{ {
decl = maybe_access_field (decl, *where_found, decl = maybe_access_field (decl, *where_found,
DECL_CONTEXT (decl)); DECL_CONTEXT (decl));
...@@ -8874,7 +8873,7 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found) ...@@ -8874,7 +8873,7 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found)
case ARRAY_REF: case ARRAY_REF:
/* If the access to the function call is a non static field, /* If the access to the function call is a non static field,
build the code to access it. */ build the code to access it. */
if (DECL_P (decl) && !FIELD_STATIC (decl)) if (JDECL_P (decl) && !FIELD_STATIC (decl))
{ {
decl = maybe_access_field (decl, *where_found, type); decl = maybe_access_field (decl, *where_found, type);
if (decl == error_mark_node) if (decl == error_mark_node)
...@@ -10518,7 +10517,7 @@ java_complete_lhs (node) ...@@ -10518,7 +10517,7 @@ java_complete_lhs (node)
patch_assignment (node, wfl_op1, wfl_op2); patch_assignment (node, wfl_op1, wfl_op2);
/* Now, we still mark the lhs as initialized */ /* Now, we still mark the lhs as initialized */
if (DECL_P (TREE_OPERAND (node, 0))) if (JDECL_P (TREE_OPERAND (node, 0)))
INITIALIZED_P (TREE_OPERAND (node, 0)) = 1; INITIALIZED_P (TREE_OPERAND (node, 0)) = 1;
return error_mark_node; return error_mark_node;
...@@ -10958,7 +10957,7 @@ static int ...@@ -10958,7 +10957,7 @@ static int
check_final_assignment (lvalue, wfl) check_final_assignment (lvalue, wfl)
tree lvalue, wfl; tree lvalue, wfl;
{ {
if (DECL_P (lvalue) && FIELD_FINAL (lvalue) && if (JDECL_P (lvalue) && FIELD_FINAL (lvalue) &&
DECL_NAME (current_function_decl) != clinit_identifier_node) DECL_NAME (current_function_decl) != clinit_identifier_node)
{ {
parse_error_context parse_error_context
...@@ -11015,7 +11014,7 @@ patch_assignment (node, wfl_op1, wfl_op2) ...@@ -11015,7 +11014,7 @@ patch_assignment (node, wfl_op1, wfl_op2)
EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
/* Lhs can be a named variable */ /* Lhs can be a named variable */
if (DECL_P (lvalue)) if (JDECL_P (lvalue))
{ {
INITIALIZED_P (lvalue) = 1; INITIALIZED_P (lvalue) = 1;
lhs_type = TREE_TYPE (lvalue); lhs_type = TREE_TYPE (lvalue);
...@@ -12126,9 +12125,9 @@ patch_unaryop (node, wfl_op) ...@@ -12126,9 +12125,9 @@ patch_unaryop (node, wfl_op)
case PREINCREMENT_EXPR: case PREINCREMENT_EXPR:
/* 15.14.2 Prefix Decrement Operator -- */ /* 15.14.2 Prefix Decrement Operator -- */
case PREDECREMENT_EXPR: case PREDECREMENT_EXPR:
if (!DECL_P (op) && !((TREE_CODE (op) == INDIRECT_REF if (!JDECL_P (op) && !((TREE_CODE (op) == INDIRECT_REF
|| TREE_CODE (op) == COMPONENT_REF) || TREE_CODE (op) == COMPONENT_REF)
&& JPRIMITIVE_TYPE_P (TREE_TYPE (op)))) && JPRIMITIVE_TYPE_P (TREE_TYPE (op))))
{ {
tree lvalue; tree lvalue;
/* Before screaming, check that we're not in fact trying to /* Before screaming, check that we're not in fact trying to
...@@ -12929,7 +12928,7 @@ build_new_loop (loop_body) ...@@ -12929,7 +12928,7 @@ build_new_loop (loop_body)
COMPOUND_EXPR (loop main body) COMPOUND_EXPR (loop main body)
EXIT_EXPR (this order is for while/for loops. EXIT_EXPR (this order is for while/for loops.
LABELED_BLOCK_EXPR the order is reversed for do loops) LABELED_BLOCK_EXPR the order is reversed for do loops)
LABEL_DECL (continue occurding here branche at the LABEL_DECL (a continue occuring here branches at the
BODY end of this labeled block) BODY end of this labeled block)
INCREMENT (if any) INCREMENT (if any)
...@@ -13120,6 +13119,16 @@ patch_bc_statement (node) ...@@ -13120,6 +13119,16 @@ patch_bc_statement (node)
/* Find the statement we're targeting. */ /* Find the statement we're targeting. */
target_stmt = LABELED_BLOCK_BODY (bc_label); target_stmt = LABELED_BLOCK_BODY (bc_label);
/* Target loop is slightly burrowed in the case of a for loop, it
appears at the first sight to be a block. */
if (TREE_CODE (target_stmt) == BLOCK)
{
tree sub = BLOCK_SUBBLOCKS (target_stmt);
if (sub && TREE_CODE (sub) == COMPOUND_EXPR && TREE_OPERAND (sub, 1)
&& TREE_CODE (TREE_OPERAND (sub, 1)) == LOOP_EXPR)
target_stmt = TREE_OPERAND (sub, 1);
}
/* 14.13 The break Statement */ /* 14.13 The break Statement */
if (IS_BREAK_STMT_P (node)) if (IS_BREAK_STMT_P (node))
{ {
...@@ -13128,7 +13137,7 @@ patch_bc_statement (node) ...@@ -13128,7 +13137,7 @@ patch_bc_statement (node)
while/do/for/switch */ while/do/for/switch */
if (is_unlabeled && if (is_unlabeled &&
!(TREE_CODE (target_stmt) == LOOP_EXPR /* do/while/for */ !(TREE_CODE (target_stmt) == LOOP_EXPR /* do/while/for */
|| TREE_CODE (target_stmt) == SWITCH_EXPR)) /* switch FIXME */ || TREE_CODE (target_stmt) == SWITCH_EXPR)) /* switch */
{ {
parse_error_context (wfl_operator, parse_error_context (wfl_operator,
"`break' must be in loop or switch"); "`break' must be in loop or switch");
...@@ -13139,18 +13148,21 @@ patch_bc_statement (node) ...@@ -13139,18 +13148,21 @@ patch_bc_statement (node)
EXIT_BLOCK_LABELED_BLOCK (node) = bc_label; EXIT_BLOCK_LABELED_BLOCK (node) = bc_label;
} }
/* 14.14 The continue Statement */ /* 14.14 The continue Statement */
/* The continue statement must always target a loop */ /* The continue statement must always target a loop, unnamed or not. */
else else
{ {
if (TREE_CODE (target_stmt) != LOOP_EXPR) /* do/while/for */ if (TREE_CODE (target_stmt) != LOOP_EXPR) /* do/while/for */
{ {
parse_error_context (wfl_operator, "`continue' must be in loop"); parse_error_context (wfl_operator, "`continue' must be in loop");
return error_mark_node; return error_mark_node;
} }
/* Everything looks good. We can fix the `continue' jump to go /* Everything looks good. We can fix the `continue' jump to go
at the place in the loop were the continue is. The continue at the place in the loop were the continue is. For unlabeled
is the current labeled block, by construction. */ continue, the continuation point is the current labeled
EXIT_BLOCK_LABELED_BLOCK (node) = bc_label = ctxp->current_labeled_block; block, by construction. */
if (is_unlabeled)
EXIT_BLOCK_LABELED_BLOCK (node) =
bc_label = ctxp->current_labeled_block;
} }
CAN_COMPLETE_NORMALLY (bc_label) = 1; CAN_COMPLETE_NORMALLY (bc_label) = 1;
......
...@@ -193,9 +193,9 @@ extern tree stabilize_reference PROTO ((tree)); ...@@ -193,9 +193,9 @@ extern tree stabilize_reference PROTO ((tree));
&& (TYPE) == TREE_TYPE (null_pointer_node)) && (TYPE) == TREE_TYPE (null_pointer_node))
/* Other predicate */ /* Other predicate */
#define DECL_P(NODE) (NODE && (TREE_CODE (NODE) == PARM_DECL \ #define JDECL_P(NODE) (NODE && (TREE_CODE (NODE) == PARM_DECL \
|| TREE_CODE (NODE) == VAR_DECL \ || TREE_CODE (NODE) == VAR_DECL \
|| TREE_CODE (NODE) == FIELD_DECL)) || TREE_CODE (NODE) == FIELD_DECL))
#define TYPE_INTERFACE_P(TYPE) \ #define TYPE_INTERFACE_P(TYPE) \
(CLASS_P (TYPE) && CLASS_INTERFACE (TYPE_NAME (TYPE))) (CLASS_P (TYPE) && CLASS_INTERFACE (TYPE_NAME (TYPE)))
......
...@@ -2677,10 +2677,9 @@ build_array_from_name (type, type_wfl, name, ret_name) ...@@ -2677,10 +2677,9 @@ build_array_from_name (type, type_wfl, name, ret_name)
{ {
name = get_identifier (&more_dims [string]); name = get_identifier (&more_dims [string]);
/* If type already is a reference on an array, get the base type */ /* If we have a pointer, use its type */
if ((TREE_CODE (type) == POINTER_TYPE) && if (TREE_CODE (type) == POINTER_TYPE)
TYPE_ARRAY_P (TREE_TYPE (type))) type = TREE_TYPE (type);
type = TREE_TYPE (type);
/* Building the first dimension of a primitive type uses this /* Building the first dimension of a primitive type uses this
function */ function */
...@@ -6103,14 +6102,14 @@ resolve_field_access (qual_wfl, field_decl, field_type) ...@@ -6103,14 +6102,14 @@ resolve_field_access (qual_wfl, field_decl, field_type)
} }
/* We might have been trying to resolve field.method(). In which /* We might have been trying to resolve field.method(). In which
case, the resolution is over and decl is the answer */ case, the resolution is over and decl is the answer */
else if (DECL_P (decl) && IDENTIFIER_LOCAL_VALUE (DECL_NAME (decl)) == decl) else if (JDECL_P (decl) && IDENTIFIER_LOCAL_VALUE (DECL_NAME (decl)) == decl)
field_ref = decl; field_ref = decl;
else if (DECL_P (decl)) else if (JDECL_P (decl))
{ {
int static_final_found = 0; int static_final_found = 0;
if (!type_found) if (!type_found)
type_found = DECL_CONTEXT (decl); type_found = DECL_CONTEXT (decl);
is_static = DECL_P (decl) && FIELD_STATIC (decl); is_static = JDECL_P (decl) && FIELD_STATIC (decl);
if (FIELD_FINAL (decl) if (FIELD_FINAL (decl)
&& JPRIMITIVE_TYPE_P (TREE_TYPE (decl)) && JPRIMITIVE_TYPE_P (TREE_TYPE (decl))
&& DECL_LANG_SPECIFIC (decl) && DECL_LANG_SPECIFIC (decl)
...@@ -6175,7 +6174,7 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found) ...@@ -6175,7 +6174,7 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found)
case NEW_CLASS_EXPR: case NEW_CLASS_EXPR:
/* If the access to the function call is a non static field, /* If the access to the function call is a non static field,
build the code to access it. */ build the code to access it. */
if (DECL_P (decl) && !FIELD_STATIC (decl)) if (JDECL_P (decl) && !FIELD_STATIC (decl))
{ {
decl = maybe_access_field (decl, *where_found, decl = maybe_access_field (decl, *where_found,
DECL_CONTEXT (decl)); DECL_CONTEXT (decl));
...@@ -6236,7 +6235,7 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found) ...@@ -6236,7 +6235,7 @@ resolve_qualified_expression_name (wfl, found_decl, where_found, type_found)
case ARRAY_REF: case ARRAY_REF:
/* If the access to the function call is a non static field, /* If the access to the function call is a non static field,
build the code to access it. */ build the code to access it. */
if (DECL_P (decl) && !FIELD_STATIC (decl)) if (JDECL_P (decl) && !FIELD_STATIC (decl))
{ {
decl = maybe_access_field (decl, *where_found, type); decl = maybe_access_field (decl, *where_found, type);
if (decl == error_mark_node) if (decl == error_mark_node)
...@@ -7880,7 +7879,7 @@ java_complete_lhs (node) ...@@ -7880,7 +7879,7 @@ java_complete_lhs (node)
patch_assignment (node, wfl_op1, wfl_op2); patch_assignment (node, wfl_op1, wfl_op2);
/* Now, we still mark the lhs as initialized */ /* Now, we still mark the lhs as initialized */
if (DECL_P (TREE_OPERAND (node, 0))) if (JDECL_P (TREE_OPERAND (node, 0)))
INITIALIZED_P (TREE_OPERAND (node, 0)) = 1; INITIALIZED_P (TREE_OPERAND (node, 0)) = 1;
return error_mark_node; return error_mark_node;
...@@ -8320,7 +8319,7 @@ static int ...@@ -8320,7 +8319,7 @@ static int
check_final_assignment (lvalue, wfl) check_final_assignment (lvalue, wfl)
tree lvalue, wfl; tree lvalue, wfl;
{ {
if (DECL_P (lvalue) && FIELD_FINAL (lvalue) && if (JDECL_P (lvalue) && FIELD_FINAL (lvalue) &&
DECL_NAME (current_function_decl) != clinit_identifier_node) DECL_NAME (current_function_decl) != clinit_identifier_node)
{ {
parse_error_context parse_error_context
...@@ -8377,7 +8376,7 @@ patch_assignment (node, wfl_op1, wfl_op2) ...@@ -8377,7 +8376,7 @@ patch_assignment (node, wfl_op1, wfl_op2)
EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node); EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
/* Lhs can be a named variable */ /* Lhs can be a named variable */
if (DECL_P (lvalue)) if (JDECL_P (lvalue))
{ {
INITIALIZED_P (lvalue) = 1; INITIALIZED_P (lvalue) = 1;
lhs_type = TREE_TYPE (lvalue); lhs_type = TREE_TYPE (lvalue);
...@@ -9488,9 +9487,9 @@ patch_unaryop (node, wfl_op) ...@@ -9488,9 +9487,9 @@ patch_unaryop (node, wfl_op)
case PREINCREMENT_EXPR: case PREINCREMENT_EXPR:
/* 15.14.2 Prefix Decrement Operator -- */ /* 15.14.2 Prefix Decrement Operator -- */
case PREDECREMENT_EXPR: case PREDECREMENT_EXPR:
if (!DECL_P (op) && !((TREE_CODE (op) == INDIRECT_REF if (!JDECL_P (op) && !((TREE_CODE (op) == INDIRECT_REF
|| TREE_CODE (op) == COMPONENT_REF) || TREE_CODE (op) == COMPONENT_REF)
&& JPRIMITIVE_TYPE_P (TREE_TYPE (op)))) && JPRIMITIVE_TYPE_P (TREE_TYPE (op))))
{ {
tree lvalue; tree lvalue;
/* Before screaming, check that we're not in fact trying to /* Before screaming, check that we're not in fact trying to
...@@ -10291,7 +10290,7 @@ build_new_loop (loop_body) ...@@ -10291,7 +10290,7 @@ build_new_loop (loop_body)
COMPOUND_EXPR (loop main body) COMPOUND_EXPR (loop main body)
EXIT_EXPR (this order is for while/for loops. EXIT_EXPR (this order is for while/for loops.
LABELED_BLOCK_EXPR the order is reversed for do loops) LABELED_BLOCK_EXPR the order is reversed for do loops)
LABEL_DECL (continue occurding here branche at the LABEL_DECL (a continue occuring here branches at the
BODY end of this labeled block) BODY end of this labeled block)
INCREMENT (if any) INCREMENT (if any)
...@@ -10482,6 +10481,16 @@ patch_bc_statement (node) ...@@ -10482,6 +10481,16 @@ patch_bc_statement (node)
/* Find the statement we're targeting. */ /* Find the statement we're targeting. */
target_stmt = LABELED_BLOCK_BODY (bc_label); target_stmt = LABELED_BLOCK_BODY (bc_label);
/* Target loop is slightly burrowed in the case of a for loop, it
appears at the first sight to be a block. */
if (TREE_CODE (target_stmt) == BLOCK)
{
tree sub = BLOCK_SUBBLOCKS (target_stmt);
if (sub && TREE_CODE (sub) == COMPOUND_EXPR && TREE_OPERAND (sub, 1)
&& TREE_CODE (TREE_OPERAND (sub, 1)) == LOOP_EXPR)
target_stmt = TREE_OPERAND (sub, 1);
}
/* 14.13 The break Statement */ /* 14.13 The break Statement */
if (IS_BREAK_STMT_P (node)) if (IS_BREAK_STMT_P (node))
{ {
...@@ -10490,7 +10499,7 @@ patch_bc_statement (node) ...@@ -10490,7 +10499,7 @@ patch_bc_statement (node)
while/do/for/switch */ while/do/for/switch */
if (is_unlabeled && if (is_unlabeled &&
!(TREE_CODE (target_stmt) == LOOP_EXPR /* do/while/for */ !(TREE_CODE (target_stmt) == LOOP_EXPR /* do/while/for */
|| TREE_CODE (target_stmt) == SWITCH_EXPR)) /* switch FIXME */ || TREE_CODE (target_stmt) == SWITCH_EXPR)) /* switch */
{ {
parse_error_context (wfl_operator, parse_error_context (wfl_operator,
"`break' must be in loop or switch"); "`break' must be in loop or switch");
...@@ -10501,18 +10510,21 @@ patch_bc_statement (node) ...@@ -10501,18 +10510,21 @@ patch_bc_statement (node)
EXIT_BLOCK_LABELED_BLOCK (node) = bc_label; EXIT_BLOCK_LABELED_BLOCK (node) = bc_label;
} }
/* 14.14 The continue Statement */ /* 14.14 The continue Statement */
/* The continue statement must always target a loop */ /* The continue statement must always target a loop, unnamed or not. */
else else
{ {
if (TREE_CODE (target_stmt) != LOOP_EXPR) /* do/while/for */ if (TREE_CODE (target_stmt) != LOOP_EXPR) /* do/while/for */
{ {
parse_error_context (wfl_operator, "`continue' must be in loop"); parse_error_context (wfl_operator, "`continue' must be in loop");
return error_mark_node; return error_mark_node;
} }
/* Everything looks good. We can fix the `continue' jump to go /* Everything looks good. We can fix the `continue' jump to go
at the place in the loop were the continue is. The continue at the place in the loop were the continue is. For unlabeled
is the current labeled block, by construction. */ continue, the continuation point is the current labeled
EXIT_BLOCK_LABELED_BLOCK (node) = bc_label = ctxp->current_labeled_block; block, by construction. */
if (is_unlabeled)
EXIT_BLOCK_LABELED_BLOCK (node) =
bc_label = ctxp->current_labeled_block;
} }
CAN_COMPLETE_NORMALLY (bc_label) = 1; CAN_COMPLETE_NORMALLY (bc_label) = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment