-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Component with Wpedantic flag causing warning on generated project_elf_src_esp32.c file (IDFGH-7292) #8881
Comments
Hi @Barabas5532. Please also consider reading https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html. We will consider your suggestions but I cannot promise it will be very soon. The documentation (https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html#controlling-component-compilation) recommends to set PRIVATE flags for components. |
@dobairoland I don't think you can set PRIVATE for interface libraries. I will take a look at your suggestion, maybe filtering libraries that are being linked into the final app executable is an option. As Roland said, don't expect this to be very soon. |
Another note, I think among various possible compiler flags, there are many such flags which, when added to global CFLAGS, will result in errors or warnings from ESP-IDF components. For any such flag, IDF can make a choice:
The first approach is sometimes difficult as the ordering of private and public compiler flags doesn't always work the way one would expect. The 2nd approach may in some cases require an impractical number of changes in ESP-IDF (as is the case for -Wpedantic, -Wundef).
I think you are right. However an application might not have a |
Yes, that is what makes this compiler flags library useful. Other libraries in the project link to it using PRIVATE, so that the compiler flags are added to the build for the source files in that library. The flags can be changed for the whole project all at once in the compiler flags library. Usually we can control which library links which other libraries. This is not the case with the I've made a slight mistake on the original post, adding Changing this line: esp-idf/tools/cmake/project.cmake Line 419 in 8153bfe
to
does work. https://stackoverflow.com/questions/26541150/warning-iso-c-forbids-an-empty-translation-unit |
Is your feature request related to a problem? Please describe.
When there is a component in the project that adds
Wpedantic
to its public or interface compile options, then a warning appears on the generatedproject_elf_src_esp32.c
file.A project might have a component like this to provide compiler flags to be used by other component to enable compiler warnings, etc. An example is available in the JUCE project:
The warning generated is:
Describe the solution you'd like
I've found that adding
target_link_libraries(${project_elf} "-Wno-pedantic")
around here:esp-idf/tools/cmake/project.cmake
Line 447 in 8153bfe
The warning appeared because the
project_elf
target links to all the components defined in the project, including the component defining the extra warning flags:esp-idf/tools/cmake/project.cmake
Line 443 in 8153bfe
Why does
project_elf
link to all other components? Could it just link to the main component and then all other components are pulled in transitively, avoiding linking these unintended flags?Please correct me if I'm wrong, but I don't think linking the
project_elf
target to anyINTERFACE
library does anything useful? Linking onlySTATIC
libraries might be another fix.Additional context
I'm trying to implement the practices from this article into my project: https://www.foonathan.net/2018/10/cmake-warnings/
The text was updated successfully, but these errors were encountered: