From 69087f42dc3f59ec54a9846c61b9baeeedafb2e1 Mon Sep 17 00:00:00 2001 From: MacDada Date: Mon, 1 May 2023 16:39:08 +0200 Subject: [PATCH] PIO: enabled `-Wextra` for _my_ code and not for dependencies --- config/common.ini | 29 ++++++++++++++++++++++++----- config/native.ini | 5 +++++ config/nodemcu.ini | 5 +++++ 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/config/common.ini b/config/common.ini index 2725691..0eb3ee5 100644 --- a/config/common.ini +++ b/config/common.ini @@ -21,11 +21,6 @@ build_flags = ; todo: enable more code quality checkers, just exclude vendor libs somehow… - ; This enables some extra warning flags that are not enabled by -Wall. - ; https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html - ; it is OK for my code, shitload of warnings for included libs -; -Wextra - ; Warn when a function declaration hides virtual functions from a base clas ; https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html ; it is OK for my code, shitload of warnings for included libs @@ -58,3 +53,27 @@ build_flags = ; https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html ; Too much shit from included libs ; -fanalyzer + +; List of flags that I want to be applied to _my_ code, +; while I don't want them for the external libraries (dependencies). +; +; Despite the name, it applies also to files in `lib` and `test`. +; +; -> Mostly because the external libs are not / will not be fixed, +; and I don't want them to pollute my build results. +; -> Hence not using `build_flags`. +; +; https://docs.platformio.org/en/latest/projectconf/sections/env/options/build/build_src_flags.html +; https://docs.platformio.org/en/latest/projectconf/sections/env/options/build/build_flags.html +build_src_flags = + ; Enables some extra warning flags that are not enabled by -Wall. + ; https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html + ; + ; todo: check that unity warning disappears after PIO upgrade to 6.1.7: + ; .pio/build/native/unity_config/unity_config.c:39:37: + ; warning: unused parameter 'baudrate' [-Wunused-parameter] + ; https://github.com/platformio/platformio-core/pull/4610 + ; + ; todo: move to build_flags when fixed: + ; https://github.com/ayushsharma82/WebSerial/pull/63 + -Wextra diff --git a/config/native.ini b/config/native.ini index 9b50ad2..3fc68a1 100644 --- a/config/native.ini +++ b/config/native.ini @@ -26,6 +26,11 @@ lib_compat_mode = off build_flags = ${common.build_flags} +; https://docs.platformio.org/en/latest/projectconf/sections/env/options/build/build_src_flags.html +; https://docs.platformio.org/en/latest/projectconf/sections/env/options/build/build_flags.html +build_src_flags = + ${common.build_src_flags} + ; https://docs.platformio.org/en/latest/projectconf/section_env_build.html#build-src-filter build_src_filter = "+" diff --git a/config/nodemcu.ini b/config/nodemcu.ini index 5b6965b..887bc37 100644 --- a/config/nodemcu.ini +++ b/config/nodemcu.ini @@ -87,6 +87,11 @@ build_flags = ; https://git-scm.com/docs/pretty-formats/2.39.0 !echo '-D BUILD_GIT_COMMIT_HASH=\\"'$(git log -1 --format=%%h)'\\"' +; https://docs.platformio.org/en/latest/projectconf/sections/env/options/build/build_src_flags.html +; https://docs.platformio.org/en/latest/projectconf/sections/env/options/build/build_flags.html +build_src_flags = + ${common.build_src_flags} + ; https://docs.platformio.org/en/latest/projectconf/section_env_library.html#lib-deps lib_deps = ${common.lib_deps}