Skip to content

Commit

Permalink
drv/ioport/ioport_lpf2: fix GCC 10 error
Browse files Browse the repository at this point in the history
Fixes the following error:

    CC ../../lib/pbio/drv/ioport/ioport_lpf2.c
    ../../lib/pbio/drv/ioport/ioport_lpf2.c: In function 'process_thread_pbdrv_ioport_lpf2_process':
    ../../lib/pbio/drv/ioport/ioport_lpf2.c:520:74: error: array subscript 0 is outside the bounds of an interior zero-length array 'const pbio_iodev_mode_t[0]' [-Werror=zero-length-bounds]
    520 |                         const lump_mode_flags_t *flags = &info->mode_info[0].flags;
        |                                                           ~~~~~~~~~~~~~~~^~~
    In file included from ../../lib/pbio/drv/ioport/ioport_lpf2.c:19:
    ../../lib/pbio/include/pbio/iodev.h:349:23: note: while referencing 'mode_info'
    349 |     pbio_iodev_mode_t mode_info[0];
        |                       ^~~~~~~~~
    cc1: all warnings being treated as errors

Issue: pybricks/support#194
  • Loading branch information
dlech committed Jan 5, 2021
1 parent 7762512 commit 14654bb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/pbio/drv/ioport/ioport_lpf2.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ PROCESS_THREAD(pbdrv_ioport_lpf2_process, ev, data) {
const pbio_iodev_info_t *info = &basic_infos[ioport->connected_type_id].info;
iodev->info = info;

const lump_mode_flags_t *flags = &info->mode_info[0].flags;
const lump_mode_flags_t *flags = &basic_infos[ioport->connected_type_id].mode.flags;
iodev->capability_flags = PBIO_IODEV_CAPABILITY_FLAG_NONE;
if (flags->flags0 & LUMP_MODE_FLAGS0_MOTOR_POWER) {
iodev->capability_flags |= PBIO_IODEV_CAPABILITY_FLAG_IS_MOTOR;
Expand Down

0 comments on commit 14654bb

Please sign in to comment.