Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
25856ec
init changes from spack-packages/4411
scheibelp Jun 11, 2026
080bdfb
dispatch hipcc to SPACK_HIPCXX
scheibelp Jun 11, 2026
2b8ef4e
names that cmake won't reject
scheibelp Jun 12, 2026
d6cc6b2
amdhip identifier not used; language was swapped with vdep
scheibelp Jul 9, 2026
ed41d0c
handle hipflags (requires update in spack core to be useful, but does…
scheibelp Aug 3, 2026
a686054
fix vdep
scheibelp Aug 17, 2026
6f5e2e4
-x doesnt mean language for ld
scheibelp Aug 17, 2026
da7be1a
test processing of -x and SPACK_HIPCXX dispatch based on -x and argv0…
scheibelp Aug 18, 2026
ce78199
expand SPACK_xFLAGS test for hipflags
scheibelp Aug 18, 2026
ba2491d
fold mode determination from flags for spackhip into existing test_modes
scheibelp Aug 18, 2026
2c165b1
test routing of -x/spackhip to SPACK_HIPCXX
scheibelp Aug 18, 2026
a0f82a8
update no-dash-x processing for ld test
scheibelp Aug 18, 2026
efb910d
rm redundant check
scheibelp Aug 18, 2026
dfd1d74
another redundant test
scheibelp Aug 18, 2026
44e2dec
bad test reference
scheibelp Aug 18, 2026
d8eafe4
style
scheibelp Aug 18, 2026
af20c05
apply suggested commit from review (fix bug where -x messed with cpp;…
scheibelp Sep 1, 2026
9746dac
Add recommended tests verbatim to start
scheibelp Sep 1, 2026
163437c
test_x_ignored_for_ld is covered by test_x_is_not_a_language_for_ld,
scheibelp Sep 1, 2026
df7cf47
rm -x case in test_hip_command_routing covered by test_x_language_spe…
scheibelp Sep 1, 2026
d8af366
add comments about additional cases being covered
scheibelp Sep 1, 2026
da0d5ee
add test comment
scheibelp Sep 1, 2026
ba4e07d
move helper definition
scheibelp Sep 1, 2026
ecd8480
rename test
scheibelp Sep 2, 2026
3e2f803
rm reference to SPACK_ALWAYS_HIPCXXFLAGS
scheibelp Sep 2, 2026
4a18021
fix test reference error; add check for catching bad test references
scheibelp Sep 9, 2026
6bf779c
refactor test to use expect_command (was redoing work handled by that)
scheibelp Sep 9, 2026
42d2524
replace another custom test with expect_command
scheibelp Sep 9, 2026
e7aff18
consolidate individual expect_contains/expect_command checks into sin…
scheibelp Sep 9, 2026
f433c68
more-stringent arg order checking w/ expect_args
scheibelp Sep 9, 2026
1c07624
replace explicit continue w/ comment (appears to match other logic be…
scheibelp Sep 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 86 additions & 39 deletions cc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -298,47 +298,40 @@ mode=""
vdep=""
lang_flags=""
debug_flags=""
command="${0##*/}"
comp="CC"
vcheck_flags=""

command="${0##*/}"

# -x/--language overrides the language implied by argv0. Note that this is
# only applied for compiler drivers: for ld, -x means --discard-all, and for
# cpp, changing the language must not turn preprocessing into compilation.
_command_from_flags() {
_lang=""
while [ $# -ne 0 ]; do
arg="$1"
shift
case "$arg" in
-x|--language)
[ $# -ne 0 ] || break
_lang="$1"
shift ;;
Comment thread
haampie marked this conversation as resolved.
Comment thread
haampie marked this conversation as resolved.
-x*)
_lang="${arg#-x}" ;;
--language=*)
_lang="${arg#--language=}" ;;
# we're only looking for lang args here: ignore everything else
esac
done

case "$_lang" in
c) command=cc ;;
Comment thread
haampie marked this conversation as resolved.
c++|f77|f95|hip) command="$_lang" ;;
# anything else: keep the language implied by argv0
esac
}

