All of lore.kernel.org
 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 2/2] pahole.c: Add --inner_anonymous option
Date: Tue, 19 Oct 2021 11:07:24 +0100	[thread overview]
Message-ID: <20211019100724.325570-3-douglas.raillard@arm.com> (raw)
In-Reply-To: <20211019100724.325570-1-douglas.raillard@arm.com>

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

Allow making the inner struct/enum/union anonymous. This permits using
the header to inspect pointer values using -E, without having to care
about avoiding duplicate type definitions such as:

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

With --inner_anonymous, the conflict between the two definitions of
struct foo is gone:

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

Signed-off-by: Douglas Raillard <douglas.raillard@arm.com>
---
 pahole.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/pahole.c b/pahole.c
index 80271b5..b9c6305 100644
--- a/pahole.c
+++ b/pahole.c
@@ -1125,6 +1125,7 @@ ARGP_PROGRAM_VERSION_HOOK_DEF = dwarves_print_version;
 #define ARGP_hashbits		   329
 #define ARGP_devel_stats	   330
 #define ARGP_skip_encoding_btf_tag 331
+#define ARGP_inner_anonymous       332
 
 static const struct argp_option pahole__options[] = {
 	{
@@ -1232,6 +1233,11 @@ static const struct argp_option pahole__options[] = {
 		.key  = 'E',
 		.doc  = "expand class members",
 	},
+	{
+		.name = "inner_anonymous",
+		.key  = ARGP_inner_anonymous,
+		.doc  = "expanded class members are anonymous",
+	},
 	{
 		.name = "nr_members",
 		.key  = 'n',
@@ -1650,6 +1656,8 @@ static error_t pahole__options_parser(int key, char *arg,
 		conf_load.ptr_table_stats = true;	break;
 	case ARGP_skip_encoding_btf_tag:
 		conf_load.skip_encoding_btf_tag = true;	break;
+	case ARGP_inner_anonymous:
+		conf.inner_anonymous = true;            break;
 	default:
 		return ARGP_ERR_UNKNOWN;
 	}
-- 
2.25.1


  parent 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 [PATCH v1 0/2] Anonymous inner struct Douglas RAILLARD
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 ` Douglas RAILLARD [this message]
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-3-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.