diff --git a/.clang-tidy.hash b/.clang-tidy.hash index e89b4230ad..25ae506732 100644 --- a/.clang-tidy.hash +++ b/.clang-tidy.hash @@ -1 +1 @@ -d9c755e5f019b2ecb324834717bc1fb8563e622f5751794cb7156d324884481e +58a760f5fd174bd438bcc3a7018292c158530c1a1d15181941c832d4c032511c diff --git a/esphome/components/bthome_mithermometer/bthome_ble.cpp b/esphome/components/bthome_mithermometer/bthome_ble.cpp index ff12e6157d..ff38ab1740 100644 --- a/esphome/components/bthome_mithermometer/bthome_ble.cpp +++ b/esphome/components/bthome_mithermometer/bthome_ble.cpp @@ -222,6 +222,7 @@ bool BTHomeMiThermometer::decrypt_bthome_payload_(const std::vector &da } size_t plaintext_length; + // NOLINTNEXTLINE(readability-suspicious-call-argument) - similarly named size args are not swapped psa_status_t status = psa_aead_decrypt(key_id, PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_CCM, BTHOME_MIC_SIZE), nonce.data(), nonce.size(), nullptr, 0, ct_with_tag, ct_with_tag_size, payload.data(), ciphertext_size, &plaintext_length); diff --git a/esphome/components/ledc/ledc_output.cpp b/esphome/components/ledc/ledc_output.cpp index bfb629143d..62833a7649 100644 --- a/esphome/components/ledc/ledc_output.cpp +++ b/esphome/components/ledc/ledc_output.cpp @@ -165,6 +165,8 @@ void LEDCOutput::write_state(float state) { void LEDCOutput::setup() { if (!ledc_peripheral_reset_done) { ESP_LOGV(TAG, "Resetting LEDC peripheral to clear stale state after reboot"); + // Skip under clang-tidy: the inlined HAL MMIO writes trip clang-analyzer-core.FixedAddressDereference +#if !defined(CLANG_TIDY) #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 1, 0) PERIPH_RCC_ATOMIC() { ledc_ll_reset_register(0); } #elif ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0) @@ -174,6 +176,7 @@ void LEDCOutput::setup() { } #else periph_module_reset(PERIPH_LEDC_MODULE); +#endif #endif ledc_peripheral_reset_done = true; } diff --git a/platformio.ini b/platformio.ini index d3fde193b4..182f426a31 100644 --- a/platformio.ini +++ b/platformio.ini @@ -132,10 +132,7 @@ extra_scripts = post:esphome/components/esp8266/post_build.py.script ; This are common settings for the ESP32 (all variants) using Arduino. [common:esp32-arduino] extends = common:arduino -platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.39/platform-espressif32.zip -platform_packages = - pioarduino/framework-arduinoespressif32@https://github.com/espressif/arduino-esp32/releases/download/3.3.9/esp32-core-3.3.9.tar.xz - pioarduino/framework-espidf@https://github.com/pioarduino/esp-idf/releases/download/v5.5.4/esp-idf-v5.5.4.tar.xz +platform = https://github.com/pioarduino/platform-espressif32.git framework = arduino, espidf ; Arduino as an ESP-IDF component lib_deps = @@ -167,9 +164,7 @@ extra_scripts = post:esphome/components/esp32/post_build.py.script ; This are common settings for the ESP32 (all variants) using IDF. [common:esp32-idf] extends = common:idf -platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.39/platform-espressif32.zip -platform_packages = - pioarduino/framework-espidf@https://github.com/pioarduino/esp-idf/releases/download/v5.5.4/esp-idf-v5.5.4.tar.xz +platform = https://github.com/pioarduino/platform-espressif32.git framework = espidf lib_deps = diff --git a/script/clang-tidy b/script/clang-tidy index f19bdb9b56..1416b9b332 100755 --- a/script/clang-tidy +++ b/script/clang-tidy @@ -73,6 +73,7 @@ def clang_options(idedata): "-freorder-blocks", "-fno-jump-tables", "-fno-shrink-wrap", + "-mno-target-align", ) if "zephyr" in triplet: @@ -137,6 +138,7 @@ def clang_options(idedata): if flag not in omit_flags and not flag.startswith("-Werror") and not flag.startswith("-std=") + and not flag.startswith("-mtune=esp") ) cmd.append("-std=gnu++20") diff --git a/sdkconfig.defaults b/sdkconfig.defaults index 8d177a7e26..2bd702f48e 100644 --- a/sdkconfig.defaults +++ b/sdkconfig.defaults @@ -2,6 +2,14 @@ # (clang-tidy) -- by both the PlatformIO and the native ESP-IDF toolchain paths -- and when PlatformIO is run directly # from the source directory (e.g. by IDEs). This should enable all flags that are set by any component. +# clang-tidy analyzes with clang, and IDF 6 only offers newlib under clang +# (picolibc's Kconfig depends on !IDF_TOOLCHAIN_CLANG). The idedata is generated +# with GCC, whose default is picolibc -- but clang-tidy uses the toolchain's +# newlib headers, so a picolibc build config mismatches them (IDF's hal/assert.h +# redeclares abort()/__assert_func() with [[noreturn]] after newlib's stdlib.h, +# tripping clang-diagnostic-error). Pin newlib to match the analyzed headers. +CONFIG_LIBC_NEWLIB=y + # esp32 CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_FREERTOS_HZ=1000