Fix bugs and nits pointed out by shellcheck.

scripts/mgnuc.in:
    Delete the unused variables AS, AS_OPTS, HLD_OPTS and ARG_OPTS.
    The first two are hstorical relics, HLD_OPTS lost its raison d'etre
    when we deleted the hl grades; I don't know what we used ARG_OPTS for.

    Make the unused variable CFLAGS_FOR_ANSI used.

    Fix a spelling inconsistency: DEBUG_OPT vs DEBUG_OPTS.

scripts/ml.in:
    Delete the unused variables NONSHARED_LIB_DIR and DL_LIBRARY.

scripts/parse_grade_options.sh-subr:
    Fix typos that prevented an almost-never-used option from working.

scripts/parse_ml_options.sh-subr.in:
    Fix a quoting error.

tools/bootcheck:
    Comment out the definition of an unused variable. (Its parallel
    exists and is used in c2init.in, which is why it is not deleted.)

    Fix typos in spelling SSDB_LIB_NAME.

    Quote a variable value that may contain spaces.

    Replace "cat file | cmd" with "cmd < file".
This commit is contained in:
Zoltan Somogyi
2020-05-29 21:18:08 +10:00
parent 2d2272a9ee
commit 79d81d09d8
5 changed files with 23 additions and 35 deletions

View File

@@ -18,7 +18,6 @@
# *************************************************************************
FULLARCH=@FULLARCH@
NONSHARED_LIB_DIR=${MERCURY_NONSHARED_LIB_DIR=@NONSHARED_LIB_DIR@}
DEFAULT_GRADE=${MERCURY_DEFAULT_GRADE=@DEFAULT_GRADE@}
CC=${MERCURY_C_COMPILER="@CC@"}
@@ -30,14 +29,13 @@ CFLAGS_FOR_LTO="@CFLAGS_FOR_LTO@"
CFLAGS_FOR_NO_STRICT_ALIASING="@CFLAGS_FOR_NO_STRICT_ALIASING@"
CFLAGS_FOR_ANSI="@CFLAGS_FOR_ANSI@"
CFLAGS_FOR_SANITIZERS="@CFLAGS_FOR_SANITIZERS@"
AS="@AS@"
BYTES_PER_WORD="@BYTES_PER_WORD@"
MKTEMP=@MKTEMP@
TMPDIR=${TMPDIR=/tmp}
case "${C_COMPILER_TYPE}" in
gcc*)
ANSI_OPTS="@CFLAGS_FOR_ANSI@"
ANSI_OPTS="${CFLAGS_FOR_ANSI}"
CHECK_OPTS="
-Wall -Wwrite-strings
-Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wno-unused"
@@ -71,7 +69,7 @@ case "${C_COMPILER_TYPE}" in
OPT_OPTS="-O2 ${CFLAGS_FOR_NO_STRICT_ALIASING} -fomit-frame-pointer"
;;
esac
DEBUG_OPT="-g"
DEBUG_OPTS="-g"
DISABLE_OPTS_OPT="-O0"
COMPILER_HALT_AT_WARN_OPT="-Werror"
COMPILER=gcc
@@ -80,7 +78,7 @@ case "${C_COMPILER_TYPE}" in
ANSI_OPTS=
CHECK_OPTS="-w"
OPT_OPTS="@OPT_FLAGS_FOR_CLANG@ ${CFLAGS_FOR_NO_STRICT_ALIASING} -fomit-frame-pointer"
DEBUG_OPT="-g"
DEBUG_OPTS="-g"
DISABLE_OPTS_OPT="-O0"
COMPILER_HALT_AT_WARN_OPT="-Werror"
COMPILER=clang
@@ -100,14 +98,13 @@ case "${C_COMPILER_TYPE}" in
ANSI_OPTS=
CHECK_OPTS=
OPT_OPTS="-O"
DEBUG_OPT="-g"
DEBUG_OPTS="-g"
DISABLE_OPTS_OPT="-O0"
COMPILER_HALT_AT_WARN_OPT=""
COMPILER=unknown
;;
esac
AS_OPTS=""
SPLIT_OPTS=""
INLINE_ALLOC_OPTS=""
@@ -255,7 +252,7 @@ ALL_LOCAL_C_INCL_DIRS=${MERCURY_ALL_LOCAL_C_INCL_DIRS=@ALL_LOCAL_C_INCL_DIRS@}
# compiler/compile_target_code.m.
case ${c_debug} in
true) C_DEBUG_OPTS="${DEBUG_OPT}" ;;
true) C_DEBUG_OPTS="${DEBUG_OPTS}" ;;
false) C_DEBUG_OPTS="" ;;
esac
@@ -469,7 +466,7 @@ case ${ss_debug} in
esac
case ${ll_debug} in
true) LL_DEBUG_OPTS="-DMR_LL_DEBUG ${DEBUG_OPT} ${DISABLE_OPTS_OPT}" ;;
true) LL_DEBUG_OPTS="-DMR_LL_DEBUG ${DEBUG_OPTS} ${DISABLE_OPTS_OPT}" ;;
false) LL_DEBUG_OPTS="" ;;
esac
@@ -701,7 +698,6 @@ ALL_CC_OPTS="${MERC_ALL_C_INCL_DIRS}\
${OPT_OPTS}\
${LTO_OPTS}\
${HLC_OPTS}\
${HLD_OPTS}\
${GCC_OPTS}\
${HALT_AT_WARN_OPT}\
${MSVCRT_OPTS}\
@@ -731,7 +727,6 @@ ALL_CC_OPTS="${MERC_ALL_C_INCL_DIRS}\
${THREADSCOPE_OPTS}\
${REGION_OPTS}\
${ARCH_OPTS}\
${ARG_OPTS}\
${FN_ALIGN_OPTS}\
${INVISIBLE_OPTS}"

