diff options
author | Andrew Cagney <cagney@redhat.com> | 2003-08-07 22:35:03 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2003-08-07 22:35:03 +0000 |
commit | 592e91925d19ce76ff6e99c5909ec3e102f71f7a (patch) | |
tree | 85eca0e9d4ccf07d7a18d89517e00957219dcc53 /gdb/language.c | |
parent | 2dedfbf802d0189b65673bc4fc2a075e40a802e9 (diff) | |
download | gdb-592e91925d19ce76ff6e99c5909ec3e102f71f7a.tar.gz |
2003-08-07 Andrew Cagney <cagney@redhat.com>
* language.c (op_error): Delete function.
(binop_type_check): Delete function.
* language.h (type_op_error, range_op_error): Delete macros.
(op_error): Delete declaration.
Diffstat (limited to 'gdb/language.c')
-rw-r--r-- | gdb/language.c | 201 |
1 files changed, 0 insertions, 201 deletions
diff --git a/gdb/language.c b/gdb/language.c index eb203dc587c..a98c9d65782 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -151,7 +151,6 @@ static char *case_sensitive; char lang_frame_mismatch_warn[] = "Warning: the current language does not match this frame."; - /* This page contains the functions corresponding to GDB commands and their helpers. */ @@ -986,210 +985,10 @@ value_true (struct value *val) return !value_logical_not (val); } -/* Returns non-zero if the operator OP is defined on - the values ARG1 and ARG2. */ - -#if 0 /* Currently unused */ - -void -binop_type_check (struct value *arg1, struct value *arg2, int op) -{ - struct type *t1, *t2; - - /* If we're not checking types, always return success. */ - if (!STRICT_TYPE) - return; - - t1 = VALUE_TYPE (arg1); - if (arg2 != NULL) - t2 = VALUE_TYPE (arg2); - else - t2 = NULL; - - switch (op) - { - case BINOP_ADD: - case BINOP_SUB: - if ((numeric_type (t1) && pointer_type (t2)) || - (pointer_type (t1) && numeric_type (t2))) - { - warning ("combining pointer and integer.\n"); - break; - } - case BINOP_MUL: - case BINOP_LSH: - case BINOP_RSH: - if (!numeric_type (t1) || !numeric_type (t2)) - type_op_error ("Arguments to %s must be numbers.", op); - else if (!same_type (t1, t2)) - type_op_error ("Arguments to %s must be of the same type.", op); - break; - - case BINOP_LOGICAL_AND: - case BINOP_LOGICAL_OR: - if (!boolean_type (t1) || !boolean_type (t2)) - type_op_error ("Arguments to %s must be of boolean type.", op); - break; - - case BINOP_EQUAL: - if ((pointer_type (t1) && !(pointer_type (t2) || integral_type (t2))) || - (pointer_type (t2) && !(pointer_type (t1) || integral_type (t1)))) - type_op_error ("A pointer can only be compared to an integer or pointer.", op); - else if ((pointer_type (t1) && integral_type (t2)) || - (integral_type (t1) && pointer_type (t2))) - { - warning ("combining integer and pointer.\n"); - break; - } - else if (!simple_type (t1) || !simple_type (t2)) - type_op_error ("Arguments to %s must be of simple type.", op); - else if (!same_type (t1, t2)) - type_op_error ("Arguments to %s must be of the same type.", 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; - - case BINOP_LESS: - case BINOP_GTR: - case BINOP_LEQ: - case BINOP_GEQ: - if (!ordered_type (t1) || !ordered_type (t2)) - type_op_error ("Arguments to %s must be of ordered type.", op); - else if (!same_type (t1, t2)) - type_op_error ("Arguments to %s must be of the same type.", op); - break; - - case BINOP_ASSIGN: - if (pointer_type (t1) && !integral_type (t2)) - type_op_error ("A pointer can only be assigned an integer.", op); - else if (pointer_type (t1) && integral_type (t2)) - { - warning ("combining integer and pointer."); - break; - } - else if (!simple_type (t1) || !simple_type (t2)) - type_op_error ("Arguments to %s must be of simple type.", op); - else if (!same_type (t1, t2)) - type_op_error ("Arguments to %s must be of the same type.", op); - break; - - case BINOP_CONCAT: - /* FIXME: Needs to handle bitstrings as well. */ - if (!(string_type (t1) || character_type (t1) || integral_type (t1)) - || !(string_type (t2) || character_type (t2) || integral_type (t2))) - type_op_error ("Arguments to %s must be strings or characters.", op); - break; - - /* Unary checks -- arg2 is null */ - - case UNOP_LOGICAL_NOT: - if (!boolean_type (t1)) - type_op_error ("Argument to %s must be of boolean type.", op); - break; - - case UNOP_PLUS: - case UNOP_NEG: - if (!numeric_type (t1)) - type_op_error ("Argument to %s must be of numeric type.", op); - break; - - case UNOP_IND: - if (integral_type (t1)) - { - warning ("combining pointer and integer.\n"); - break; - } - else if (!pointer_type (t1)) - type_op_error ("Argument to %s must be a pointer.", op); - break; - - case UNOP_PREINCREMENT: - case UNOP_POSTINCREMENT: - case UNOP_PREDECREMENT: - case UNOP_POSTDECREMENT: - if (!ordered_type (t1)) - type_op_error ("Argument to %s must be of an ordered type.", op); - break; - - default: - /* Ok. The following operators have different meanings in - different languages. */ - switch (current_language->la_language) - { -#ifdef _LANG_c - case language_c: - case language_cplus: - case language_objc: - switch (op) - { - case BINOP_DIV: - if (!numeric_type (t1) || !numeric_type (t2)) - type_op_error ("Arguments to %s must be numbers.", op); - break; - } - break; -#endif - -#ifdef _LANG_m2 - case language_m2: - switch (op) - { - case BINOP_DIV: - if (!float_type (t1) || !float_type (t2)) - type_op_error ("Arguments to %s must be floating point numbers.", op); - break; - case BINOP_INTDIV: - if (!integral_type (t1) || !integral_type (t2)) - type_op_error ("Arguments to %s must be of integral type.", op); - break; - } -#endif - -#ifdef _LANG_pascal - case language_pascal: - switch(op) - { - case BINOP_DIV: - if (!float_type(t1) && !float_type(t2)) - type_op_error ("Arguments to %s must be floating point numbers.",op); - break; - case BINOP_INTDIV: - if (!integral_type(t1) || !integral_type(t2)) - type_op_error ("Arguments to %s must be of integral type.",op); - break; - } -#endif - - } - } -} - -#endif /* 0 */ - - /* This page contains functions for the printing out of error messages that occur during type- and range- checking. */ -/* Prints the format string FMT with the operator as a string - corresponding to the opcode OP. If FATAL is non-zero, then - this is an error and error () is called. Otherwise, it is - a warning and printf() is called. */ -void -op_error (char *fmt, enum exp_opcode op, int fatal) -{ - if (fatal) - error (fmt, op_string (op)); - else - { - warning (fmt, op_string (op)); - } -} - /* These are called when a language fails a type- or range-check. The first argument should be a printf()-style format string, and the rest of the arguments should be its arguments. If |