-
Notifications
You must be signed in to change notification settings - Fork 30
feat(cargo): Set rustc-check-cfg for all config options #92
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
base: main
Are you sure you want to change the base?
Conversation
@d3zd3z thanks for your work so far on this. May I request a review on this, please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, this only squashes some warnings from this lint, specifically settings that are possible in the current configuration, but are disabled. But configurations that don't apply will not be seen by this and will still generate warnings.
Aside from generating a list of all possible configs from all Kconfig files (including modules that aren't present), I don't really see a way to make this work, which is why my examples have just been suppressing the lint.
This is true. |
I wonder if we could do something with I'll try to find some time to have a look into this. |
227220c
to
8ba2555
Compare
@d3zd3z how do you feel about this as an approach? This seems to work for my project - I'd be interested to know how CI fares. I'm not entirely happy about having an intermediate JSON file, but struggling to think of other options that would produce the complete list we need. |
b32097a
to
d1957c9
Compare
def main(): | ||
args = parse_args() | ||
|
||
kconf = Kconfig(args.kconfig_file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar with this code from Zephyr. Will this visit all kconfig files, or just the ones that make sense for the current build. Specifically, I think we should try this with a test case of conditional code that references a config that isn't present in the builds we make, but is in the tree. Ideally, we would make sure this works for modules as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this visit all kconfig files, or just the ones that make sense for the current build
My understanding is that this will pick up the applications "root" Kconfig file (i.e. the one in <appdir>/Kconfig
, where it is defined), and follow any source
/rsource
commands from there.
So it's not loading everything that smells like a Kconfig file within the directory tree, but it will load all kconfig files that are rsource
ed (the same as with Zephyr's normal build).
a test case of conditional code that references a config that isn't present in the builds we make, but is in the tree
I'm not sure I follow.
If it's loaded as part of the Kconfig tree, it is present? If it isn't part of the Kconfig tree, then it's not a valid option (and should be flagged as not available).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and the CMake changes were based around https://github.com/zephyrproject-rtos/zephyr/blob/main/cmake/modules/kconfig.cmake
This squashes lint warnings for config options which are not currently enabled. See https://doc.rust-lang.org/cargo/reference/build-scripts.html\#rustc-check-cfg Signed-off-by: Hayden Ball <[email protected]>
This squashes lint warnings for config options which are not currently enabled.
See https://doc.rust-lang.org/cargo/reference/build-scripts.html\#rustc-check-cfg