public inbox for dwarves@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/2] Anonymous inner struct
@ 2021-10-19 10:07 Douglas RAILLARD
  2021-10-19 10:07 ` [PATCH v1 1/2] fprintf: Allow making struct/enum/union anonymous Douglas RAILLARD
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Douglas RAILLARD @ 2021-10-19 10:07 UTC (permalink / raw)
  To: acme; +Cc: dwarves, douglas.raillard

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


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-12-06 20:32 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox