Minor cleanup.
[deliverable/binutils-gdb.git] / gdb / language.c
index 445e816a0d8d221b9afcac6043be98eb4278fd89..a58fd2232e39ad3f4bc34aa73a8200c969d22d8c 100644 (file)
@@ -531,6 +531,21 @@ local_octal_format_custom(pre)
    strcat (form, local_octal_format_suffix ());
    return form;
 }
+
+/* Returns the appropriate printf format for decimal numbers. */
+char *
+local_decimal_format_custom(pre)
+   char *pre;
+{
+   static char form[50];
+
+   strcpy (form, local_decimal_format_prefix ());
+   strcat (form, "%");
+   strcat (form, pre);
+   strcat (form, local_decimal_format_specifier ());
+   strcat (form, local_decimal_format_suffix ());
+   return form;
+}
 \f
 /* This page contains functions that are used in type/range checking.
    They all return zero if the type/range check fails.
@@ -666,6 +681,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)
@@ -842,6 +879,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;
@@ -870,6 +908,13 @@ binop_type_check(arg1,arg2,op)
         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:
@@ -1168,7 +1213,7 @@ unk_lang_val_print (type, valaddr, address, stream, format, deref_ref,
 
 static struct type ** const (unknown_builtin_types[]) = { 0 };
 static const struct op_print unk_op_print_tab[] = {
-    {NULL, 0, 0, 0}
+    {NULL, OP_NULL, PREC_NULL, 0}
 };
 
 const struct language_defn unknown_language_defn = {
This page took 0.024351 seconds and 4 git commands to generate.