Can one turn off error: this 'if' clause does not guard

Changing IDF releases, I am finding code that previously did not compile is now not compiling due to less permissive compiler errors. The thing is… it’s other people’s libraries. I can fix the code but every time I add the library to a new project, I will go through the same thing again. The error: this ‘if’ clause does not guard… is more a style error than a bug. Can I change that be become a warning instead of an error?

In general you can use build_unflags to remove compiler flags like -Werror=misleading-indentation and add flags like -Wno-error=misleading-indentation with build_flags. ESP-IDF with its CMake build system might be a special case though. In any case, have you identified which build flag it is exactly that makes GCC terminate on this warning? Remember that you can see full compiler invocations with project tasks → Advanced → Verbose Build.

1 Like

Max, Yes it was “misleading-indentation” error and using the -Wno-error=misleading-indentation build flag was just what I needed. Thank you!