* expression.h (exp_opcode): Add BINOP_MOD.
* eval.c (evaluate_subexp): Handle new BINOP_MOD. * expprint.c (dump_expression): Handle new BINOP_MOD. * language.c (binop_type_check): Handle new BINOP_MOD. * main.c (float_handler): Re-enable float handler when hit. * valarith.c (language.h): Include, need current_language. * valarith.c (TRUNCATION_TOWARDS_ZERO): Define default macro for integer divide truncates towards zero for negative results. * valarith.c (value_x_binop): Handle BINOP_MOD if seen. * valarith.c (value_binop): Allow arithmetic operations on TYPE_CODE_CHAR variables. Add case to handle new BINOP_MOD. **** start-sanitize-chill **** * ch-exp.y (operand_4): Add useful actions for MOD and REM. * ch-exp.y (tokentab3): Add MOD and REM. * ch-exp.y (yylex): Set innermost_block for symbols found in local scopes. Return LOCATION_NAME for local symbols. * ch-lang.c (chill_op_print_tab): Fix MOD entry to use BINOP_MOD instead of BINOP_REM. Add REM entry, using BINOP_REM. **** end-sanitize-chill ****
This commit is contained in:
parent
db81c5e7d5
commit
76a0ffb47b
@ -1,3 +1,25 @@
|
||||
Mon Jan 4 16:54:18 1993 Fred Fish (fnf@cygnus.com)
|
||||
|
||||
* expression.h (exp_opcode): Add BINOP_MOD.
|
||||
* eval.c (evaluate_subexp): Handle new BINOP_MOD.
|
||||
* expprint.c (dump_expression): Handle new BINOP_MOD.
|
||||
* language.c (binop_type_check): Handle new BINOP_MOD.
|
||||
* main.c (float_handler): Re-enable float handler when hit.
|
||||
* valarith.c (language.h): Include, need current_language.
|
||||
* valarith.c (TRUNCATION_TOWARDS_ZERO): Define default macro
|
||||
for integer divide truncates towards zero for negative results.
|
||||
* valarith.c (value_x_binop): Handle BINOP_MOD if seen.
|
||||
* valarith.c (value_binop): Allow arithmetic operations on
|
||||
TYPE_CODE_CHAR variables. Add case to handle new BINOP_MOD.
|
||||
**** start-sanitize-chill ****
|
||||
* ch-exp.y (operand_4): Add useful actions for MOD and REM.
|
||||
* ch-exp.y (tokentab3): Add MOD and REM.
|
||||
* ch-exp.y (yylex): Set innermost_block for symbols found
|
||||
in local scopes. Return LOCATION_NAME for local symbols.
|
||||
* ch-lang.c (chill_op_print_tab): Fix MOD entry to use
|
||||
BINOP_MOD instead of BINOP_REM. Add REM entry, using BINOP_REM.
|
||||
**** end-sanitize-chill ****
|
||||
|
||||
Sun Jan 3 14:24:56 1993 Steve Chamberlain (sac@thepub.cygnus.com)
|
||||
|
||||
* remote-sim.c: first attempt at general simulator interface
|
||||
|
26
gdb/ch-exp.y
26
gdb/ch-exp.y
@ -757,11 +757,11 @@ operand_4 : operand_5
|
||||
}
|
||||
| operand_4 MOD operand_5
|
||||
{
|
||||
$$ = 0; /* FIXME */
|
||||
write_exp_elt_opcode (BINOP_MOD);
|
||||
}
|
||||
| operand_4 REM operand_5
|
||||
{
|
||||
$$ = 0; /* FIXME */
|
||||
write_exp_elt_opcode (BINOP_REM);
|
||||
}
|
||||
;
|
||||
|
||||
@ -1390,6 +1390,8 @@ static const struct token tokentab4[] =
|
||||
|
||||
static const struct token tokentab3[] =
|
||||
{
|
||||
{ "MOD", MOD },
|
||||
{ "REM", REM },
|
||||
{ "NOT", NOT },
|
||||
{ "XOR", LOGXOR },
|
||||
{ "AND", LOGAND }
|
||||
@ -1564,17 +1566,27 @@ yylex ()
|
||||
case LOC_STATIC:
|
||||
/* Found a global or local static variable. */
|
||||
return (LOCATION_NAME);
|
||||
case LOC_UNDEF:
|
||||
case LOC_CONST:
|
||||
case LOC_REGISTER:
|
||||
case LOC_ARG:
|
||||
case LOC_REF_ARG:
|
||||
case LOC_REGPARM:
|
||||
case LOC_LOCAL:
|
||||
case LOC_TYPEDEF:
|
||||
case LOC_LABEL:
|
||||
case LOC_CONST_BYTES:
|
||||
case LOC_LOCAL_ARG:
|
||||
if (innermost_block == NULL
|
||||
|| contained_in (block_found, innermost_block))
|
||||
{
|
||||
innermost_block = block_found;
|
||||
}
|
||||
return (LOCATION_NAME);
|
||||
break;
|
||||
case LOC_CONST:
|
||||
case LOC_LABEL:
|
||||
return (LOCATION_NAME);
|
||||
break;
|
||||
case LOC_UNDEF:
|
||||
case LOC_TYPEDEF:
|
||||
case LOC_CONST_BYTES:
|
||||
error ("Symbol \"%s\" names no location.", simplename);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -246,7 +246,8 @@ static const struct op_print chill_op_print_tab[] = {
|
||||
{"AND", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
|
||||
{"OR", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
|
||||
{"NOT", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
|
||||
{"MOD", BINOP_REM, PREC_MUL, 0},
|
||||
{"MOD", BINOP_MOD, PREC_MUL, 0},
|
||||
{"REM", BINOP_REM, PREC_MUL, 0},
|
||||
{":=", BINOP_ASSIGN, PREC_ASSIGN, 1},
|
||||
{"=", BINOP_EQUAL, PREC_EQUAL, 0},
|
||||
{"/=", BINOP_NOTEQUAL, PREC_EQUAL, 0},
|
||||
|
@ -543,6 +543,7 @@ evaluate_subexp (expect_type, exp, pos, noside)
|
||||
case BINOP_MUL:
|
||||
case BINOP_DIV:
|
||||
case BINOP_REM:
|
||||
case BINOP_MOD:
|
||||
case BINOP_LSH:
|
||||
case BINOP_RSH:
|
||||
case BINOP_BITWISE_AND:
|
||||
@ -556,7 +557,7 @@ evaluate_subexp (expect_type, exp, pos, noside)
|
||||
return value_x_binop (arg1, arg2, op, OP_NULL);
|
||||
else
|
||||
if (noside == EVAL_AVOID_SIDE_EFFECTS
|
||||
&& (op == BINOP_DIV || op == BINOP_REM))
|
||||
&& (op == BINOP_DIV || op == BINOP_REM || op == BINOP_MOD))
|
||||
return value_zero (VALUE_TYPE (arg1), not_lval);
|
||||
else
|
||||
return value_binop (arg1, arg2, op);
|
||||
|
@ -447,6 +447,7 @@ dump_expression (exp, stream, note)
|
||||
case BINOP_MUL: opcode_name = "BINOP_MUL"; break;
|
||||
case BINOP_DIV: opcode_name = "BINOP_DIV"; break;
|
||||
case BINOP_REM: opcode_name = "BINOP_REM"; break;
|
||||
case BINOP_MOD: opcode_name = "BINOP_MOD"; break;
|
||||
case BINOP_LSH: opcode_name = "BINOP_LSH"; break;
|
||||
case BINOP_RSH: opcode_name = "BINOP_RSH"; break;
|
||||
case BINOP_LOGICAL_AND: opcode_name = "BINOP_LOGICAL_AND"; break;
|
||||
|
@ -52,6 +52,7 @@ enum exp_opcode
|
||||
BINOP_MUL, /* * */
|
||||
BINOP_DIV, /* / */
|
||||
BINOP_REM, /* % */
|
||||
BINOP_MOD, /* mod (Knuth 1.2.4) */
|
||||
BINOP_LSH, /* << */
|
||||
BINOP_RSH, /* >> */
|
||||
BINOP_LOGICAL_AND, /* && */
|
||||
|
@ -842,6 +842,7 @@ binop_type_check(arg1,arg2,op)
|
||||
break;
|
||||
|
||||
case BINOP_REM:
|
||||
case BINOP_MOD:
|
||||
if (!integral_type(t1) || !integral_type(t2))
|
||||
type_op_error ("Arguments to %s must be of integral type.",op);
|
||||
break;
|
||||
|
@ -2247,6 +2247,7 @@ int signo;
|
||||
{
|
||||
/* This message is based on ANSI C, section 4.7. Note that integer
|
||||
divide by zero causes this, so "float" is a misnomer. */
|
||||
signal (SIGFPE, float_handler);
|
||||
error ("Erroneous arithmetic operation.");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user