Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stddef.h include issue #65

Open
KoenVda88 opened this issue Mar 3, 2022 · 2 comments
Open

stddef.h include issue #65

KoenVda88 opened this issue Mar 3, 2022 · 2 comments

Comments

@KoenVda88
Copy link

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!

@inducer
Copy link
Owner

inducer commented Mar 3, 2022

I'm unlikely to have time to fix this myself, but I'd be happy to take a PR.

@KoenVda88
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants