Commit 0b4d333e by Alexandre Petit-Bianco Committed by Alexandre Petit-Bianco

[multiple changes]

Thu Jan 28 11:50:11 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>
	* jcf-parse.c (jcf_parse): Don't parse the same class file twice.
	* parse.y (patch_cast): Allow a boolean to be cast into a
 	boolean.
Wed Jan 27 10:19:29 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>
	* parse.y: (class_declaration:): Fixed indentation.
	(class_member_declaration:): Extra `;' after field declaration now
 	accepted.
	(interface_declaration:): Removed debug messages in error reports.
	(patch_binop): Nodes created and returned inherit the orignal
 	node's COMPOUND_ASSIGN_P flag value.
	(patch_cast): Fix cast from char to floating point.

From-SVN: r25244
parent 4393e105
...@@ -154,6 +154,22 @@ Thu Jan 28 14:45:39 1999 Per Bothner <bothner@cygnus.com> ...@@ -154,6 +154,22 @@ Thu Jan 28 14:45:39 1999 Per Bothner <bothner@cygnus.com>
Handle TRUTH_AND_EXPR, TRUTH_OR_EXPR, and TRUTH_XOR_EXPR. Handle TRUTH_AND_EXPR, TRUTH_OR_EXPR, and TRUTH_XOR_EXPR.
* jcf-write.c (generate_bytecode_insns): Likewise. * jcf-write.c (generate_bytecode_insns): Likewise.
Thu Jan 28 11:50:11 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* jcf-parse.c (jcf_parse): Don't parse the same class file twice.
* parse.y (patch_cast): Allow a boolean to be cast into a
boolean.
Wed Jan 27 10:19:29 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y: (class_declaration:): Fixed indentation.
(class_member_declaration:): Extra `;' after field declaration now
accepted.
(interface_declaration:): Removed debug messages in error reports.
(patch_binop): Nodes created and returned inherit the orignal
node's COMPOUND_ASSIGN_P flag value.
(patch_cast): Fix cast from char to floating point.
Mon Jan 25 17:39:19 1999 Andrew Haley <aph@cygnus.com> Mon Jan 25 17:39:19 1999 Andrew Haley <aph@cygnus.com>
* except.c, java-except.h (expand_resume_after_catch): new * except.c, java-except.h (expand_resume_after_catch): new
......
...@@ -605,6 +605,8 @@ jcf_parse (jcf) ...@@ -605,6 +605,8 @@ jcf_parse (jcf)
if (! quiet_flag && TYPE_NAME (current_class)) if (! quiet_flag && TYPE_NAME (current_class))
fprintf (stderr, " class %s", fprintf (stderr, " class %s",
IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class)))); IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))));
if (CLASS_LOADED_P (current_class))
return;
CLASS_LOADED_P (current_class) = 1; CLASS_LOADED_P (current_class) = 1;
for (i = 1; i < JPOOL_SIZE(jcf); i++) for (i = 1; i < JPOOL_SIZE(jcf); i++)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -671,7 +671,10 @@ class_declaration: ...@@ -671,7 +671,10 @@ class_declaration:
| CLASS_TK error | CLASS_TK error
{yyerror ("Missing class name"); RECOVER;} {yyerror ("Missing class name"); RECOVER;}
| CLASS_TK identifier error | CLASS_TK identifier error
{if (!ctxp->class_err) yyerror ("'{' expected"); DRECOVER(class1);} {
if (!ctxp->class_err) yyerror ("'{' expected");
DRECOVER(class1);
}
| modifiers CLASS_TK identifier error | modifiers CLASS_TK identifier error
{if (!ctxp->class_err) yyerror ("'{' expected"); RECOVER;} {if (!ctxp->class_err) yyerror ("'{' expected"); RECOVER;}
; ;
...@@ -734,6 +737,8 @@ class_body_declaration: ...@@ -734,6 +737,8 @@ class_body_declaration:
class_member_declaration: class_member_declaration:
field_declaration field_declaration
| field_declaration SC_TK
{ $$ = $1; }
| method_declaration | method_declaration
| class_declaration /* Added, JDK1.1 inner classes */ | class_declaration /* Added, JDK1.1 inner classes */
{ $$ = parse_jdk1_1_error ("inner classe declaration"); } { $$ = parse_jdk1_1_error ("inner classe declaration"); }
...@@ -1044,9 +1049,9 @@ interface_declaration: ...@@ -1044,9 +1049,9 @@ interface_declaration:
$$ = $6; $$ = $6;
} }
| INTERFACE_TK identifier error | INTERFACE_TK identifier error
{yyerror ("(here)'{' expected"); RECOVER;} {yyerror ("'{' expected"); RECOVER;}
| modifiers INTERFACE_TK identifier error | modifiers INTERFACE_TK identifier error
{yyerror ("(there)'{' expected"); RECOVER;} {yyerror ("'{' expected"); RECOVER;}
; ;
extends_interfaces: extends_interfaces:
...@@ -8903,10 +8908,16 @@ patch_binop (node, wfl_op1, wfl_op2) ...@@ -8903,10 +8908,16 @@ patch_binop (node, wfl_op1, wfl_op2)
/* Change the division operator if necessary */ /* Change the division operator if necessary */
if (code == RDIV_EXPR && TREE_CODE (prom_type) == INTEGER_TYPE) if (code == RDIV_EXPR && TREE_CODE (prom_type) == INTEGER_TYPE)
TREE_SET_CODE (node, TRUNC_DIV_EXPR); TREE_SET_CODE (node, TRUNC_DIV_EXPR);
/* This one is more complicated. FLOATs are processed by a function
call to soft_fmod. */ /* This one is more complicated. FLOATs are processed by a
function call to soft_fmod. Duplicate the value of the
COMPOUND_ASSIGN_P flag. */
if (code == TRUNC_MOD_EXPR) if (code == TRUNC_MOD_EXPR)
return build_java_binop (TRUNC_MOD_EXPR, prom_type, op1, op2); {
tree mod = build_java_binop (TRUNC_MOD_EXPR, prom_type, op1, op2);
COMPOUND_ASSIGN_P (mod) = COMPOUND_ASSIGN_P (node);
return mod;
}
break; break;
/* 15.17 Additive Operators */ /* 15.17 Additive Operators */
...@@ -8981,13 +8992,17 @@ patch_binop (node, wfl_op1, wfl_op2) ...@@ -8981,13 +8992,17 @@ patch_binop (node, wfl_op1, wfl_op2)
/* The >>> operator is a >> operating on unsigned quantities */ /* The >>> operator is a >> operating on unsigned quantities */
if (code == URSHIFT_EXPR && ! flag_emit_class_files) if (code == URSHIFT_EXPR && ! flag_emit_class_files)
{ {
tree to_return;
tree utype = unsigned_type (prom_type); tree utype = unsigned_type (prom_type);
op1 = convert (utype, op1); op1 = convert (utype, op1);
TREE_SET_CODE (node, RSHIFT_EXPR); TREE_SET_CODE (node, RSHIFT_EXPR);
TREE_OPERAND (node, 0) = op1; TREE_OPERAND (node, 0) = op1;
TREE_OPERAND (node, 1) = op2; TREE_OPERAND (node, 1) = op2;
TREE_TYPE (node) = utype; TREE_TYPE (node) = utype;
return convert (prom_type, node); to_return = convert (prom_type, node);
/* Copy the original value of the COMPOUND_ASSIGN_P flag */
COMPOUND_ASSIGN_P (to_return) = COMPOUND_ASSIGN_P (node);
return to_return;
} }
break; break;
...@@ -9656,12 +9671,21 @@ patch_cast (node, wfl_operator) ...@@ -9656,12 +9671,21 @@ patch_cast (node, wfl_operator)
if (cast_type == op_type) if (cast_type == op_type)
return node; return node;
/* float and double type are converted to the original type main
variant and then to the target type. */
if (JFLOAT_TYPE_P (op_type) && TREE_CODE (cast_type) == CHAR_TYPE)
op = convert (integer_type_node, op);
/* Try widening/narowwing convertion. Potentially, things need /* Try widening/narowwing convertion. Potentially, things need
to be worked out in gcc so we implement the extreme cases to be worked out in gcc so we implement the extreme cases
correctly. fold_convert() needs to be fixed. */ correctly. fold_convert() needs to be fixed. */
return convert (cast_type, op); return convert (cast_type, op);
} }
/* It's also valid to cast a boolean into a boolean */
if (op_type == boolean_type_node && cast_type == boolean_type_node)
return node;
/* null can be casted to references */ /* null can be casted to references */
if (op == null_pointer_node && JREFERENCE_TYPE_P (cast_type)) if (op == null_pointer_node && JREFERENCE_TYPE_P (cast_type))
return build_null_of_type (cast_type); return build_null_of_type (cast_type);
......
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