From 8e113ea9ae595b1bc37e7a567b0bc6b90ec81c05 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Fri, 19 Apr 2024 16:51:53 +1000 Subject: [PATCH] squash a bunch of warnings --- lib/libcppbor/CMakeLists.txt | 2 ++ lib/libmad/CMakeLists.txt | 1 + lib/luavgl/CMakeLists.txt | 1 + lib/lvgl/env_support/cmake/esp.cmake | 1 + lib/opus/CMakeLists.txt | 2 +- lib/speexdsp/CMakeLists.txt | 2 +- lib/tremor/CMakeLists.txt | 2 +- src/database/track.cpp | 2 +- src/drivers/adc.cpp | 2 +- src/drivers/bluetooth.cpp | 3 ++- tools/cmake/common.cmake | 10 +++++----- 11 files changed, 17 insertions(+), 11 deletions(-) diff --git a/lib/libcppbor/CMakeLists.txt b/lib/libcppbor/CMakeLists.txt index f68a820c..66c862f5 100644 --- a/lib/libcppbor/CMakeLists.txt +++ b/lib/libcppbor/CMakeLists.txt @@ -5,3 +5,5 @@ idf_component_register( SRCS cppbor.cpp cppbor_parse.cpp INCLUDE_DIRS "include/cppbor" ) +target_compile_options(${COMPONENT_LIB} PRIVATE + "-Wno-shadow" "-Wno-deprecated-enum-enum-conversion") diff --git a/lib/libmad/CMakeLists.txt b/lib/libmad/CMakeLists.txt index e56cabaf..078b90b7 100644 --- a/lib/libmad/CMakeLists.txt +++ b/lib/libmad/CMakeLists.txt @@ -41,6 +41,7 @@ target_compile_options(${COMPONENT_LIB} $<$:-Wno-implicit-function-declaration> $<$:-Wno-stringop-overflow> $<$:-fPIC> + -Wno-implicit-fallthrough -Ofast ) diff --git a/lib/luavgl/CMakeLists.txt b/lib/luavgl/CMakeLists.txt index c1f3e8a1..b7d53d6c 100644 --- a/lib/luavgl/CMakeLists.txt +++ b/lib/luavgl/CMakeLists.txt @@ -2,4 +2,5 @@ # # SPDX-License-Identifier: GPL-3.0-only idf_component_register(SRCS "src/luavgl.c" INCLUDE_DIRS "src" REQUIRES "esp-idf-lua" "lvgl") +target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-cast-function-type" "-Wno-type-limits") diff --git a/lib/lvgl/env_support/cmake/esp.cmake b/lib/lvgl/env_support/cmake/esp.cmake index fb283fb3..443fb514 100644 --- a/lib/lvgl/env_support/cmake/esp.cmake +++ b/lib/lvgl/env_support/cmake/esp.cmake @@ -31,6 +31,7 @@ else() REQUIRES esp_timer) target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLV_CONF_INCLUDE_SIMPLE") + target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-missing-field-initializers" "-Wno-incompatible-pointer-types") if(CONFIG_LV_ATTRIBUTE_FAST_MEM_USE_IRAM) target_compile_definitions(${COMPONENT_LIB} diff --git a/lib/opus/CMakeLists.txt b/lib/opus/CMakeLists.txt index 5c33c42d..0071fa50 100644 --- a/lib/opus/CMakeLists.txt +++ b/lib/opus/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") include(OpusPackageVersion) diff --git a/lib/speexdsp/CMakeLists.txt b/lib/speexdsp/CMakeLists.txt index 8d323f33..daeddfa9 100644 --- a/lib/speexdsp/CMakeLists.txt +++ b/lib/speexdsp/CMakeLists.txt @@ -10,4 +10,4 @@ libspeexdsp/scal.c libspeexdsp/smallft.c PRIV_INCLUDE_DIRS "libspeexdsp" ) -target_compile_options(${COMPONENT_LIB} PRIVATE -DHAVE_CONFIG_H -Wno-shift-negative-value -Wno-unused-const-variable) +target_compile_options(${COMPONENT_LIB} PRIVATE -DHAVE_CONFIG_H -Wno-shift-negative-value -Wno-unused-const-variable -Wno-incompatible-pointer-types -Wno-unused-function -Wno-unused-variable) diff --git a/lib/tremor/CMakeLists.txt b/lib/tremor/CMakeLists.txt index 530c0493..47037a7f 100644 --- a/lib/tremor/CMakeLists.txt +++ b/lib/tremor/CMakeLists.txt @@ -5,4 +5,4 @@ idf_component_register( SRCS bitwise.c codebook.c dsp.c floor0.c floor1.c floor_lookup.c framing.c info.c mapping0.c mdct.c misc.c res012.c vorbisfile.c INCLUDE_DIRS ".") -target_compile_options("${COMPONENT_LIB}" PRIVATE -Ofast -Wno-error=misleading-indentation -Wno-error=maybe-uninitialized -Wno-error=char-subscripts -Wno-error=unused-label) +target_compile_options("${COMPONENT_LIB}" PRIVATE -Ofast -Wno-misleading-indentation -Wno-maybe-uninitialized -Wno-char-subscripts -Wno-unused-label -Wno-shift-negative-value -Wno-unused-variable -Wno-type-limits -Wno-implicit-fallthrough) diff --git a/src/database/track.cpp b/src/database/track.cpp index 141a9b7e..a2bd05d3 100644 --- a/src/database/track.cpp +++ b/src/database/track.cpp @@ -234,7 +234,7 @@ auto TrackTags::genres(const std::string_view s) -> void { std::string src = {s.data(), s.size()}; char* token = std::strtok(src.data(), kGenreDelimiters); - auto trim_and_add = [=](std::string_view s) { + auto trim_and_add = [this](std::string_view s) { std::string copy = {s.data(), s.size()}; // Trim the left diff --git a/src/drivers/adc.cpp b/src/drivers/adc.cpp index 56d2cbb4..3379a1ae 100644 --- a/src/drivers/adc.cpp +++ b/src/drivers/adc.cpp @@ -18,7 +18,7 @@ static const adc_bitwidth_t kAdcBitWidth = ADC_BITWIDTH_12; static const adc_unit_t kAdcUnit = ADC_UNIT_1; // Max battery voltage should be a little over 2V due to our divider, so we need // the max attenuation to properly handle the full range. -static const adc_atten_t kAdcAttenuation = ADC_ATTEN_DB_11; +static const adc_atten_t kAdcAttenuation = ADC_ATTEN_DB_12; // Corresponds to SENSOR_VP. static const adc_channel_t kAdcChannel = ADC_CHANNEL_0; diff --git a/src/drivers/bluetooth.cpp b/src/drivers/bluetooth.cpp index edd5f67e..5d1b35fa 100644 --- a/src/drivers/bluetooth.cpp +++ b/src/drivers/bluetooth.cpp @@ -438,7 +438,8 @@ void Disabled::react(const events::Enable&) { return; } - if ((err = esp_bluedroid_init() != ESP_OK)) { + esp_bluedroid_config_t cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT(); + if ((err = esp_bluedroid_init_with_cfg(&cfg) != ESP_OK)) { ESP_LOGE(kTag, "initialize bluedroid failed %s", esp_err_to_name(err)); return; } diff --git a/tools/cmake/common.cmake b/tools/cmake/common.cmake index 872bf555..896dabf3 100644 --- a/tools/cmake/common.cmake +++ b/tools/cmake/common.cmake @@ -43,11 +43,11 @@ include($ENV{IDF_PATH}/tools/cmake/project.cmake) # Additional warnings used when compiling our components. # Unable to be used due to issues in ESP-IDF includes are: -Wpedantic # -Wuseless-cast -Wconversion -Wold-style-cast -Wsign-conversion -Wcast-align -set(EXTRA_WARNINGS "-Wshadow" "-Wnon-virtual-dtor" "-Wunused" - "-Woverloaded-virtual" "-Wmisleading-indentation" "-Wduplicated-cond" - "-Wduplicated-branches" "-Wlogical-op" "-Wnull-dereference" - "-Wdouble-promotion" "-Wformat=2" "-Wimplicit-fallthrough" - "-Wno-deprecated-enum-enum-conversion" "-Wno-array-bounds") +set(EXTRA_WARNINGS "-Wnon-virtual-dtor" "-Wunused" "-Woverloaded-virtual" + "-Wmisleading-indentation" "-Wduplicated-cond" "-Wduplicated-branches" + "-Wlogical-op" "-Wnull-dereference" "-Wdouble-promotion" "-Wformat=2" + "-Wimplicit-fallthrough" "-Wno-deprecated-enum-enum-conversion" + "-Wno-array-bounds" "-Wno-missing-field-initializers") # Extra build flags that should apply to the entire build. This should mostly # just be used to setting flags that our external dependencies requires.