Hi.
Modern compilators, like Java, .NET have warnings like “variable xyz is not used” or “variable xyz is assigned but not used”. As I understand, it is impossible for C++ compiler used in PlatformIo. Maybe someone knows a plugin (or something similar) to check a code for unused variables and other “trash” fragments?
Wut? That’s a standard warning in every good C/C++ compiler, especially the GCC toolchains used in PlatformIO.
See https://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/Warning-Options.html with
-Wunused-parameter
-Wunused-variable
-Wunused-value
All of these warnings are enabeld with -Wunused
, or better yet, just through -Wall -Wextra
at the problem. You can activate these additional warnings in the build_flags, unless some builder script has turned them of by using the -w
option (“Inhibit all warnings”).
You can see which compiler flags are used with project-tasks → Advanced → Verbose Build.
In addition to that, PlatformIO’s built in code checkers (cppcheck
) should also catch this. See pio check
and Static Code Analysis — PlatformIO latest documentation.
Thank you. It does work!