The following code from /usr/include/stdio.h on Mac OSX does not appear to be being parsed up correctly:<br>
<br>...<br><br>
/* hold a buncha junk that would grow the ABI */<br>
struct __sFILEX;<br>
<br>
/*<br>
* stdio state variables.<br>
*<br>
* The following always hold:<br>
*<br>
* if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR),<br>
* _lbfsize is -_bf._size, else _lbfsize is 0<br>
* if _flags&__SRD, _w is 0<br>
* if _flags&__SWR, _r is 0<br>
*<br>
* This ensures that the getc and putc macros (or inline functions) never<br>
* try to write or read from a file that is in `read' or `write' mode.<br>
* (Moreover, they can, and do, automatically switch from read mode to<br>
* write mode, and back, on "r+" and "w+" files.)<br>
*<br>
* _lbfsize is used only to make the inline line-buffered output stream<br>
* code as compact as possible.<br>
*<br>
* _ub, _up, and _ur are used when ungetc() pushes back more characters<br>
* than fit in the current _bf, or when ungetc() pushes back a character<br>
* that does not match the previous one in _bf. When this happens,<br>
* _ub._base becomes non-nil (i.e., a stream has ungetc() data iff<br>
* _ub._base!=NULL) and _up and _ur save the current values of _p and _r.<br>
*<br>
* NB: see WARNING above before changing the layout of this structure!<br>
*/<br>
typedef struct __sFILE {<br>
unsigned char *_p; /* current position in (some) buffer */<br>
int _r; /* read space left for getc() */<br>
int _w; /* write space left for putc() */<br>
short _flags; /* flags, below; this FILE is free if 0 */<br>
short _file; /* fileno, if Unix descriptor, else -1 */<br>
struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */<br>
int _lbfsize; /* 0 or -_bf._size, for inline putc */<br>
<br>
/* operations */<br>
void *_cookie; /* cookie passed to io functions */<br>
int (*_close)(void *);<br>
int (*_read) (void *, char *, int);<br>
fpos_t (*_seek) (void *, fpos_t, int);<br>
int (*_write)(void *, const char *, int);<br>
<br>
/* separate buffer for long sequences of ungetc() */<br>
struct __sbuf _ub; /* ungetc buffer */<br>
struct __sFILEX *_extra; /* additions to FILE to not break ABI */<br>
int _ur; /* saved _r when _r is counting ungetc data */<br>
<br>
/* tricks to meet minimum requirements even when malloc() fails */<br>
unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */<br>
unsigned char _nbuf[1]; /* guarantee a getc() buffer */<br>
<br>
/* separate buffer for fgetln() when line crosses buffer boundary */<br>
struct __sbuf _lb; /* buffer for fgetln() */<br>
<br>
/* Unix stdio files get aligned to block boundaries on fseek() */<br>
int _blksize; /* stat.st_blksize (may be != _bf._size) */<br>
fpos_t _offset; /* current lseek offset (see WARNING) */<br>
} FILE;<br>
<br>...<br><br>
In the generated files, FILE* is being replaced with __sFILEX*. I'm guessing that
the declaration of struct __sFILEX; without a { } block is confusing
the parser. Placing the following code immediately after the struct
__sFILEX line, causes the files to be generated correctly, (but obviously
I don't want to be hacking stdio.h).<br>
<br>...<br><br>struct __sFILEX;<br><br>
typedef struct ryan {<br>
int value;<br>
} ryan;<br>
<br>...<br><br>
I tried looking through your parser files, but there is a lot going on
there and it will take me a long time to decipher where this kind of bug
would live... Thanks in advance for the help.<br>
<br>
Also it looks like someone else ran into this issue before here:<br>
<a href="http://lists.kde.org/?l=kde&m=126451536806956&q=raw">http://lists.kde.org/?l=kde&m=126451536806956&q=raw</a><br>
<br>
Ryan