2012-09-26 Jan Kratochvil <jan.kratochvil@redhat.com>
[deliverable/binutils-gdb.git] / gdb / c-typeprint.c
index c2a775ac73f003dae7d319a47743eb21c7284ba8..8b5bc2170ac9f1df51b9df1ca3e8f92c6e3b6bba 100644 (file)
@@ -131,12 +131,7 @@ c_print_typedef (struct type *type,
    }
 
    In general, gdb should try to print the types as closely as
-   possible to the form that they appear in the source code.
-
-   Note that in case of protected derivation gcc will not say
-   'protected' but 'private'.  The HP's aCC compiler emits specific
-   information for derivation via protected inheritance, so gdb can
-   print it out */
+   possible to the form that they appear in the source code.  */
 
 static void
 cp_type_print_derivation_info (struct ui_file *stream,
@@ -306,7 +301,7 @@ c_type_print_varspec_prefix (struct type *type,
 
     case TYPE_CODE_TYPEDEF:
       c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
-                                  stream, show, 0, 0);
+                                  stream, show, passed_a_ptr, 0);
       break;
 
     case TYPE_CODE_UNDEF:
@@ -618,15 +613,17 @@ c_type_print_varspec_suffix (struct type *type,
     case TYPE_CODE_ARRAY:
       {
        LONGEST low_bound, high_bound;
+       int is_vector = TYPE_VECTOR (type);
 
        if (passed_a_ptr)
          fprintf_filtered (stream, ")");
 
-       fprintf_filtered (stream, "[");
+       fprintf_filtered (stream, (is_vector ?
+                                  "__attribute__ ((vector_size(" : "["));
        if (get_array_bounds (type, &low_bound, &high_bound))
-         fprintf_filtered (stream, "%d", 
-                           (int) (high_bound - low_bound + 1));
-       fprintf_filtered (stream, "]");
+         fprintf_filtered (stream, "%s", 
+                           plongest (high_bound - low_bound + 1));
+       fprintf_filtered (stream, (is_vector ? ")))" : "]"));
 
        c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,
                                     show, 0, 0);
@@ -771,18 +768,14 @@ c_type_print_base (struct type *type, struct ui_file *stream,
       break;
 
     case TYPE_CODE_STRUCT:
+    case TYPE_CODE_UNION:
       c_type_print_modifier (type, stream, 0, 1);
-      if (TYPE_DECLARED_CLASS (type))
+      if (TYPE_CODE (type) == TYPE_CODE_UNION)
+       fprintf_filtered (stream, "union ");
+      else if (TYPE_DECLARED_CLASS (type))
        fprintf_filtered (stream, "class ");
       else
        fprintf_filtered (stream, "struct ");
-      goto struct_union;
-
-    case TYPE_CODE_UNION:
-      c_type_print_modifier (type, stream, 0, 1);
-      fprintf_filtered (stream, "union ");
-
-    struct_union:
 
       /* Print the tag if it exists.  The HP aCC compiler emits a
          spurious "{unnamed struct}"/"{unnamed union}"/"{unnamed
This page took 0.028178 seconds and 4 git commands to generate.