Skip to content

bit field arrangement is not guaranteed by the C standard (cdc.h) #1892

Closed
@jefftrull

Description

@jefftrull

Operating System

Linux

Board

n/a

Firmware

examples/device/cdc_msc

What happened ?

Compilation under sdcc (4.0 and 4.2) fails on the assert at line 410 of cdc.h which checks the size of cdc_line_control_state_t. The exact layout of bitfields is apparently implementation-defined and sdcc makes a different choice than gcc in this case. See the SDCC discussion for more info. So this seems to be a kind of C standard conformance issue.

There is a straightforward workaround which I will supply in a PR.

How to reproduce ?

Build tinyusb under sdcc for 8051, for example by using my branch. Change src/class/cdc/cdc.h to match master and observe this error message:

src/class/cdc/cdc.h:410: warning 215: static assertion failed: "size is not correct"

Debug Log as txt file

No response

Screenshots

No response

I have checked existing issues, dicussion and documentation

  • I confirm I have checked existing issues, dicussion and documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions