[Prev][Next][Index]

struct parsing bug




Here's a doozie....

The `static' type of a variable gets propagated back to the type of
the struct... and in the process the extern comes forward. !?!?! 
Since I don't mess at all with the parser, I have no idea what to do.
(Although perhaps at this point it would be easier to install a
post-depfile-making fixit hack?)

You might wonder what the heck it means to do the extern and struct
decl together on one line, but I found it in <stdio.h>; I didn't make
it up! (In reality, static variable is "static FILE", expanded.)

/Andrew/

[Use pC++2dep, then unparse.]

Input:
------------------------------------------------------------------------
extern struct OK {
     double x;
} fine;

extern struct BAD {
     double x;
} trouble;

int main (void)
{
     struct OK like_it;
     static struct BAD cry;
     return 0;
}
------------------------------------------------------------------------

Output:
------------------------------------------------------------------------
extern  struct OK {
       double x;
} fine;
extern  static struct BAD {
       double x;
} trouble;
int  main(void  ){
       struct OK like_it;
       extern  static struct BAD cry;
       return 0;
}
------------------------------------------------------------------------