arduino / arduino/ArduinoCore-avr

Compiler warning with feather32u4

Open
#450 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
1.5k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

I can't find a better place for this issue, so please let me know if I should report the issue elsewhere, for example in [Platformio's toolchain](https://github.com/platformio/platform-atmelavr).

When compiling any sketch with Platformio, using the options
```
platform = atmelavr
board = feather32u4
framework = arduino
```

- [framework-arduino-avr 5.1.0 (1.8.3)](https://registry.platformio.org/tools/platformio/framework-arduino-avr)
- [toolchain-atmelavr 1.70300.191015 (7.3.0)](https://registry.platformio.org/tools/platformio/toolchain-atmelavr)

I get the following warnings:
```cores\arduino\USBCore.cpp: In function 'void Recv(volatile u8*, u8)':
cores\arduino\USBCore.cpp:116:8: warning: statement has no effect [-Wunused-value]
RXLED1; // light the RX LED
^
cores\arduino\USBCore.cpp: In function 'u8 Recv8()':
cores\arduino\USBCore.cpp:122:8: warning: statement has no effect [-Wunused-value]
RXLED1; // light the RX LED
^
cores\arduino\USBCore.cpp: In function 'int USB_Send(u8, const void*, int)':
cores\arduino\USBCore.cpp:323:8: warning: statement has no effect [-Wunused-value]
TXLED1; // light the TX LED
^
cores\arduino\USBCore.cpp: In function 'void __vector_10()':
cores\arduino\USBCore.cpp:761:10: warning: statement has no effect [-Wunused-value]
TXLED0;
^
cores\arduino\USBCore.cpp:763:10: warning: statement has no effect [-Wunused-value]
RXLED0;
^
cores\arduino\USBCore.cpp: In member function 'void USBDevice_::attach()':
cores\arduino\USBCore.cpp:819:16: warning: statement has no effect [-Wunused-value]
TX_RX_LED_INIT;
```

I think this is because `RXLEDn`, `TXLEDn` & `TX_RX_LED_INIT` are defined as `0` for some boards. By replacing the `0` by `{}` in the header file, the warning vanishes.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with cores/arduino/USBCore.cpp at the warning locations and trace the RXLEDn, TXLEDn, and TX_RX_LED_INIT definitions in the relevant header. Reproduce the warnings using Platformio with platform atmelavr, board feather32u4, and framework arduino, then verify that the warnings disappear without changing LED behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.