Replies: 7 comments 9 replies
-
cc @tejlmand |
Beta Was this translation helpful? Give feedback.
-
@henrikbrixandersen wrote in #44830 :
Most compilers (gcc, clang) would have the option to declare these headers as System Headers which gives them special treatment concerning warnings. CMake support System Headers via INTERFACE_SYSTEM_INCLUDE_DIRECTORIES but I didn't see any option how an application could set this. Or is there any? |
Beta Was this translation helpful? Give feedback.
-
Even if global use of |
Beta Was this translation helpful? Give feedback.
-
Just dropping in to say this is needed. Maybe I'm crazy, but adding AKA # https://cmake.org/cmake/help/latest/command/target_include_directories.html
function(zephyr_include_directories)
target_include_directories(zephyr_interface SYSTEM INTERFACE ${ARGV})
endfunction() (making it the same as Should it be possible for the user to add compiler warnings for their application source alone? If so, how will we go about supporting this? |
Beta Was this translation helpful? Give feedback.
-
That is why I suggested making it a build option.
|
Beta Was this translation helpful? Give feedback.
-
unfortunately not atm, as it is the compiler which expands the included headers provided with
although it sounds like a very simply thing to do, allowing users to change this as a build option, then the devil is in the details.
This sounds like a valid use-case, but would need to be prioritized among lot of other features.
Open proposal, feel free to comment or adjust recommendation.
zephyr/cmake/modules/kernel.cmake Lines 207 to 210 in e7fdb31 Being a Zephyr library means that it will always inherit Such a CMakeLists.txt could then do similar as today:
or it could decide to adjust the inheriting slightly, for example:
the snippet above will take all include directories from the The above proposal is a very simplistic description, but if anyone wants to pick up such work, then I will be happy to provide bit more information as well as reviewing any implementation proposals. |
Beta Was this translation helpful? Give feedback.
-
Your proposed build override with CMake seems fine to me and is probably easier to deal with than a flag anyway. What confuses me is that I don’t see how it addresses any of your concerns about -isystem changing the search order. That detail either matters or it doesn’t.
Of course, I don’t think that’s a problem to begin with. Compiling with/without -isystem solution is exactly the way that libc/libc++ projects are built and used (putting aside every other library that uses this strategy). -isystem exists for the use case motivating this issue. If there’s a behavior change cause by search order shift and you didn’t intend that, there is an underlying build flaw and you’ve got naming collisions or accidental pickups that need to be addressed for correctness.
In any case, I’m not a Zephyr user, so good luck to the proposal writer :)
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
How can we apply stricter compiler warnings only on the CMake target
app
?Unfortunately, they will also be applied to all Zephyr interface headers which get included by the app (gcc uses
-I
and not-isystem
option).For example, this simple change to the hello world sample will trigger build errors:
Which results in:
And many more errors.
Is there a preferred way to set app specific flags and ignore zephyr headers?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions