Comments (4)
Met this bug with headers containing the include to <sys/socket.h>
, with cmsghdr
structure from <bits/socket.h>
/* Structure used for storage of ancillary data object information. */
struct cmsghdr
{
size_t cmsg_len; /* Length of data in cmsg_data plus length
of cmsghdr structure.
!! The type should be socklen_t but the
definition of the kernel is incompatible
with this. */
int cmsg_level; /* Originating protocol. */
int cmsg_type; /* Protocol specific type. */
#if __glibc_c99_flexarr_available
__extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data. */
#endif
};
/* Ancillary data object manipulation macros. */
#if __glibc_c99_flexarr_available
# define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data)
#else
# define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1))
#endif
#define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg)
#define CMSG_FIRSTHDR(mhdr) \
((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) \
? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) 0)
#define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \
& (size_t) ~(sizeof (size_t) - 1))
#define CMSG_SPACE(len) (CMSG_ALIGN (len) \
+ CMSG_ALIGN (sizeof (struct cmsghdr)))
#define CMSG_LEN(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))
extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr,
struct cmsghdr *__cmsg) __THROW;
Error message is
2018-02-05 20:40:52,769 FIELD_DECL: BAD RECORD, Bad offset: -2 for cmsg_len
2018-02-05 20:40:52,769 FIELD_DECL: BAD RECORD, Bad offset: -2 for cmsg_level
2018-02-05 20:40:52,769 FIELD_DECL: BAD RECORD, Bad offset: -2 for cmsg_type
2018-02-05 20:40:52,769 FIELD_DECL: BAD RECORD, Bad offset: -2 for __cmsg_data
2018-02-05 20:40:52,769 Bad source code, bitsize == -16 <0 on __cmsg_data
2018-02-05 20:40:52,784 ELABORATED is not handled
2018-02-05 20:40:52,785 _do_nothing for ELABORATED/struct in_addr
2018-02-05 20:40:52,828 PAREN_EXPR is not handled
2018-02-05 20:40:52,828 _do_nothing for PAREN_EXPR/
2018-02-05 20:40:52,828 _do_nothing for PAREN_EXPR/
from ctypeslib.
Is there any hope to fix this?
from ctypeslib.
Hi @XVilka
I think the issue is really with the llvm clang library and python-clang bindings.
The clang library does not provide enough information to the python bindings for this ctypeslib library to be able to accommodate this corner case.
So, the solution would be to produce your test case for clang, and see what clang produces as a result and if the clang primitives return enough information. and propose that as a bug to llvm clang ?
I'm sorry to say, I don't have the cycle to do that myself, right now.
from ctypeslib.
Sure, I will try to do that.
from ctypeslib.
Related Issues (20)
- Does ctypeslib2 address the same concerns as ctypesgen? HOT 1
- Request: common definitions in separate import
- Request: identify "top level" structs
- Parsing a variadic macro makes clang2py crash HOT 1
- Define with parenthesis not parsed HOT 1
- clang2py not installed in "/usr/bin" HOT 1
- define didn't convert to python HOT 1
- Add if Windows 32bit use WinDLL instead CDLL HOT 1
- Use of "-r" option makes clang2py crash HOT 2
- do not support enum without name HOT 3
- Nested named structs names are not detected. HOT 8
- No output from clang2py even for simple headers - CLANG compatibility issues HOT 6
- ctypeslib2 gives following error on any anaconda environment whenever installed with pip. HOT 3
- AttributeError: 'Output' object has no attribute 'options' HOT 1
- clang dependecy issue in version 2.3.2 (ubuntu 20.04) HOT 6
- Macro values with parenthesis are not converted HOT 2
- File format has no dynamic symbol table HOT 1
- get_version() access violation on clang 17.0.2 HOT 2
- C++ interface HOT 1
- Add __slots__ to structs HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ctypeslib.