aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/parse.y
diff options
context:
space:
mode:
authorAlexandre Petit-Bianco <apbianco@cygnus.com>2000-04-19 01:53:47 +0000
committerAlexandre Petit-Bianco <apbianco@gcc.gnu.org>2000-04-18 18:53:47 -0700
commit48a840d9102deba764852463142b5118442908c7 (patch)
treeb6fc642a79e2bdcb6be5a394fee1f64f3daf12ab /gcc/java/parse.y
parent20c8a6c293e18defd58cb15f707c22b11886d95a (diff)
downloadgcc-48a840d9102deba764852463142b5118442908c7.zip
gcc-48a840d9102deba764852463142b5118442908c7.tar.gz
gcc-48a840d9102deba764852463142b5118442908c7.tar.bz2
[multiple changes]
2000-04-18 Alexandre Petit-Bianco <apbianco@cygnus.com> * parse.y (maybe_make_nested_class_name): Use `obstack_grow0'. 2000-04-14 Alexandre Petit-Bianco <apbianco@cygnus.com> * parse.y (java_expand_classes): Reverse the package list once. (java_complete_lhs): PLUS_EXPR: don't try rhs and lhs at string reduction. (patch_binop): New temp `cn'. Call patch_string on LHS/RHS of the `==' and `!=' operators. From-SVN: r33240
Diffstat (limited to 'gcc/java/parse.y')
-rw-r--r--gcc/java/parse.y32
1 files changed, 24 insertions, 8 deletions
diff --git a/gcc/java/parse.y b/gcc/java/parse.y
index 17e74c2..dc41808 100644
--- a/gcc/java/parse.y
+++ b/gcc/java/parse.y
@@ -3539,9 +3539,9 @@ maybe_make_nested_class_name (name)
if (CPC_INNER_P ())
{
make_nested_class_name (GET_CPC_LIST ());
- obstack_grow (&temporary_obstack,
- IDENTIFIER_POINTER (name),
- IDENTIFIER_LENGTH (name));
+ obstack_grow0 (&temporary_obstack,
+ IDENTIFIER_POINTER (name),
+ IDENTIFIER_LENGTH (name));
id = get_identifier (obstack_finish (&temporary_obstack));
if (ctxp->package)
QUALIFIED_P (id) = 1;
@@ -8239,6 +8239,12 @@ java_expand_classes ()
java_layout_classes ();
java_parse_abort_on_error ();
+ /* The list of packages declaration seen so far needs to be
+ reversed, so that package declared in a file being compiled gets
+ priority over packages declared as a side effect of parsing other
+ files.*/
+ package_list = nreverse (package_list);
+
saved_ctxp = ctxp_for_generation;
for (; ctxp_for_generation; ctxp_for_generation = ctxp_for_generation->next)
{
@@ -10963,8 +10969,7 @@ java_complete_lhs (node)
nn = java_complete_tree (wfl_op1);
if (nn == error_mark_node)
return error_mark_node;
- if ((cn = patch_string (nn)))
- nn = cn;
+
TREE_OPERAND (node, 0) = nn;
}
if (TREE_CODE (node) != PLUS_EXPR || !JSTRING_P (wfl_op2))
@@ -10972,8 +10977,7 @@ java_complete_lhs (node)
nn = java_complete_tree (wfl_op2);
if (nn == error_mark_node)
return error_mark_node;
- if ((cn = patch_string (nn)))
- nn = cn;
+
TREE_OPERAND (node, 1) = nn;
}
return force_evaluation_order (patch_binop (node, wfl_op1, wfl_op2));
@@ -12089,7 +12093,7 @@ patch_binop (node, wfl_op1, wfl_op2)
tree op2 = TREE_OPERAND (node, 1);
tree op1_type = TREE_TYPE (op1);
tree op2_type = TREE_TYPE (op2);
- tree prom_type = NULL_TREE;
+ tree prom_type = NULL_TREE, cn;
int code = TREE_CODE (node);
/* If 1, tell the routine that we have to return error_mark_node
@@ -12367,6 +12371,18 @@ patch_binop (node, wfl_op1, wfl_op2)
/* 15.20 Equality Operator */
case EQ_EXPR:
case NE_EXPR:
+ /* It's time for us to patch the strings. */
+ if ((cn = patch_string (op1)))
+ {
+ op1 = cn;
+ op1_type = TREE_TYPE (op1);
+ }
+ if ((cn = patch_string (op2)))
+ {
+ op2 = cn;
+ op2_type = TREE_TYPE (op2);
+ }
+
/* 15.20.1 Numerical Equality Operators == and != */
/* Binary numeric promotion is performed on the operands */
if (JNUMERIC_TYPE_P (op1_type) && JNUMERIC_TYPE_P (op2_type))