cc-wrapper: heed NIX_CC_WRAPPER_SUPPRESS_TARGET_WARNING

in rare cases emitting such a warning can cause build scripts or
test harnesses to get confused, so provide a universal way to
shut this up even if your target doesn't precisely match the
system's
This commit is contained in:
Robert Scott 2025-04-05 16:47:41 +01:00
parent d0c5c1cb15
commit 2a23ed26a9

View file

@ -26,7 +26,7 @@ while (("$n" < "$nParams")); do
esac
done
if $targetPassed && [[ "$targetValue" != "@defaultTarget@" ]]; then
if $targetPassed && [[ "$targetValue" != "@defaultTarget@" ]] && (( "${NIX_CC_WRAPPER_SUPPRESS_TARGET_WARNING:-0}" < 1 )); then
echo "Warning: supplying the --target $targetValue != @defaultTarget@ argument to a nix-wrapped compiler may not work correctly - cc-wrapper is currently not designed with multi-target compilers in mind. You may want to use an un-wrapped compiler instead." >&2
elif [[ $0 != *cpp ]]; then
extraBefore+=(-target @defaultTarget@ @machineFlags@)