cc-rs
cc-rs copied to clipboard
Ordering between `flag` and `flag_if_supported` is not maintained
C and C++ compilers consider the ordering of arguments important and semantic. However, if you construct a builder like this:
cc::Build::new().flag_if_supported("-xc").flag("-xc++").flag("-std=c++11")
the constructed command line will look like this:
$CC -xc++ -std=c++11 -xc ...
which will then error (or warn...), even though the otherwise nonsensical, but valid invocation would be
$CC -xc -xc++ -std=c++11
Some valid use-cases of this ordering generally involve overriding previous arguments.