Skip to content

ctest: probe optional compiler flags#5146

Open
chitao1234 wants to merge 1 commit into
rust-lang:mainfrom
chitao1234:ctest-probe-optional-compiler-flags
Open

ctest: probe optional compiler flags#5146
chitao1234 wants to merge 1 commit into
rust-lang:mainfrom
chitao1234:ctest-probe-optional-compiler-flags

Conversation

@chitao1234

Copy link
Copy Markdown

Description

Add TestGenerator::flag_if_supported so ctest callers can request C compiler flags that should only be passed when the selected compiler supports them.

This also changes ctest’s built-in warning suppressions for -Wno-address-of-packed-member and -Wno-unknown-warning-option to use cc::Build::flag_if_supported. Some older toolchains (e.g. the default one on dragonfly) reject them when -Werror is enabled.

The generated test compiler setup now sets the target before probing flags, so support checks use the same target configuration as the actual compile.

Sources

Not applicable.

Checklist

  • Relevant tests in libc-test/semver have been updated
  • No placeholder or unstable values like *LAST or *MAX are
    included (see #3131)
  • Tested locally (cd libc-test && cargo test --target mytarget);
    especially relevant for platforms that may not be checked in CI

@rustbot rustbot added ctest Issues relating to the ctest crate S-waiting-on-review labels Jun 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ctest Issues relating to the ctest crate S-waiting-on-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants