Re: [PATCH v1 0/2] Anonymous inner struct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Arnaldo,

Any opinion on this series ?

Cheers,
Douglas

On 10/19/21 11:07 AM, Douglas RAILLARD wrote:
From: Douglas Raillard <douglas.raillard@xxxxxxx>

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(-)





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux