Skip to content

Commit 868f2bc

Browse files
authored
Merge pull request #1554 from kilograham/rp2040_warning2
Rework CMake example warnings some more
2 parents 1a8c3a8 + 7e4c0f6 commit 868f2bc

File tree

29 files changed

+101
-133
lines changed

29 files changed

+101
-133
lines changed

Diff for: examples/device/audio_4_channel_mic/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ target_include_directories(${PROJECT} PUBLIC
2323
${CMAKE_CURRENT_SOURCE_DIR}/src
2424
)
2525

26-
# Example common such as compiler warnings
27-
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
28-
2926
# Configure compilation flags and libraries for the example... see the corresponding function
3027
# in hw/bsp/FAMILY/family.cmake for details.
3128
family_configure_device_example(${PROJECT})

Diff for: examples/device/audio_test/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ target_include_directories(${PROJECT} PUBLIC
2323
${CMAKE_CURRENT_SOURCE_DIR}/src
2424
)
2525

26-
# Example common such as compiler warnings
27-
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
28-
2926
# Configure compilation flags and libraries for the example... see the corresponding function
3027
# in hw/bsp/FAMILY/family.cmake for details.
3128
family_configure_device_example(${PROJECT})

Diff for: examples/device/board_test/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ else()
3636
${CMAKE_CURRENT_SOURCE_DIR}/src
3737
)
3838

39-
# Example common such as compiler warnings
40-
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
41-
4239
# Configure compilation flags and libraries for the example... see the corresponding function
4340
# in hw/bsp/FAMILY/family.cmake for details.
4441
family_configure_device_example(${PROJECT})

Diff for: examples/device/cdc_dual_ports/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ target_include_directories(${PROJECT} PUBLIC
2323
${CMAKE_CURRENT_SOURCE_DIR}/src
2424
)
2525

26-
# Example common such as compiler warnings
27-
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
28-
2926
# Configure compilation flags and libraries for the example... see the corresponding function
3027
# in hw/bsp/FAMILY/family.cmake for details.
3128
family_configure_device_example(${PROJECT})

Diff for: examples/device/cdc_msc/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ target_include_directories(${PROJECT} PUBLIC
2424
${CMAKE_CURRENT_SOURCE_DIR}/src
2525
)
2626

27-
# Example common such as compiler warnings
28-
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
29-
3027
# Configure compilation flags and libraries for the example... see the corresponding function
3128
# in hw/bsp/FAMILY/family.cmake for details.
3229
family_configure_device_example(${PROJECT})

Diff for: examples/device/dfu/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ target_include_directories(${PROJECT} PUBLIC
2323
${CMAKE_CURRENT_SOURCE_DIR}/src
2424
)
2525

26-
# Example common such as compiler warnings
27-
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
28-
2926
# Configure compilation flags and libraries for the example... see the corresponding function
3027
# in hw/bsp/FAMILY/family.cmake for details.
3128
family_configure_device_example(${PROJECT})

Diff for: examples/device/dfu_runtime/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ target_include_directories(${PROJECT} PUBLIC
2323
${CMAKE_CURRENT_SOURCE_DIR}/src
2424
)
2525

26-
# Example common such as compiler warnings
27-
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
28-
2926
# Configure compilation flags and libraries for the example... see the corresponding function
3027
# in hw/bsp/FAMILY/family.cmake for details.
3128
family_configure_device_example(${PROJECT})

Diff for: examples/device/dynamic_configuration/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ target_include_directories(${PROJECT} PUBLIC
2424
${CMAKE_CURRENT_SOURCE_DIR}/src
2525
)
2626

27-
# Example common such as compiler warnings
28-
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
29-
3027
# Configure compilation flags and libraries for the example... see the corresponding function
3128
# in hw/bsp/FAMILY/family.cmake for details.
3229
family_configure_device_example(${PROJECT})

Diff for: examples/device/hid_boot_interface/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ target_include_directories(${PROJECT} PUBLIC
2323
${CMAKE_CURRENT_SOURCE_DIR}/src
2424
)
2525

26-
# Example common such as compiler warnings
27-
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
28-
2926
# Configure compilation flags and libraries for the example... see the corresponding function
3027
# in hw/bsp/FAMILY/family.cmake for details.
3128
family_configure_device_example(${PROJECT})

