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

#Pragmas in statements raise error #478

Open
ldore-ks opened this issue Nov 7, 2022 · 0 comments
Open

#Pragmas in statements raise error #478

ldore-ks opened this issue Nov 7, 2022 · 0 comments

Comments

@ldore-ks
Copy link

ldore-ks commented Nov 7, 2022

Pycparser raises a parser error when trying to parse statements that contain #pragma.
A typical example comes from Apple's iPhoneOS.sdk/usr/include/sys/event.h:371 (SDK 13).

The relevant sys/event.h:371 source code is:

struct knote;
SLIST_HEAD(klist, knote);

Once pre-processed, the SLIST_HEAD macro expands to:

struct knote;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnullability-completeness"
 struct klist { struct knote *slh_first; }
#pragma clang diagnostic pop
 ;

Note the #pragma that comes before the end-of-statement ;.

When parsing, pycparser raises the following error:

pycparser.plyparser.ParseError: Platforms/iphoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/sys/event.h:371:2: before: pragma
ldore added a commit to ldore/pycparser that referenced this issue Nov 14, 2022
ldore added a commit to ldore/pycparser that referenced this issue Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants