Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
14 changes: 14 additions & 0 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: shellcheck

on:
push:
branches: [master]
pull_request:

jobs:
shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Run shellcheck
run: shellcheck cc.sh
39 changes: 25 additions & 14 deletions cc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ execute() {
output_log="$SPACK_DEBUG_LOG_DIR/spack-cc-$SPACK_DEBUG_LOG_ID.out.log"
echo "[$mode] $command $input_command" >> "$input_log"
IFS="$lsep"
# shellcheck disable=SC2086
echo "[$mode] "$full_command_list >> "$output_log"
unset IFS
fi
Expand Down Expand Up @@ -365,20 +366,17 @@ if [ -z "$mode" ] || [ "$mode" = ld ]; then
done
fi

# Finish setting up the mode.
# Finish setting up the mode, and check whether -frandom-seed needs to be set.
eval "_set_frandom_seed=\${SPACK_${comp}_HAS_FRANDOM_SEED:-}"
if [ -z "$mode" ]; then
mode=ccld
for arg in "$@"; do
if [ "$arg" = "-E" ]; then
mode=cpp
break
elif [ "$arg" = "-S" ]; then
mode=as
break
elif [ "$arg" = "-c" ]; then
mode=cc
break
fi
case $arg in
-E) mode=cpp ;;
-S) mode=as ;;
-c) mode=cc ;;
-frandom-seed=*) _set_frandom_seed= ;;
esac
done
fi

Expand Down Expand Up @@ -437,9 +435,10 @@ export PATH="$new_dirs"

if [ "$mode" = vcheck ]; then
full_command_list="$command"
args="$@"
extend full_command_list vcheck_flags
extend full_command_list args
for arg in "$@"; do
append full_command_list "$arg"
done
execute
fi

Expand Down Expand Up @@ -580,6 +579,7 @@ categorize_arguments() {
eval "\
stripped=\"\${1##$before}\"
"
# shellcheck disable=SC2154 # shellcheck doesn't see eval
if [ "$stripped" = "$1" ] ; then
continue
fi
Expand Down Expand Up @@ -633,6 +633,7 @@ categorize_arguments() {
;;
-Wl,*)
IFS=,
# shellcheck disable=SC2086 # intentional splitting
if ! parse_Wl ${1#-Wl,}; then
append return_other_args_list "$1"
fi
Expand Down Expand Up @@ -803,7 +804,8 @@ case "$mode" in
esac

IFS="$lsep"
categorize_arguments $spack_flags_list
# shellcheck disable=SC2086 # intentional splitting
categorize_arguments $spack_flags_list
unset IFS

assign_path_lists spack_flags_isystem_include_dirs_list return_isystem_include_dirs_list
Expand Down Expand Up @@ -951,6 +953,15 @@ extend args_list libs_list "-l"
full_command_list="$command"
extend full_command_list args_list

if [ -n "$_set_frandom_seed" ]; then
case "$mode" in
cc|ccld)
# Make GCC deterministic by setting the random seed to command line arguments
append full_command_list "-frandom-seed=$input_command"
;;
esac
fi

# prepend the ccache binary if we're using ccache
if [ -n "$SPACK_CCACHE_BINARY" ]; then
case "$lang_flags" in
Expand Down
Loading