Diff for: examples/device/hid_composite/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ target_include_directories(${PROJECT} PUBLIC
2323
${CMAKE_CURRENT_SOURCE_DIR}/src
2424
)
2525

26-
# Example common such as compiler warnings
27-
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
28-
2926
# Configure compilation flags and libraries for the example... see the corresponding function
3027
# in hw/bsp/FAMILY/family.cmake for details.
3128
family_configure_device_example(${PROJECT})

Diff for: examples/device/hid_generic_inout/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ target_include_directories(${PROJECT} PUBLIC
2323
${CMAKE_CURRENT_SOURCE_DIR}/src
2424
)
2525

26-
# Example common such as compiler warnings
27-
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
28-
2926
# Configure compilation flags and libraries for the example... see the corresponding function
3027
# in hw/bsp/FAMILY/family.cmake for details.
3128
family_configure_device_example(${PROJECT})

Diff for: examples/device/hid_multiple_interface/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ target_include_directories(${PROJECT} PUBLIC
2323
${CMAKE_CURRENT_SOURCE_DIR}/src
2424
)
2525

26-
# Example common such as compiler warnings
27-
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
28-
2926
# Configure compilation flags and libraries for the example... see the corresponding function
3027
# in hw/bsp/FAMILY/family.cmake for details.
3128
family_configure_device_example(${PROJECT})

Diff for: examples/device/midi_test/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ target_include_directories(${PROJECT} PUBLIC
2323
${CMAKE_CURRENT_SOURCE_DIR}/src
2424
)
2525

26-
# Example common such as compiler warnings
27-
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
28-
2926
# Configure compilation flags and libraries for the example... see the corresponding function
3027
# in hw/bsp/FAMILY/family.cmake for details.
3128
family_configure_device_example(${PROJECT})

Diff for: examples/device/msc_dual_lun/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ target_include_directories(${PROJECT} PUBLIC
2424
${CMAKE_CURRENT_SOURCE_DIR}/src
2525
)
2626

27-
# Example common such as compiler warnings
28-
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
29-
3027
# Configure compilation flags and libraries for the example... see the corresponding function
3128
# in hw/bsp/FAMILY/family.cmake for details.
3229
family_configure_device_example(${PROJECT})

Diff for: examples/device/net_lwip_webserver/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ if (EXISTS ${TOP}/lib/lwip/src)
6969
${TOP}/lib/networking/rndis_reports.c
7070
)
7171

