aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2012-11-29 18:56:23 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2012-11-29 18:56:23 +0000
commitea5e6b0efed02c5f934df7420aa9fa55aa84b635 (patch)
treec5100cb66ec9810d96761ef4035b0ac5866a8133 /gdb/opencl-lang.c
parent * gdb.texinfo (SVR4 Process Information): Document missing (diff)
downloadbinutils-gdb-ea5e6b0efed02c5f934df7420aa9fa55aa84b635.tar.gz
binutils-gdb-ea5e6b0efed02c5f934df7420aa9fa55aa84b635.tar.bz2
binutils-gdb-ea5e6b0efed02c5f934df7420aa9fa55aa84b635.zip
ChangeLog:
* opencl-lang.c (opencl_print_type): New function. (opencl_language_arch_info): Install it. testsuite/ChangeLog: * gdb.opencl/convs_casts.exp: Always expect standard vector type names. * gdb.opencl/datatypes.exp: Likewise. * gdb.opencl/operators.exp: Likewise. * gdb.opencl/vec_comps.exp: Likewise.
Diffstat (limited to 'gdb/opencl-lang.c')
-rw-r--r--gdb/opencl-lang.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c
index b8fd9b7e622..4ef469867cb 100644
--- a/gdb/opencl-lang.c
+++ b/gdb/opencl-lang.c
@@ -961,6 +961,27 @@ Cannot perform conditional operation on vectors with different sizes"));
return evaluate_subexp_c (expect_type, exp, pos, noside);
}
+/* 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)
@@ -1003,7 +1024,7 @@ 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 */