daily update
[deliverable/binutils-gdb.git] / gdb / opencl-lang.c
index d779591610014cf139202b45eb1ab2470f287e96..4ef469867cbc89195628a895f0de776841050290 100644 (file)
@@ -68,7 +68,7 @@ enum opencl_primitive_types {
 
 static struct gdbarch_data *opencl_type_data;
 
-struct type **
+static struct type **
 builtin_opencl_type (struct gdbarch *gdbarch)
 {
   return gdbarch_data (gdbarch, opencl_type_data);
@@ -961,7 +961,28 @@ Cannot perform conditional operation on vectors with different sizes"));
   return evaluate_subexp_c (expect_type, exp, pos, noside);
 }
 
-void
+/* Print OpenCL types.  */
+
+static void
+opencl_print_type (struct type *type, const char *varstring,
+                  struct ui_file *stream, int show, int level,
+                  const struct type_print_options *flags)
+{
+  /* We nearly always defer to C type printing, except that vector
+     types are considered primitive in OpenCL, and should always
+     be printed using their TYPE_NAME.  */
+  if (show > 0)
+    {
+      CHECK_TYPEDEF (type);
+      if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type)
+         && TYPE_NAME (type) != NULL)
+       show = 0;
+    }
+
+  c_print_type (type, varstring, stream, show, level, flags); 
+}
+
+static void
 opencl_language_arch_info (struct gdbarch *gdbarch,
                           struct language_arch_info *lai)
 {
@@ -993,7 +1014,6 @@ const struct language_defn opencl_language_defn =
   "opencl",                    /* Language name */
   language_opencl,
   range_check_off,
-  type_check_off,
   case_sensitive_on,
   array_row_major,
   macro_expansion_c,
@@ -1004,10 +1024,11 @@ const struct language_defn opencl_language_defn =
   c_printchar,                 /* Print a character constant */
   c_printstr,                  /* Function to print string constant */
   c_emit_char,                 /* Print a single char */
-  c_print_type,                        /* Print a type using appropriate syntax */
+  opencl_print_type,           /* Print a type using appropriate syntax */
   c_print_typedef,             /* Print a typedef using appropriate syntax */
   c_val_print,                 /* Print a value using appropriate syntax */
   c_value_print,               /* Print a top-level value */
+  default_read_var_value,      /* la_read_var_value */
   NULL,                                /* Language specific skip_trampoline */
   NULL,                         /* name_of_this */
   basic_lookup_symbol_nonlocal,        /* lookup_symbol_nonlocal */
@@ -1024,7 +1045,7 @@ const struct language_defn opencl_language_defn =
   default_print_array_index,
   default_pass_by_reference,
   c_get_string,
-  NULL,                                /* la_get_symbol_name_match_p */
+  NULL,                                /* la_get_symbol_name_cmp */
   iterate_over_symbols,
   LANG_MAGIC
 };
@@ -1116,6 +1137,9 @@ build_opencl_types (struct gdbarch *gdbarch)
   return types;
 }
 
+/* Provide a prototype to silence -Wmissing-prototypes.  */
+extern initialize_file_ftype _initialize_opencl_language;
+
 void
 _initialize_opencl_language (void)
 {
This page took 0.024985 seconds and 4 git commands to generate.