Skip to content

Commit 0bf9059

Browse files
committed
Do not hardcode GCC/g++ in shell scripts
BSD systems won't alias gcc to clang.
1 parent a0178a7 commit 0bf9059

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

.github/workflows/pull-request-checks.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
- name: Print ccache stats
6060
run: ccache -s
6161
- name: Checking completeness of help output
62-
run: scripts/check_help.sh
62+
run: scripts/check_help.sh g++
6363
- name: Run unit tests
6464
run: |
6565
make -C unit test IPASIR=$PWD/riss.git/riss
@@ -247,7 +247,7 @@ jobs:
247247
- name: Print ccache stats
248248
run: ccache -s
249249
- name: Checking completeness of help output
250-
run: scripts/check_help.sh build/bin
250+
run: scripts/check_help.sh /usr/bin/g++ build/bin
251251
- name: Check if package building works
252252
run: |
253253
cd build

scripts/bash-autocomplete/extract_switches.sh

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@
22

33
set -e
44

5+
CXX=$1
6+
shift
7+
58
# make sure we execute the remainder in the directory containing this script
69
cd `dirname $0`
710

811
echo "Compiling the helper file to extract the raw list of parameters from cbmc"
9-
g++ -E -dM -std=c++17 -I../../src ../../src/cbmc/cbmc_parse_options.cpp -o macros.c
12+
$CXX -E -dM -std=c++17 -I../../src ../../src/cbmc/cbmc_parse_options.cpp -o macros.c
1013
echo CBMC_OPTIONS >> macros.c
1114

1215
echo "Converting the raw parameter list to the format required by autocomplete scripts"
13-
rawstring="`gcc -E -P -w macros.c` \"?h(help)\""
16+
rawstring="`$CXX -E -P -w macros.c` \"?h(help)\""
1417
rm macros.c
1518

1619
#now the main bit, convert from raw format to a proper list of switches

scripts/check_help.sh

+7-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
set -e
44

5+
CXX=$1
6+
shift
7+
58
# if a command-line argument is provided, use it as a path to built binaries
69
# (CMake-style build); otherwise assume we use Makefile-based in-tree build
710
if [ $# -eq 1 ] ; then
@@ -33,10 +36,10 @@ for t in \
3336
tool_name=$(basename $t)
3437
opt_name=$(echo $tool_name | tr 'a-z-' 'A-Z_')
3538
echo "Extracting the raw list of parameters from $tool_name"
36-
g++ -E -dM -std=c++17 -I../src -I../jbmc/src $t/*_parse_options.cpp -o macros.c
39+
$CXX -E -dM -std=c++17 -I../src -I../jbmc/src $t/*_parse_options.cpp -o macros.c
3740
# goto-analyzer partly uses the spelling "analyser" within the code base
3841
echo ${opt_name}_OPTIONS | sed 's/GOTO_ANALYZER/GOTO_ANALYSER/' >> macros.c
39-
rawstring="`gcc -E -P -w macros.c` \"?h(help)\""
42+
rawstring="`$CXX -E -P -w macros.c` \"?h(help)\""
4043
rm macros.c
4144

4245
# now the main bit, convert from raw format to a proper list of switches
@@ -58,8 +61,8 @@ for t in \
5861
fi
5962

6063
if [ ! -x $tool_bin ] ; then
61-
echo "$tool_bin is not an executable"
62-
exit 1
64+
echo "$tool_bin is not an executable, cannot check help completeness"
65+
continue
6366
fi
6467
$tool_bin --help > help_string
6568
grep '^\\fB\\-' ../doc/man/$tool_name.1 > man_page_opts

src/cbmc/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ endif()
5959
# bash completion
6060
if(NOT WIN32)
6161
add_custom_command(OUTPUT "${CBMC_ROOT_DIR}/scripts/bash-autocomplete/cbmc.sh"
62-
COMMAND "${CBMC_ROOT_DIR}/scripts/bash-autocomplete/extract_switches.sh"
62+
COMMAND "${CBMC_ROOT_DIR}/scripts/bash-autocomplete/extract_switches.sh" "${CMAKE_CXX_COMPILER}"
6363
DEPENDS $<TARGET_FILE:cbmc>
6464
)
6565
add_custom_target(cbmc.sh ALL

0 commit comments

Comments
 (0)