Skip to content
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

Unexpected cfg condition name: mac_ & ios_framework #1436

Open
e5f6bd opened this issue Sep 27, 2024 · 1 comment
Open

Unexpected cfg condition name: mac_ & ios_framework #1436

e5f6bd opened this issue Sep 27, 2024 · 1 comment

Comments

@e5f6bd
Copy link

e5f6bd commented Sep 27, 2024

When I compile sdl2-sys crate with the latest stable Rust, I get this kind of error message:

warning: unexpected `cfg` condition name: `ios_framework`
   --> sdl2-sys\build.rs:340:46
    |
340 |                 let use_framework = cfg!(any(ios_framework, feature = "use_ios_framework"));
    |                                              ^^^^^^^^^^^^^
    |
    = help: consider using a Cargo feature instead
    = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
             [lints.rust]
             unexpected_cfgs = { level = "warn", check-cfg = ['cfg(ios_framework)'] }
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
Entire warnings
warning: unexpected `cfg` condition name: `mac_framework`
   --> sdl2-sys\build.rs:333:46
    |
333 |                 let use_framework = cfg!(any(mac_framework, feature = "use_mac_framework"));
    |                                              ^^^^^^^^^^^^^
    |
    = help: expected names are: `clippy`, `debug_assertions`, `doc`, `docsrs`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows`
    = help: consider using a Cargo feature instead
    = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
             [lints.rust]
             unexpected_cfgs = { level = "warn", check-cfg = ['cfg(mac_framework)'] }
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
    = note: `#[warn(unexpected_cfgs)]` on by default

warning: unexpected `cfg` condition name: `ios_framework`
   --> sdl2-sys\build.rs:340:46
    |
340 |                 let use_framework = cfg!(any(ios_framework, feature = "use_ios_framework"));
    |                                              ^^^^^^^^^^^^^
    |
    = help: consider using a Cargo feature instead
    = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
             [lints.rust]
             unexpected_cfgs = { level = "warn", check-cfg = ['cfg(ios_framework)'] }
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition name: `mac_framework`
   --> sdl2-sys\build.rs:357:46
    |
357 |                 let use_framework = cfg!(any(mac_framework, feature = "use_mac_framework"));
    |                                              ^^^^^^^^^^^^^
    |
    = help: consider using a Cargo feature instead
    = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
             [lints.rust]
             unexpected_cfgs = { level = "warn", check-cfg = ['cfg(mac_framework)'] }
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition name: `ios_framework`
   --> sdl2-sys\build.rs:364:46
    |
364 |                 let use_framework = cfg!(any(ios_framework, feature = "use_ios_framework"));
    |                                              ^^^^^^^^^^^^^
    |
    = help: consider using a Cargo feature instead
    = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
             [lints.rust]
             unexpected_cfgs = { level = "warn", check-cfg = ['cfg(ios_framework)'] }
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition name: `mac_framework`
   --> sdl2-sys\build.rs:381:46
    |
381 |                 let use_framework = cfg!(any(mac_framework, feature = "use_mac_framework"));
    |                                              ^^^^^^^^^^^^^
    |
    = help: consider using a Cargo feature instead
    = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
             [lints.rust]
             unexpected_cfgs = { level = "warn", check-cfg = ['cfg(mac_framework)'] }
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition name: `ios_framework`
   --> sdl2-sys\build.rs:388:46
    |
388 |                 let use_framework = cfg!(any(ios_framework, feature = "use_ios_framework"));
    |                                              ^^^^^^^^^^^^^
    |
    = help: consider using a Cargo feature instead
    = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
             [lints.rust]
             unexpected_cfgs = { level = "warn", check-cfg = ['cfg(ios_framework)'] }
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition name: `mac_framework`
   --> sdl2-sys\build.rs:405:46
    |
405 |                 let use_framework = cfg!(any(mac_framework, feature = "use_mac_framework"));
    |                                              ^^^^^^^^^^^^^
    |
    = help: consider using a Cargo feature instead
    = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
             [lints.rust]
             unexpected_cfgs = { level = "warn", check-cfg = ['cfg(mac_framework)'] }
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition name: `ios_framework`
   --> sdl2-sys\build.rs:412:46
    |
412 |                 let use_framework = cfg!(any(ios_framework, feature = "use_ios_framework"));
    |                                              ^^^^^^^^^^^^^
    |
    = help: consider using a Cargo feature instead
    = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
             [lints.rust]
             unexpected_cfgs = { level = "warn", check-cfg = ['cfg(ios_framework)'] }
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: `sdl2-sys` (build script) generated 8 warnings

Is there any reason of using a custom cfg attributes, ios_framework and mac_framework? Or is it just a reminicent of good old code that is never used right now? It seems these attributes started to be used at least before 2017 ... (as in b3ee9b2)

@e5f6bd
Copy link
Author

e5f6bd commented Sep 28, 2024

Well, I found my browser has a tab showing #588, so it seems I found this issue but forget to further investigate. So I think this attribute is checked intentionally to support --cfg mac_framework. Then I think we should specify lints.rust.unexpected_cfgs.check-cfg as suggested.

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

No branches or pull requests

1 participant