Issue 50 in ctypesgen: Parsing errors with specific #define usage.

19 views
Skip to first unread message

codesite...@google.com

unread,
Mar 8, 2015, 9:45:25 PM3/8/15
to ctyp...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 50 by tilemach...@gmail.com: Parsing errors with specific #define
usage.
https://code.google.com/p/ctypesgen/issues/detail?id=50

Hello.
I am using ctypesgen to generate automatically some python bindings from c.


What steps will reproduce the problem?

This is a simplified version of what my problem is.
1. Consider the following definitions in file file.h.
#define SIZE(x) sizeof(x)
#define INT_SIZE SIZE(int)

2. I run:
ctypesgen.py file.h -o file.py

3. I get an error about parsing the INT_SIZE definition.


What is the expected output? What do you see instead?

The expected output should be a file containing INT_SIZE definition.
The relevant output error is:
WARNING: Could not parse macro "#define INT_SIZE SIZE ( int )"
and the file.py does not contain INT_SIZE.


What version of the product are you using? On what operating system?

I am using the latest (r151) version.
Operating System: Linux Ubuntu 14.04 LTS x64


Please provide any additional information below.

The real problem is similar to the problem described above and occurs when
file.h contains the following:
#include <linux/types.h>
#define CRIOGET _IOWR('c', 101, __u32)
//Some other definitions similar to CRIOGET using definitions from
//ioctl.h

And run:
python ctypesgen.py --include=sys/ioctl.h file.h -o file.py

I get the same parsing error.

I used a custom file in python to define those definitions and use
--insert-file option. But I wonder if this could work without this
workaround.

Regards.
Tilemachos.

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
Reply all
Reply to author
Forward
0 new messages