Skip to content

Clear the compiler warnings from the library sources and the ESP-IDF headers it includes - #325

Merged
lovyan03 merged 5 commits into
m5stack:developfrom
ainyan03:build_warnings
Oct 1, 2026
Merged

lovyan03 merged 5 commits into
m5stack:developfrom
ainyan03:build_warnings

Conversation

@ainyan03

@ainyan03 ainyan03 commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Clears the compiler warnings that the library's own sources and the ESP-IDF headers it includes produce in CI builds (and therefore in user builds). No change in behavior.

Commit What
esp32: keep warnings from the ESP-IDF headers out of user builds -Wmissing-field-initializers (gpio_ll.h on C5 / C61 / P4), -Wvolatile (gdma_ll.h, H2 gpio_ll.h, lcd_ll.h), -Wliteral-suffix (periph_ctrl.h) are suppressed around the includes only; soc/apb_ctrl_reg.h (deprecated #warning in IDF 5.2) is replaced by soc/syscon_reg.h and SYSCON_DATE_REG (same register)
Bus_SPI: mark the DMA queue head as possibly unused -Wunused-variable on targets that start the queue another way
Comment out unused parameter names in bus and panel stubs -Wunused-parameter (lgfx/v1 sources)
Resolve nonfunctional shadow and portability warnings -Wshadow (Panel_FrameBufferBase; the file-scope __DECLARE_RCC_ATOMIC_ENV stand-in that every PERIPH_RCC_ATOMIC() shadowed is replaced by a block-local one), unused log tag (LT8912B), always-false QOI width check on 64-bit size_t
M5GFX: rename locals that shadow other declarations -Wshadow in M5GFX.cpp, board_detect.inl and the CoreS3 BUS_OUT precharge (names only; found with -Wshadow, which this repository's CI does not enable)

Library warnings counted from the CI logs of all workflows (warnings in the library sources, plus warnings in SDK headers reached through a library include; warnings from the Arduino core / SDK sources themselves are not counted):

Own sources SDK headers via the library
develop 0 7
this branch 0 0

Left as is: -Warray-bounds in Bus_SPI::set_read_len (GCC 12 false positive on the register address; no local fix shown to keep the generated code identical) and -Wmaybe-uninitialized at the PNG encoder call.

Generated code was compared before / after for ESP32 and ESP32-C5 builds: identical instructions, except __LINE__ immediates shifted by the added lines.

Several ESP-IDF HAL headers that the library includes trigger warnings in
every translation unit that includes it:
- hal/gpio_ll.h (ESP32-C5 / C61 / P4): -Wmissing-field-initializers under
  -Wextra (a register struct initialized with only one member)
- hal/gdma_ll.h, hal/gpio_ll.h (ESP32-H2), hal/lcd_ll.h: -Wvolatile in C++20
  (compound assignment to volatile registers)
- esp_private/periph_ctrl.h via spi_common_internal.h: -Wliteral-suffix
- soc/apb_ctrl_reg.h (IDF 5.2 and earlier): a #warning that it is the
  deprecated alias of soc/syscon_reg.h

Include soc/syscon_reg.h where it exists and read SYSCON_DATE_REG, the same
register as APB_CTRL_DATE_REG. Wrap the other includes in diagnostic
push / ignored / pop. -Wvolatile is named
only for GCC 10 and later and -Wliteral-suffix only for GCC, so older GCC
and Clang see no unknown-option warning. Warnings from the library's own
code are unaffected.
execDMAQueue() starts the queue through one of several target-specific
paths; on targets that use none of them the local was unused
(-Wunused-variable).
Stub overrides and platform implementations that ignore a parameter
(use_dma on buses without DMA, setSleep / setPowerSave on panels without
the command, heap_capable_dma() on platforms that never answer true, ...)
raised -Wunused-parameter under -Wextra. Comment the names out; the
signatures and behavior are unchanged.
- Panel_FrameBufferBase: rename a loop variable that shadowed a parameter
- esp32: drop the file-scope __DECLARE_RCC_ATOMIC_ENV stand-in, which every
  PERIPH_RCC_ATOMIC() block shadowed (-Wshadow). Where the I2C clock / reset
  needs no lock, the I2C_*_ATOMIC() macros now open a block that declares
  the variable locally, as PERIPH_RCC_ATOMIC() does.
- Panel_LT8912B: mark the log tag unused where logging compiles out
- QOI: compile the width overflow check only where size_t is 32 bits (it was
  always false with a 64-bit size_t)
@lovyan03
lovyan03 merged commit 2c36489 into m5stack:develop Oct 1, 2026
29 checks passed
@ainyan03
ainyan03 deleted the build_warnings branch October 1, 2026 03:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants