Revert "fprintf: Allow making struct/enum/union anonymous"
This reverts commit 7c5e35b63bd26f1de0a22acb6319bf2b1a4166c1.
Dropped since it could not cope with recursive types. A new attempt will
be made on 1.24.
Signed-off-by: Douglas RAILLARD <douglas.raillard@arm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
diff --git a/dwarves.h b/dwarves.h
index 2fbeac3..52d162d 100644
--- a/dwarves.h
+++ b/dwarves.h
@@ -105,7 +105,6 @@
uint8_t indent;
uint8_t expand_types:1;
uint8_t expand_pointers:1;
- uint8_t inner_anonymous:1;
uint8_t rel_offset:1;
uint8_t emit_stats:1;
uint8_t suppress_comments:1;
@@ -1372,8 +1371,7 @@
void enumeration__delete(struct type *type);
void enumeration__add(struct type *type, struct enumerator *enumerator);
size_t enumeration__fprintf(const struct tag *tag_enum,
- const struct conf_fprintf *conf, FILE *fp,
- bool anonymous);
+ const struct conf_fprintf *conf, FILE *fp);
int dwarves__init(void);
void dwarves__exit(void);
diff --git a/dwarves_emit.c b/dwarves_emit.c
index 5c67559..5bf7946 100644
--- a/dwarves_emit.c
+++ b/dwarves_emit.c
@@ -91,7 +91,7 @@
return 0;
}
- enumeration__fprintf(tag, conf, fp, false);
+ enumeration__fprintf(tag, conf, fp);
fputs(";\n", fp);
type_emissions__add_definition(emissions, etype);
return 1;
diff --git a/dwarves_fprintf.c b/dwarves_fprintf.c
index ecb6c7f..c5921d7 100644
--- a/dwarves_fprintf.c
+++ b/dwarves_fprintf.c
@@ -198,8 +198,7 @@
}
static size_t __class__fprintf(struct class *class, const struct cu *cu,
- const struct conf_fprintf *conf, FILE *fp,
- bool anonymous);
+ const struct conf_fprintf *conf, FILE *fp);
static size_t type__fprintf(struct tag *type, const struct cu *cu,
const char *name, const struct conf_fprintf *conf,
FILE *fp);
@@ -331,7 +330,7 @@
struct conf_fprintf tconf = *pconf;
tconf.suffix = type__name(type);
- return fprintf(fp, "typedef ") + __class__fprintf(tag__class(tag_type), cu, &tconf, fp, false);
+ return fprintf(fp, "typedef ") + __class__fprintf(tag__class(tag_type), cu, &tconf, fp);
}
case DW_TAG_enumeration_type: {
struct type *ctype = tag__type(tag_type);
@@ -342,7 +341,7 @@
struct conf_fprintf tconf = *pconf;
tconf.suffix = type__name(type);
- return fprintf(fp, "typedef ") + enumeration__fprintf(tag_type, &tconf, fp, false);
+ return fprintf(fp, "typedef ") + enumeration__fprintf(tag_type, &tconf, fp);
}
}
@@ -395,16 +394,12 @@
return type->max_tag_name_len;
}
-size_t enumeration__fprintf(const struct tag *tag, const struct conf_fprintf *conf, FILE *fp, bool anonymous)
+size_t enumeration__fprintf(const struct tag *tag, const struct conf_fprintf *conf, FILE *fp)
{
struct type *type = tag__type(tag);
struct enumerator *pos;
int max_entry_name_len = enumeration__max_entry_name_len(type);
- size_t printed = fprintf(fp, "enum%s%s%s%s {\n",
- type__name(type) ? " " : "",
- type__name(type) && anonymous ? "/* " : "",
- type__name(type) ? type__name(type) : "",
- type__name(type) && anonymous ? " */" : "");
+ size_t printed = fprintf(fp, "enum%s%s {\n", type__name(type) ? " " : "", type__name(type) ?: "");
int indent = conf->indent;
if (indent >= (int)sizeof(tabs))
@@ -639,8 +634,7 @@
}
static size_t union__fprintf(struct type *type, const struct cu *cu,
- const struct conf_fprintf *conf, FILE *fp,
- bool anonymous);
+ const struct conf_fprintf *conf, FILE *fp);
static size_t type__fprintf(struct tag *type, const struct cu *cu,
const char *name, const struct conf_fprintf *conf,
@@ -656,7 +650,6 @@
};
size_t printed = 0;
int expand_types = conf->expand_types;
- int inner_anonymous = conf->inner_anonymous;
int suppress_offset_comment = conf->suppress_offset_comment;
if (type == NULL)
@@ -814,7 +807,7 @@
class__find_holes(cclass);
tconf.type_spacing -= 8;
- printed += __class__fprintf(cclass, cu, &tconf, fp, inner_anonymous);
+ printed += __class__fprintf(cclass, cu, &tconf, fp);
}
break;
case DW_TAG_union_type:
@@ -824,7 +817,7 @@
printed += fprintf(fp, "union %-*s %s", tconf.type_spacing - 6, type__name(ctype), name ?: "");
} else {
tconf.type_spacing -= 8;
- printed += union__fprintf(ctype, cu, &tconf, fp, inner_anonymous);
+ printed += union__fprintf(ctype, cu, &tconf, fp);
}
break;
case DW_TAG_enumeration_type:
@@ -833,7 +826,7 @@
if (type__name(ctype) != NULL)
printed += fprintf(fp, "enum %-*s %s", tconf.type_spacing - 5, type__name(ctype), name ?: "");
else
- printed += enumeration__fprintf(type, &tconf, fp, inner_anonymous);
+ printed += enumeration__fprintf(type, &tconf, fp);
break;
}
out:
@@ -998,8 +991,7 @@
}
static size_t union__fprintf(struct type *type, const struct cu *cu,
- const struct conf_fprintf *conf, FILE *fp,
- bool anonymous)
+ const struct conf_fprintf *conf, FILE *fp)
{
struct class_member *pos;
size_t printed = 0;
@@ -1013,11 +1005,8 @@
if (conf->prefix != NULL)
printed += fprintf(fp, "%s ", conf->prefix);
- printed += fprintf(fp, "union%s%s%s%s {\n",
- type__name(type) ? " " : "",
- type__name(type) && anonymous ? "/* " : "",
- type__name(type) ?: "",
- type__name(type) && anonymous ? " */" : "");
+ printed += fprintf(fp, "union%s%s {\n", type__name(type) ? " " : "",
+ type__name(type) ?: "");
uconf = *conf;
uconf.indent = indent + 1;
@@ -1375,8 +1364,7 @@
}
static size_t __class__fprintf(struct class *class, const struct cu *cu,
- const struct conf_fprintf *conf, FILE *fp,
- bool anonymous)
+ const struct conf_fprintf *conf, FILE *fp)
{
struct type *type = &class->type;
size_t last_size = 0, size;
@@ -1396,16 +1384,14 @@
const char *current_accessibility = NULL;
struct conf_fprintf cconf = conf ? *conf : conf_fprintf__defaults;
const uint16_t t = type->namespace.tag.tag;
- size_t printed = fprintf(fp, "%s%s%s%s%s%s%s",
+ size_t printed = fprintf(fp, "%s%s%s%s%s",
cconf.prefix ?: "", cconf.prefix ? " " : "",
((cconf.classes_as_structs ||
t == DW_TAG_structure_type) ? "struct" :
t == DW_TAG_class_type ? "class" :
"interface"),
type__name(type) ? " " : "",
- anonymous && type__name(type) ? "/* " : "",
- type__name(type) ?: "",
- anonymous && type__name(type) ? " */" : "");
+ type__name(type) ?: "");
int indent = cconf.indent;
if (indent >= (int)sizeof(tabs))
@@ -1822,7 +1808,7 @@
size_t class__fprintf(struct class *class, const struct cu *cu, FILE *fp)
{
- return __class__fprintf(class, cu, NULL, fp, false);
+ return __class__fprintf(class, cu, NULL, fp);
}
static size_t variable__fprintf(const struct tag *tag, const struct cu *cu,
@@ -1909,7 +1895,7 @@
printed += array_type__fprintf(tag, cu, "array", pconf, fp);
break;
case DW_TAG_enumeration_type:
- printed += enumeration__fprintf(tag, pconf, fp, false);
+ printed += enumeration__fprintf(tag, pconf, fp);
break;
case DW_TAG_typedef:
printed += typedef__fprintf(tag, cu, pconf, fp);
@@ -1917,7 +1903,7 @@
case DW_TAG_class_type:
case DW_TAG_interface_type:
case DW_TAG_structure_type:
- printed += __class__fprintf(tag__class(tag), cu, pconf, fp, false);
+ printed += __class__fprintf(tag__class(tag), cu, pconf, fp);
break;
case DW_TAG_subroutine_type:
printed += ftype__fprintf(tag__ftype(tag), cu, NULL, false, false, 0, true, pconf, fp);
@@ -1929,7 +1915,7 @@
printed += function__fprintf(tag, cu, pconf, fp);
break;
case DW_TAG_union_type:
- printed += union__fprintf(tag__type(tag), cu, pconf, fp, false);
+ printed += union__fprintf(tag__type(tag), cu, pconf, fp);
break;
case DW_TAG_variable:
printed += variable__fprintf(tag, cu, pconf, fp);