emit: Do not emit a forward declararion to a nameless struct

This was happening here:

  $ pfunct --compile /home/acme/git/build/v5.1-rc4+/block/partitions/check.o > a.c ; head -29 a.c
  struct block_device;

  struct (null);

  typedef _Bool bool;

  struct parsed_partitions {
  	struct block_device * bdev;                      /*     0     8 */
  	char                       name[32];             /*     8    32 */
  	struct {
  		sector_t           from;                 /*    40     8 */
  		sector_t           size;                 /*    48     8 */
  		int                flags;                /*    56     4 */
  		bool               has_info;             /*    60     1 */
  		struct partition_meta_info info;         /*    61   101 */
  	} * parts; /*    40     8 */
  	int                        next;                 /*    48     4 */
  	int                        limit;                /*    52     4 */
  	bool                       access_beyond_eod;    /*    56     1 */

  	/* XXX 7 bytes hole, try to pack */

  	/* --- cacheline 1 boundary (64 bytes) --- */
  	char *                     pp_buf;               /*    64     8 */

  	/* size: 72, cachelines: 2, members: 7 */
  	/* sum members: 65, holes: 1, sum holes: 7 */
  	/* last cacheline: 8 bytes */
  };
  $

I.e. we saw a pointer to a struct, so all we need is a forward
declaration for that function, right? Not if it is defined inline, so
just don't emit the forward declaration if the struct name is NULL.

Oops, the offsets in a struct defined inline and that the member is a
pointer need to have its offset restarted from zero...

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
diff --git a/dwarves_emit.c b/dwarves_emit.c
index e583d18..bb87241 100644
--- a/dwarves_emit.c
+++ b/dwarves_emit.c
@@ -206,9 +206,12 @@
 	if (ctype->fwd_decl_emitted)
 		return 0;
 
+	const char *name = type__name(ctype, cu);
+	if (name == NULL)
+		return 0;
+
 	/* Ok, lets look at the previous CUs: */
-	if (type_emissions__find_fwd_decl(emissions, cu,
-					  type__name(ctype, cu)) != NULL) {
+	if (type_emissions__find_fwd_decl(emissions, cu, name) != NULL) {
 		/*
 		 * Yes, so lets mark it visited on this CU too,
 		 * to speed up the lookup.