summaryrefslogtreecommitdiff
path: root/typedefs_cgen.c
diff options
context:
space:
mode:
Diffstat (limited to 'typedefs_cgen.c')
-rw-r--r--typedefs_cgen.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/typedefs_cgen.c b/typedefs_cgen.c
index f652ca1..2051acb 100644
--- a/typedefs_cgen.c
+++ b/typedefs_cgen.c
@@ -104,19 +104,9 @@ static bool typedefs_decl(CGenerator *g, Declaration *d) {
/* generate typedef */
IdentID id;
if (g->block != NULL) id = d->c.ids[idx] = g->ident_counter++;
+ if (val->type->kind == TYPE_STRUCT) continue; /* we don't need to typedef this; we can just use its tag */
cgen_write(g, "typedef ");
- if (val->type->kind == TYPE_STRUCT) {
- cgen_write(g, "struct ");
- if (g->block == NULL) {
- /* we can refer to this by its name */
- cgen_ident(g, i);
- } else {
- /* we need to use an ID ): */
- cgen_ident_id(g, id);
- }
- } else {
- if (!cgen_type_pre(g, val->type, d->where)) return false;
- }
+ if (!cgen_type_pre(g, val->type, d->where)) return false;
cgen_write(g, " ");
if (g->block == NULL) {
/* we can refer to this by its name */