Skip to content

Commit

Permalink
cc-wrapper: Move cc-wrapper-hook above NIX_DEBUG
Browse files Browse the repository at this point in the history
I observe that the old position meant that if the wrapper were to
interfere with the arguments going into the compiler, it would not be
reflected in the debug output.

Signed-off-by: Peter Waller <[email protected]>
  • Loading branch information
pwaller committed Dec 20, 2024
1 parent 3fc1a00 commit b5e504c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pkgs/build-support/cc-wrapper/cc-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,12 @@ if [[ "${#positionalArgs[@]}" -gt 0 ]]; then
extraAfter+=(-- "${positionalArgs[@]}")
fi

# if a cc-wrapper-hook exists, run it.
if [[ -e @out@/nix-support/cc-wrapper-hook ]]; then
compiler=@prog@
source @out@/nix-support/cc-wrapper-hook
fi

# Optionally print debug info.
if (( "${NIX_DEBUG:-0}" >= 1 )); then
# Old bash workaround, see ld-wrapper for explanation.
Expand All @@ -246,12 +252,6 @@ fi
PATH="$path_backup"
# Old bash workaround, see above.

# if a cc-wrapper-hook exists, run it.
if [[ -e @out@/nix-support/cc-wrapper-hook ]]; then
compiler=@prog@
source @out@/nix-support/cc-wrapper-hook
fi

if (( "${NIX_CC_USE_RESPONSE_FILE:-@use_response_file_by_default@}" >= 1 )); then
responseFile=$(@mktemp@ "${TMPDIR:-/tmp}/cc-params.XXXXXX")
trap '@rm@ -f -- "$responseFile"' EXIT
Expand Down

0 comments on commit b5e504c

Please sign in to comment.