case "$command" in
cpp)
mode=cpp
debug_flags="-g"
vcheck_flags="${SPACK_ALWAYS_CPPFLAGS}"
;;
cc|c89|c99|gcc|clang|armclang|icc|icx|pgcc|nvc|xlc|xlc_r|fcc|amdclang|cl.exe|craycc)
command="$SPACK_CC"
vdep=c
comp="CC"
lang_flags=C
debug_flags="-g"
vcheck_flags="${SPACK_ALWAYS_CFLAGS}"
;;
c++|CC|g++|clang++|armclang++|icpc|icpx|pgc++|nvc++|xlc++|xlc++_r|FCC|amdclang++|crayCC)
command="$SPACK_CXX"
vdep=cxx
comp="CXX"
lang_flags=CXX
debug_flags="-g"
vcheck_flags="${SPACK_ALWAYS_CXXFLAGS}"
;;
ftn|f90|fc|f95|gfortran|flang|armflang|ifort|ifx|pgfortran|nvfortran|xlf90|xlf90_r|nagfor|frt|amdflang|crayftn)
command="$SPACK_FC"
vdep=fortran
comp="FC"
lang_flags=F
debug_flags="-g"
vcheck_flags="${SPACK_ALWAYS_FFLAGS}"
;;
f77|xlf|xlf_r|pgf77)
command="$SPACK_F77"
vdep=fortran
comp="F77"
lang_flags=F
debug_flags="-g"
vcheck_flags="${SPACK_ALWAYS_FFLAGS}"
;;
ld|ld.gold|ld.lld)
mode=ld
if [ -z "$SPACK_CC_RPATH_ARG" ]; then
Expand All @@ -351,8 +344,58 @@ case "$command" in
fi
fi
;;
cpp)
mode=cpp
debug_flags="-g"
vcheck_flags="${SPACK_ALWAYS_CPPFLAGS}"
;;
*)
die "Unknown compiler: $command"
_command_from_flags "$@"
case "$command" in
cc|c89|c99|gcc|clang|armclang|icc|icx|pgcc|nvc|xlc|xlc_r|fcc|amdclang|cl.exe|craycc)
command="$SPACK_CC"
vdep=c
comp="CC"
lang_flags=C
debug_flags="-g"
vcheck_flags="${SPACK_ALWAYS_CFLAGS}"
;;
c++|CC|g++|clang++|armclang++|icpc|icpx|pgc++|nvc++|xlc++|xlc++_r|FCC|amdclang++|crayCC)
command="$SPACK_CXX"
vdep=cxx
comp="CXX"
lang_flags=CXX
debug_flags="-g"
vcheck_flags="${SPACK_ALWAYS_CXXFLAGS}"
;;
ftn|f90|fc|f95|gfortran|flang|armflang|ifort|ifx|pgfortran|nvfortran|xlf90|xlf90_r|nagfor|frt|amdflang|crayftn)
command="$SPACK_FC"
vdep=fortran
comp="FC"
lang_flags=F
debug_flags="-g"
vcheck_flags="${SPACK_ALWAYS_FFLAGS}"
;;
f77|xlf|xlf_r|pgf77)
command="$SPACK_F77"
vdep=fortran
comp="F77"
lang_flags=F
debug_flags="-g"
vcheck_flags="${SPACK_ALWAYS_FFLAGS}"
;;
hip|spackhip)
command="$SPACK_HIPCXX"
vdep="hip-lang"
comp="HIPCXX"
lang_flags=HIP
debug_flags="-g"
vcheck_flags="${SPACK_ALWAYS_HIPFLAGS}"
;;
*)
die "Unknown compiler: $command"
;;
esac
;;
esac

Expand Down Expand Up @@ -791,6 +834,10 @@ case "$mode" in
extend spack_flags_list SPACK_CXXFLAGS
preextend flags_list SPACK_TARGET_ARGS_CXX
;;
HIP)
extend spack_flags_list SPACK_ALWAYS_HIPFLAGS
extend spack_flags_list SPACK_HIPFLAGS
;;
F)
preextend flags_list SPACK_TARGET_ARGS_FORTRAN
;;
Expand Down
Loading