Skip to content

CursorHandler: Unnecessary Warning #150

@anisa-su993

Description

@anisa-su993

The following check exists in cursorhandler.py:

bits = cursor.type.get_size() * 8
            if bits < 0:
                log.warning('Bad source code, bitsize == %d <0 on %s', bits, name)
                bits = 0

As far as I'm aware, the only reason clang's get_size() function returns a negative number, specifically -2, is for flexible arrays, or the user has code that doesn't compile. In that case, is this warning necessary? Since the user's C code doesn't compile, I think it would follow that the generated Python bindings would not be useable. Does it make sense to remove this warning since it is emitted even in cases the code is correct (flex arrays)?

I saw Issue #23 from several years ago which found a bug regarding flex array generation and the corresponding commit to close it: 656159a

Can you elaborate on this comment?

In most cases, it will work. if there is a structure with incompletearray
 and padding or alignement issue, it will produce wrong results

I don't see this in the current codebase anymore and want to double check that there's no issue with flex arrays.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions