Re: Formatting "drivers" was Re: Can't persuade pahole to see through forward declarations

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

 



On Tue, 23 Jun 2009, Zack Weinberg wrote:

> "Ilpo Järvinen" <ilpo.jarvinen@xxxxxxxxxxx> wrote:
> > On Thu, 18 Jun 2009, Arnaldo Carvalho de Melo wrote:
> > > Em Thu, Jun 18, 2009 at 01:28:20PM -0700, Zack Weinberg escreveu:
> > > >  - You do not have to process C declaration syntax to find the
> > > > name of each field.
> > 
> > Good point, this is one of the most complex tasks in scripts to get 
> > general case right. Besides typedefs, especially those function
> > pointers which appear in return value and arguments make it a task
> > too hairy for any sane people, not that I'd say it is
> > impossible... :-)
> 
> I used to hack gcc.  I know *exactly* how hard it is to parse C
> declarations. :-)
> 
> I had been doing okay, for the limited thing I am trying to do, with
> sed scripts to munge the pahole output into something that could be
> relatively easily parsed by a Python script, but then I ran into this
> construct:
> 
>   struct S {
>     ...
>     struct T {
>       int a;
>     } tee[2];
>   };
> 
> No hint that there are two copies of T embedded in S, here, until it's
> far too late to do anything about it (if you're a sed script).

Agreed, those kind of constructs are quite annoying. I'd probably do it so 
that I'd tac the input and preprocess it into something I can do line by 
line after another tac (but that of course has some performance penalty
if the input is very large).

-- 
 i.

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

  Powered by Linux