+ /* Print the tag if it exists. The HP aCC compiler emits a
+ spurious "{unnamed struct}"/"{unnamed union}"/"{unnamed
+ enum}" tag for unnamed struct/union/enum's, which we don't
+ want to print. */
+ if (TYPE_TAG_NAME (type) != NULL
+ && strncmp (TYPE_TAG_NAME (type), "{unnamed", 8))
+ {
+ /* When printing the tag name, we are still effectively
+ printing in the outer context, hence the use of FLAGS
+ here. */
+ print_name_maybe_canonical (TYPE_TAG_NAME (type), flags, stream);
+ if (show > 0)
+ fputs_filtered (" ", stream);
+ }
+
+ if (show < 0)
+ {
+ /* If we just printed a tag name, no need to print anything
+ else. */
+ if (TYPE_TAG_NAME (type) == NULL)
+ fprintf_filtered (stream, "{...}");
+ }
+ else if (show > 0 || TYPE_TAG_NAME (type) == NULL)
+ {
+ struct type *basetype;
+ int vptr_fieldno;
+
+ c_type_print_template_args (&local_flags, type, stream);
+
+ /* Add in template parameters when printing derivation info. */
+ add_template_parameters (local_flags.local_typedefs, type);
+ cp_type_print_derivation_info (stream, type, &local_flags);
+
+ /* This holds just the global typedefs and the template
+ parameters. */
+ semi_local_flags.local_typedefs
+ = copy_typedef_hash (local_flags.local_typedefs);
+ if (semi_local_flags.local_typedefs)
+ make_cleanup_free_typedef_hash (semi_local_flags.local_typedefs);
+
+ /* Now add in the local typedefs. */
+ recursively_update_typedef_hash (local_flags.local_typedefs, type);
+
+ fprintf_filtered (stream, "{\n");
+ if (TYPE_NFIELDS (type) == 0 && TYPE_NFN_FIELDS (type) == 0
+ && TYPE_TYPEDEF_FIELD_COUNT (type) == 0)
+ {
+ if (TYPE_STUB (type))
+ fprintfi_filtered (level + 4, stream,
+ _("<incomplete type>\n"));
+ else
+ fprintfi_filtered (level + 4, stream,
+ _("<no data fields>\n"));
+ }
+
+ /* Start off with no specific section type, so we can print
+ one for the first field we find, and use that section type
+ thereafter until we find another type. */
+
+ section_type = s_none;
+
+ /* For a class, if all members are private, there's no need
+ for a "private:" label; similarly, for a struct or union
+ masquerading as a class, if all members are public, there's
+ no need for a "public:" label. */
+
+ if (TYPE_DECLARED_CLASS (type))
+ {
+ QUIT;
+ len = TYPE_NFIELDS (type);
+ for (i = TYPE_N_BASECLASSES (type); i < len; i++)
+ if (!TYPE_FIELD_PRIVATE (type, i))
+ {
+ need_access_label = 1;
+ break;
+ }
+ QUIT;
+ if (!need_access_label)
+ {
+ len2 = TYPE_NFN_FIELDS (type);
+ for (j = 0; j < len2; j++)
+ {
+ len = TYPE_FN_FIELDLIST_LENGTH (type, j);
+ for (i = 0; i < len; i++)
+ if (!TYPE_FN_FIELD_PRIVATE (TYPE_FN_FIELDLIST1 (type,
+ j), i))
+ {
+ need_access_label = 1;
+ break;
+ }
+ if (need_access_label)
+ break;
+ }
+ }
+ }
+ else
+ {
+ QUIT;
+ len = TYPE_NFIELDS (type);
+ for (i = TYPE_N_BASECLASSES (type); i < len; i++)
+ if (TYPE_FIELD_PRIVATE (type, i)
+ || TYPE_FIELD_PROTECTED (type, i))
+ {
+ need_access_label = 1;
+ break;
+ }
+ QUIT;
+ if (!need_access_label)
+ {
+ len2 = TYPE_NFN_FIELDS (type);
+ for (j = 0; j < len2; j++)
+ {
+ QUIT;
+ len = TYPE_FN_FIELDLIST_LENGTH (type, j);
+ for (i = 0; i < len; i++)
+ if (TYPE_FN_FIELD_PROTECTED (TYPE_FN_FIELDLIST1 (type,
+ j), i)
+ || TYPE_FN_FIELD_PRIVATE (TYPE_FN_FIELDLIST1 (type,
+ j),
+ i))
+ {
+ need_access_label = 1;
+ break;
+ }
+ if (need_access_label)
+ break;
+ }
+ }
+ }