Dwarves Archive mirror
 help / color / mirror / Atom feed
From: Douglas RAILLARD <douglas.raillard@arm.com>
To: acme@redhat.com
Cc: dwarves@vger.kernel.org, douglas.raillard@arm.com
Subject: [PATCH v1 0/2] Anonymous inner struct
Date: Tue, 19 Oct 2021 11:07:22 +0100	[thread overview]
Message-ID: <20211019100724.325570-1-douglas.raillard@arm.com> (raw)

From: Douglas Raillard <douglas.raillard@arm.com>

Add an --inner_anonymous pahole CLI option to make inner
struct/enum/union anonymous. This allows turning this:

    struct foo { ... };
    struct bar {
        struct foo {
         ....
        } a;
    };
    
into this:

    struct foo { ... };
    struct bar {
        struct /* foo */ {
         ....
        } a;
    };

This avoids any conflict between the two definitions of struct foo. The
case arises when dumping multiple types at once with -E, all depending
on a same inner struct:

    struct bar {
        struct foo {
         ....
        } a;
    };
    struct bar2 {
        struct foo {
         ....
        } b;
    };


On top of that, struct foo could already be defined in a public header
already imported in the compilation unit, leading to a redefinition
error, while another nested struct is private and would still need -E
for the type to be usable.

Douglas Raillard (2):
  fprintf: Allow making struct/enum/union anonymous
  pahole.c: Add --inner_anonymous option

 dwarves.h         |  4 +++-
 dwarves_emit.c    |  2 +-
 dwarves_fprintf.c | 52 ++++++++++++++++++++++++++++++-----------------
 pahole.c          |  8 ++++++++
 4 files changed, 45 insertions(+), 21 deletions(-)

-- 
2.25.1


             reply	other threads:[~2021-10-19 10:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-19 10:07 Douglas RAILLARD [this message]
2021-10-19 10:07 ` [PATCH v1 1/2] fprintf: Allow making struct/enum/union anonymous Douglas RAILLARD
2021-11-26 18:27   ` Arnaldo Carvalho de Melo
2021-11-30 16:42     ` Douglas Raillard
2021-11-30 18:49       ` Arnaldo Carvalho de Melo
2021-12-01 10:56         ` Douglas Raillard
2021-12-01 12:01           ` Arnaldo Carvalho de Melo
2021-12-06 10:28             ` Douglas Raillard
2021-12-06 20:32               ` Arnaldo Carvalho de Melo
2021-10-19 10:07 ` [PATCH v1 2/2] pahole.c: Add --inner_anonymous option Douglas RAILLARD
2021-11-16 14:09 ` [PATCH v1 0/2] Anonymous inner struct Douglas Raillard
2021-11-23  0:36   ` Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211019100724.325570-1-douglas.raillard@arm.com \
    --to=douglas.raillard@arm.com \
    --cc=acme@redhat.com \
    --cc=dwarves@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).