Coder Social home page Coder Social logo

Comments (4)

XVilka avatar XVilka commented on June 16, 2024

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.

XVilka avatar XVilka commented on June 16, 2024

Is there any hope to fix this?

from ctypeslib.

trolldbois avatar trolldbois commented on June 16, 2024

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.

XVilka avatar XVilka commented on June 16, 2024

Sure, I will try to do that.

from ctypeslib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.