emit: Don't mark a enum with nr_members == 0 as printed, its just a fwd decl
And with this now we can do a 'pahole --compile' om vmlinux from DWARF
info and it works :-)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
diff --git a/dwarves_emit.c b/dwarves_emit.c
index 304d587..7d90d42 100644
--- a/dwarves_emit.c
+++ b/dwarves_emit.c
@@ -121,7 +121,13 @@
enumeration__fprintf(tag, conf, fp);
fputs(";\n", fp);
- type_emissions__add_definition(emissions, etype);
+
+ // See comment on enumeration__fprintf(), it seems this happens with DWARF as well
+ // or BTF doesn't have type->declaration set because DWARF didn't have it set.
+ // But we consider type->nr_members == 0 as just a forward declaration, so don't
+ // mark it as defined because we may need it to __really__ printf it later.
+ if (etype->nr_members != 0)
+ type_emissions__add_definition(emissions, etype);
return 1;
}