@@ -152,6 +152,9 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
152
152
if (NOT PICO_TINYUSB_NO_EXAMPLE_WARNINGS )
153
153
family_add_default_example_warnings (${TARGET} )
154
154
endif ()
155
+ if (CMAKE_C_COMPILER_ID STREQUAL "Clang" )
156
+ target_compile_options (${TARGET} PRIVATE -Wno-unreachable-code )
157
+ endif ()
155
158
suppress_tinyusb_warnings ()
156
159
endfunction ()
157
160
@@ -172,8 +175,8 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
172
175
173
176
# For rp2040 enable pico-pio-usb
174
177
if (TARGET tinyusb_pico_pio_usb )
175
- # code does not compile with GCC 12 +
176
- if (NOT ( CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.3 ) )
178
+ # code does not compile with non GCC, or GCC 11.3 +
179
+ if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.3 )
177
180
family_add_pico_pio_usb (${PROJECT} )
178
181
endif ()
179
182
endif ()
@@ -278,7 +281,7 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
278
281
COMPILE_FLAGS "-Wno-conversion" )
279
282
endforeach ()
280
283
endif ()
281
- if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0 )
284
+ if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0 )
282
285
set_source_files_properties (
283
286
${PICO_TINYUSB_PATH} /lib/fatfs/source/ff.c
284
287
COMPILE_FLAGS "-Wno-stringop-overflow -Wno-array-bounds" )
@@ -310,6 +313,17 @@ if (NOT TARGET _rp2040_family_inclusion_marker)
310
313
PROPERTIES
311
314
COMPILE_FLAGS "-Wno-conversion -Wno-cast-qual -Wno-attributes" )
312
315
endif ()
316
+ elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang" )
317
+ set_source_files_properties (
318
+ ${PICO_TINYUSB_PATH} /src/class/cdc/cdc_device.c
319
+ COMPILE_FLAGS "-Wno-unreachable-code" )
320
+ set_source_files_properties (
321
+ ${PICO_TINYUSB_PATH} /src/class/cdc/cdc_host.c
322
+ COMPILE_FLAGS "-Wno-unreachable-code-fallthrough" )
323
+ set_source_files_properties (
324
+ ${PICO_TINYUSB_PATH} /lib/fatfs/source/ff.c
325
+ PROPERTIES
326
+ COMPILE_FLAGS "-Wno-cast-qual" )
313
327
endif ()
314
328
endfunction ()
315
329
endif ()
0 commit comments