View File

@@ -33,7 +33,6 @@ DEFAULT_GRADE=${MERCURY_DEFAULT_GRADE=@DEFAULT_GRADE@}
# add /usr/local/lib to the default search path, if needed
ALL_LOCAL_C_LIB_DIRS=${MERCURY_ALL_LOCAL_C_LIB_DIRS=@ALL_LOCAL_C_LIB_DIRS@}
NONSHARED_LIB_DIR=${MERCURY_NONSHARED_LIB_DIR=@NONSHARED_LIB_DIR@}
DEMANGLER=${MERCURY_DEMANGLER=mdemangle}
CC=${MERCURY_C_COMPILER="@CC@"}
C_COMPILER_TYPE=${MERCURY_C_COMPILER_TYPE="@C_COMPILER_TYPE@"}
@@ -74,11 +73,6 @@ SHARED_LIBS=${MERCURY_SHARED_LIBS="@SHARED_LIBS_SH@"}
LINK=${LINK=/stack:10485760} # 10 Mb
export LINK
# On some systems we need -ldl (libdl.so) for dlopen() etc.
# The name of the needed library is determined by autoconf and passed through
# this variable.
DL_LIBRARY="@DL_LIBRARY@"
# Likewise for -lreadline -l{termcap,curses,ncurses}
READLINE_LIBRARIES="@READLINE_LIBRARIES@"

View File

@@ -226,10 +226,10 @@
;;
--low-level-debug)
ll_debug= true
ll_debug=true
;;
--no-low-level-debug)
ll_debug= false
ll_debug=false
;;
--extend-stacks-when-needed)

View File

@@ -187,7 +187,7 @@ Initialization options:
Mercury runtime. Flags can also be passed at runtime
in the MERCURY_OPTIONS environment variable.
For the list of available flags, see the documentation
for MERCURY_OPTIONS in the "Environment" chapter
for MERCURY_OPTIONS in the \"Environment\" chapter
of the Mercury User's Guide.
--experimental-complexity <filename>
Set up for the experimental determination of the complexity

View File

