pycparserext
pycparserext copied to clipboard
stddef.h include issue
Hi,
I like this software though I found an issue when parsing a preprocessed file with stddef.h included.
The software seems to have issues with:
typedef struct {
long long __max_align_ll __attribute__((__aligned__(__alignof__(long long))));
long double __max_align_ld __attribute__((__aligned__(__alignof__(long double))));
} max_align_t;
My code:
class FunctionList(pycparser.c_ast.NodeVisitor):
def __init__( self, source):
self.funcs = set()
parser = ext_c_parser.GnuCParser()
self.visit(parser.parse(source))
def visit_FuncDef(self, node):
self.funcs.add(node.decl.name)
With source as the preprocessed file with args = ['gcc','-E','-P' ]
Any solutions to this issue?
Thanks!
I'm unlikely to have time to fix this myself, but I'd be happy to take a PR.
I looked at the code but it seems not like an easy fix.
I did find a workaround though
I run gcc with -D__alignof__(x)=sizeof(x)
I know this is not a good fix but I don't use max_align_t
so I don't mind it.