More warning cleanup

- physically suppress warnings in TinyUSB headers using pragmas so they don't break -Werror compilation of external files that include them
 - fix compiler warnings in rp2040 port
 - add cmake method to rp2040 port to allow an external project to suppress warnings in TinyUSB itself
This commit is contained in:
graham sanderson
2021-10-14 15:20:32 -05:00
parent d94a5aa044
commit 06d9555389
5 changed files with 53 additions and 16 deletions
+24 -1
View File
@@ -77,7 +77,6 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
${TOP}/src/class/video/video_device.c
)
# Base config for host mode; wrapped by SDK's tinyusb_host
add_library(tinyusb_host_base INTERFACE)
target_sources(tinyusb_host_base INTERFACE
@@ -153,4 +152,28 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
enable_language(C CXX ASM)
pico_sdk_init()
endfunction()
# This method must be called from the project scope to suppress known warnings in TinyUSB source files
function(suppress_tinyusb_warnings)
set_source_files_properties(
${PICO_TINYUSB_PATH}/src/tusb.c
PROPERTIES
COMPILE_FLAGS "-Wno-conversion")
set_source_files_properties(
${PICO_TINYUSB_PATH}/src/common/tusb_fifo.c
PROPERTIES
COMPILE_FLAGS "-Wno-conversion -Wno-cast-qual")
set_source_files_properties(
${PICO_TINYUSB_PATH}/src/device/usbd.c
PROPERTIES
COMPILE_FLAGS "-Wno-conversion -Wno-cast-qual -Wno-null-dereference")
set_source_files_properties(
${PICO_TINYUSB_PATH}/src/device/usbd_control.c
PROPERTIES
COMPILE_FLAGS "-Wno-conversion")
set_source_files_properties(
${PICO_TINYUSB_PATH}/src/class/cdc/cdc_device.c
PROPERTIES
COMPILE_FLAGS "-Wno-conversion")
endfunction()
endif()