Sorry, but this answer is not useful at all. Sure I will fix my bugs, but there's no reason on earth why I should follow ESP's warning/error policy and not my own.
Just as an example, when I enable -Weffc++ I have a massive amount of warnings on ESP's code, and if my policy is to enable -Werror for zero warnings on release - but not on development - then I'll have to fix IDF's own error or modify my policy. I hope you agree that both solutions are suboptimal to say the least, and I don't see any solid reason to force that on the users.
The right solution is to compile the IDF files with the flags and policy that IDF decides are the best, and let other developers chose their set of flags and policies on their files, not to enforce your policy to everyone.
Try this, if you're not convinced:
Code: Select all
// main.cpp
#include <stdio.h>
#include <stdbool.h>
#include <unistd.h>
#include "Arduino.h"
extern "C" void app_main(void)
{
while (true) {
printf("Hello from app_main!\n");
sleep(1);
}
}
project cmake:
Code: Select all
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(app-template)
main cmake:
Code: Select all
# See the build system documentation in IDF programming guide
# for more information about component CMakeLists.txt files.
idf_component_register(
SRCS main.cpp # list the source files of this component
INCLUDE_DIRS # optional, add here public include directories
PRIV_INCLUDE_DIRS # optional, add here private include directories
REQUIRES # optional, list the public requirements (component names)
PRIV_REQUIRES # optional, list the private requirements
)
target_compile_options(${COMPONENT_LIB} PRIVATE "-Werror" "-Wall" "-Wextra" "-Wpedantic" "-Weffc++" "-O3" "-std=c++23" )
Seems quite basic to me, but it will fail to build. And if you're telling me that I have to change my policy to match IDF's, then sorry but i strongly disagree, and there's nothing to discuss further unless you bring a real solution.
Bye
Andrea