72-
# Example common such as compiler warnings
73-
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
74-
7572
# due to warnings from other net source, we need to prevent error from some of the warnings options
7673
target_compile_options(${PROJECT} PUBLIC
7774
-Wno-error=null-dereference

Diff for: examples/device/uac2_headset/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ target_include_directories(${PROJECT} PUBLIC
2323
${CMAKE_CURRENT_SOURCE_DIR}/src
2424
)
2525

26-
# Example common such as compiler warnings
27-
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
28-
2926
# Configure compilation flags and libraries for the example... see the corresponding function
3027
# in hw/bsp/FAMILY/family.cmake for details.
3128
family_configure_device_example(${PROJECT})

Diff for: examples/device/usbtmc/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ target_include_directories(${PROJECT} PUBLIC
2424
${CMAKE_CURRENT_SOURCE_DIR}/src
2525
)
2626

27-
# Example common such as compiler warnings
28-
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
29-
3027
# Configure compilation flags and libraries for the example... see the corresponding function
3128
# in hw/bsp/FAMILY/family.cmake for details.
3229
family_configure_device_example(${PROJECT})

Diff for: examples/device/video_capture/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ target_include_directories(${PROJECT} PUBLIC
2323
${CMAKE_CURRENT_SOURCE_DIR}/src
2424
)
2525

26-
# Example common such as compiler warnings
27-
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
28-
2926
# Configure compilation flags and libraries for the example... see the corresponding function
3027
# in hw/bsp/FAMILY/family.cmake for details.
3128
family_configure_device_example(${PROJECT})

Diff for: examples/device/webusb_serial/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ target_include_directories(${PROJECT} PUBLIC
2323
${CMAKE_CURRENT_SOURCE_DIR}/src
2424
)
2525

26-
# Example common such as compiler warnings
27-
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
28-
2926
# Configure compilation flags and libraries for the example... see the corresponding function
3027
# in hw/bsp/FAMILY/family.cmake for details.
3128
family_configure_device_example(${PROJECT})

Diff for: examples/dual/host_hid_to_device_cdc/CMakeLists.txt

+3-6
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ target_include_directories(${PROJECT} PUBLIC
2323
${CMAKE_CURRENT_SOURCE_DIR}/src
2424
)
2525

26-
# Example common such as compiler warnings
27-
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
26+
# Configure compilation flags and libraries for the example... see the corresponding function
27+
# in hw/bsp/FAMILY/family.cmake for details.
28+
family_configure_dual_usb_example(${PROJECT})
2829

2930
# due to warnings from other net source, we need to prevent error from some of the warnings options
3031
target_compile_options(${PROJECT} PUBLIC
@@ -37,7 +38,3 @@ target_compile_options(${PROJECT} PUBLIC
3738
-Wno-error=sign-compare
3839
-Wno-error=unused-function
3940
)
40-
41-
# Configure compilation flags and libraries for the example... see the corresponding function
42-
# in hw/bsp/FAMILY/family.cmake for details.
43-
family_configure_dual_usb_example(${PROJECT})

Diff for: examples/example.cmake

-32
This file was deleted.

Diff for: examples/host/bare_api/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ target_include_directories(${PROJECT} PUBLIC
2222
${CMAKE_CURRENT_SOURCE_DIR}/src
2323
)
2424

25-
# Example common such as compiler warnings
26-
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
27-
2825
# Configure compilation flags and libraries for the example... see the corresponding function
2926
# in hw/bsp/FAMILY/family.cmake for details.
3027
family_configure_host_example(${PROJECT})

Diff for: examples/host/cdc_msc_hid/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ target_include_directories(${PROJECT} PUBLIC
2424
${CMAKE_CURRENT_SOURCE_DIR}/src
2525
)
2626

27-
# Example common such as compiler warnings
28-
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
29-
3027
# Configure compilation flags and libraries for the example... see the corresponding function
3128
# in hw/bsp/FAMILY/family.cmake for details.
3229
family_configure_host_example(${PROJECT})

Diff for: examples/host/hid_controller/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ target_include_directories(${PROJECT} PUBLIC
2323
${CMAKE_CURRENT_SOURCE_DIR}/src
2424
)
2525

26-
# Example common such as compiler warnings
27-
include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
28-
2926
# Configure compilation flags and libraries for the example... see the corresponding function
3027
# in hw/bsp/FAMILY/family.cmake for details.
3128
family_configure_host_example(${PROJECT})

Diff for: hw/bsp/family_support.cmake

+42
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,48 @@ if (NOT TARGET _family_support_marker)
7979
endif()
8080
endfunction()
8181

82+
function(family_add_default_example_warnings TARGET)
83+
target_compile_options(${TARGET} PUBLIC
84+
-Wall
85+
-Wextra
86+
-Werror
87+
-Wfatal-errors
88+
-Wdouble-promotion
89+
-Wfloat-equal
90+
-Wshadow
91+
-Wwrite-strings
92+
-Wsign-compare
93+
-Wmissing-format-attribute
94+
-Wunreachable-code
95+
-Wcast-align
96+
-Wcast-qual
97+
-Wnull-dereference
98+
-Wuninitialized
99+
-Wunused
100+
-Wredundant-decls
101+
#-Wstrict-prototypes
102+
#-Werror-implicit-function-declaration
103+
#-Wundef
104+
)
105+
106+
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
107+
# GCC 10
108+
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)
109+
target_compile_options(${TARGET} PUBLIC -Wconversion)
110+
endif()
111+
112+
# GCC 8
113+
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
114+
target_compile_options(${TARGET} PUBLIC -Wcast-function-type -Wstrict-overflow)
115+
endif()
116+
117+
# GCC 6
118+
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0)
119+
target_compile_options(${TARGET} PUBLIC -Wno-strict-aliasing)
120+
endif()
121+
endif()
122+
endfunction()
123+
82124
# configure an executable target to link to tinyusb in device mode, and add the board implementation
83125
function(family_configure_device_example TARGET)
84126
# default implentation is empty, the function should be redefined in the FAMILY/family.cmake

0 commit comments

Comments
 (0)