diff options
Diffstat (limited to 'gdb/language.c')
-rw-r--r-- | gdb/language.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/gdb/language.c b/gdb/language.c index 44aea1e..c5306bb 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -666,6 +666,28 @@ character_type (type) } } +/* Returns non-zero if the value is a string type */ +int +string_type (type) + struct type *type; +{ + switch(current_language->la_language) + { + /* start-sanitize-chill */ + case language_chill: + /* end-sanitize-chill */ + case language_m2: + return TYPE_CODE(type) != TYPE_CODE_STRING ? 0 : 1; + + case language_c: + case language_cplus: + /* C does not have distinct string type. */ + return (0); + default: + return (0); + } +} + /* Returns non-zero if the value is a boolean type */ int boolean_type (type) @@ -871,6 +893,12 @@ binop_type_check(arg1,arg2,op) type_op_error ("Arguments to %s must be of the same type.",op); break; + case BINOP_CONCAT: + if (!(string_type(t1) || character_type(t1)) + || !(string_type(t2) || character_type(t2))) + type_op_error ("Arguments to %s must be strings or characters.", op); + break; + /* Unary checks -- arg2 is null */ case UNOP_LOGICAL_NOT: |