Skip to content

Conversation

@Vollbrecht
Copy link
Collaborator

addresses #267

@ivmarkov
Copy link
Collaborator

Other than for "educational" purposes, this is not really necessary, so I wonder if we should include it at all.

@ivmarkov
Copy link
Collaborator

If you nevertheless feel it might be useful, you need to add this:

#![allow(unknown_lints)]
#![allow(unexpected_cfgs)]

... at the top of main.rs so as to silence Clippy.

@Vollbrecht
Copy link
Collaborator Author

Vollbrecht commented Jun 13, 2025

yeah, i was a bit fed up with the unknown_cfgs, that's why i currently try to cook some more mid/long term solution into esp-idf-sys :D. I think a "dumb" solution would be to build all targets and all examples with every feature flag "out of band", capture that output specifically, and add the generated features into the build.rs script.

That way we should capture at least every use of cfg that we ourself use witch is 99% of the problem with the lint

@ivmarkov
Copy link
Collaborator

yeah, i was a bit fed up with the unknown_cfgs, that's why i currently try to cook some more mid/long term solution into esp-idf-sys :D. I think a "dumb" solution would be to build all targets and all examples with every feature flag "out of band", capture that output specifically, and add the generated features into the build.rs script.

Hm, I wonder what kconfig contains here

  • Just the configs explicitly set in sdkconfig.defaults
  • Or all supported configs

?

If the latter, we can just - literally - iterate over all of those configs and just println!("cargo::rustc-check-cfg=cfg(esp_idf_<config_name_xyz>)");

@Vollbrecht
Copy link
Collaborator Author

Vollbrecht commented Jun 13, 2025

I have something working though it's not simply done with one run. The problem is that we need define all configs that are used, a single run would not produce it. For example a bare esp32c3 build currently give me around 500 build cfgs, but when i combine c2,c3 and h2 runs i get round 1000 "unique" cfg flags. And the problem with unexpected_cfg is that we need "every cfg" we are potential using otherwise we cannot eliminate it.

Thats why i created a small script that can be run "out of band" that creates all possible cfs, directly from within the build.rs of esp-idf-sys. Than that output file will be part of the build.rs in esp-idf-sys and define every cfg.

I create a PR shortly on esp-idf-sys with the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants