summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2022-07-11 23:57:34 +0700
committerhathach <[email protected]>2022-07-11 23:57:34 +0700
commitbb5dbd2da838773d8c1443ce52096ab9de63df19 (patch)
tree1a1520fa47ca775b6d231b37e35df826de2e2b5f
parent0bfb9d62de3a13b685437b503e2170550662bb96 (diff)
only enable warnings with approriate gcc version for rp2040
-rw-r--r--examples/example.cmake19
1 files changed, 10 insertions, 9 deletions
diff --git a/examples/example.cmake b/examples/example.cmake
index 3e395d53f..6b5e41dd9 100644
--- a/examples/example.cmake
+++ b/examples/example.cmake
@@ -4,28 +4,29 @@ target_compile_options(${PROJECT} PUBLIC
-Werror
-Wfatal-errors
-Wdouble-promotion
- #-Wstrict-prototypes
- -Wstrict-overflow
- #-Werror-implicit-function-declaration
-Wfloat-equal
- #-Wundef
-Wshadow
-Wwrite-strings
-Wsign-compare
-Wmissing-format-attribute
-Wunreachable-code
-Wcast-align
- -Wcast-function-type
-Wcast-qual
-Wnull-dereference
-Wuninitialized
-Wunused
-Wredundant-decls
+ #-Wstrict-prototypes
+ #-Werror-implicit-function-declaration
+ #-Wundef
)
-# GCC version 9 or prior has a bug with incorrect Wconversion warnings
+# GCC 10
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)
- target_compile_options(${PROJECT} PUBLIC
- -Wconversion
- )
+ target_compile_options(${PROJECT} PUBLIC -Wconversion)
+endif()
+
+# GCC 8
+if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
+ target_compile_options(${PROJECT} PUBLIC -Wcast-function-type -Wstrict-overflow)
endif()