Clear the compiler warnings from the library sources and the ESP-IDF headers it includes - #325
Merged
Merged
Conversation
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
-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#warningin IDF 5.2) is replaced bysoc/syscon_reg.handSYSCON_DATE_REG(same register)-Wunused-variableon targets that start the queue another way-Wunused-parameter(lgfx/v1sources)-Wshadow(Panel_FrameBufferBase; the file-scope__DECLARE_RCC_ATOMIC_ENVstand-in that everyPERIPH_RCC_ATOMIC()shadowed is replaced by a block-local one), unused log tag (LT8912B), always-false QOI width check on 64-bitsize_t-Wshadowin 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):
Left as is:
-Warray-boundsinBus_SPI::set_read_len(GCC 12 false positive on the register address; no local fix shown to keep the generated code identical) and-Wmaybe-uninitializedat 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.