@@ -207,7 +207,6 @@ keep_stage_3=false
stop_after_stage_2=false
windows=false
use_cp=false
A=a # the extension for libraries
if test -d compiler/Mercury; then
use_subdirs=${MMAKE_USE_SUBDIRS=yes}
else
@@ -252,7 +251,7 @@ fi
# If you change these, you will also need to change the files indicated
# in scripts/c2init.in.
RT_LIB_NAME=mer_rt
# RT_LIB_NAME=mer_rt # not used in this script
STD_LIB_NAME=mer_std
TRACE_LIB_NAME=mer_trace
BROWSER_LIB_NAME=mer_browser
@@ -397,7 +396,7 @@ while test $# -gt 0; do
coverage_test=true ;;
-W|--windows)
windows=true; use_cp=true; A=lib ;;
windows=true; use_cp=true ;;
--use-cp)
use_cp=true ;;
@@ -557,9 +556,9 @@ fi
# in user interaction every time we invoke any version of the compiler
# that was compiled with tracing. This has happened to me accidentally
# one too many times - zs.
if echo $MERCURY_OPTIONS | grep '\-Di' > /dev/null
if echo "${MERCURY_OPTIONS}" | grep '\-Di' > /dev/null
then
MERCURY_OPTIONS=`echo $MERCURY_OPTIONS | sed -e 's/-Di//'`
MERCURY_OPTIONS=`echo "${MERCURY_OPTIONS}" | sed -e 's/-Di//'`
export MERCURY_OPTIONS
fi
@@ -1102,8 +1101,8 @@ then
then
/bin/rm $stage2dir/browser/lib$BROWSER_LIB_NAME.a
ar cr $stage2dir/browser/lib$BROWSER_LIB_NAME.a
/bin/rm $stage2dir/ssdb/lib$ssdb_LIB_NAME.a
ar cr $stage2dir/ssdb/lib$ssdb_LIB_NAME.a
/bin/rm $stage2dir/ssdb/lib$SSDB_LIB_NAME.a
ar cr $stage2dir/ssdb/lib$SSDB_LIB_NAME.a
/bin/rm $stage2dir/trace/lib$TRACE_LIB_NAME.a
ar cr $stage2dir/trace/lib$TRACE_LIB_NAME.a
fi
@@ -2023,8 +2022,8 @@ then
esac
cd $root/${tests_prefix}tests
> FAILED_TESTS_SUMMARY
> NOMAKE_DIRS
true > FAILED_TESTS_SUMMARY
true > NOMAKE_DIRS
/bin/rm -fr PASSED_TC_DIR FAILED_TC_DIR > /dev/null 2>&1
mkdir -p PASSED_TC_DIR FAILED_TC_DIR
@@ -2254,38 +2253,38 @@ fi
if test -s $tests_dir/FAILED_TESTS_SUMMARY
then
num_expected_failures=`cat $tests_dir/EXPECTED_FAILED_TESTS | wc -l`
num_expected_failures=`wc -l $tests_dir/EXPECTED_FAILED_TESTS`
case "${num_expected_failures}" in
0)
;;
1)
echo "one expected test case failure:"
echo
cat $tests_dir/EXPECTED_FAILED_TESTS | sed -e 's/^/ /'
sed -e 's/^/ /' < $tests_dir/EXPECTED_FAILED_TESTS
echo
;;
*)
echo "${num_expected_failures} expected test case failures:"
echo
cat $tests_dir/EXPECTED_FAILED_TESTS | sed -e 's/^/ /'
sed -e 's/^/ /' < $tests_dir/EXPECTED_FAILED_TESTS
echo
;;
esac
num_unexpected_failures=`cat $tests_dir/UNEXPECTED_FAILED_TESTS | wc -l`
num_unexpected_failures=`wc -l < $tests_dir/UNEXPECTED_FAILED_TESTS`
case "${num_unexpected_failures}" in
0)
;;
1)
echo "one unexpected test case failure:"
echo
cat $tests_dir/UNEXPECTED_FAILED_TESTS | sed -e 's/^/ /'
sed -e 's/^/ /' < $tests_dir/UNEXPECTED_FAILED_TESTS
echo
;;
*)
echo "${num_unexpected_failures} unexpected test case failures:"
echo
cat $tests_dir/UNEXPECTED_FAILED_TESTS | sed -e 's/^/ /'
sed -e 's/^/ /' < $tests_dir/UNEXPECTED_FAILED_TESTS
echo
;;
esac