aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@arm.com>2022-10-27 08:50:53 +0000
committerChristophe Lyon <christophe.lyon@arm.com>2022-11-21 10:20:59 +0100
commitf0d3b6e384a68f8b58bc750f240a15cad92600cd (patch)
treece01134ab3ce0fbb894e2e49c275b10027c927d1 /gcc
parent3d3b561fc3aaceb682ade756c3bb1ebb3f495231 (diff)
downloadgcc-f0d3b6e384a68f8b58bc750f240a15cad92600cd.zip
gcc-f0d3b6e384a68f8b58bc750f240a15cad92600cd.tar.gz
gcc-f0d3b6e384a68f8b58bc750f240a15cad92600cd.tar.bz2
genmultilib: Add sanity check
When a list of dirnames is provided to genmultilib, its length is expected to match the number of options. If this is not the case, the build fails later for reasons not obviously related to this mistake. This patch adds a sanity check to help diagnose such cases. Tested by adding an option to t-aarch64 and no corresponding dirname, with both bash and dash. v2: do not use arrays (bash feature). OK for trunk? gcc/ChangeLog: * genmultilib: Add sanity check.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/genmultilib14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/genmultilib b/gcc/genmultilib
index 1e387fb..b5f372c 100644
--- a/gcc/genmultilib
+++ b/gcc/genmultilib
@@ -141,6 +141,20 @@ multiarch=$9
multilib_reuse=${10}
enable_multilib=${11}
+# Sanity check: make sure we have as many dirnames as options
+if [ -n "${dirnames}" ]; then
+ set x $options
+ nboptions=$#
+ set x $dirnames
+ nbdirnames=$#
+ if [ $nbdirnames -ne $nboptions ]; then
+ echo 1>&2 "Error calling $0: Number of dirnames ($nbdirnames) does not match number of options ($nboptions)"
+ echo 1>&2 "options: ${options}"
+ echo 1>&2 "dirnames: ${dirnames}"
+ exit 1
+ fi
+fi
+
echo "static const char *const multilib_raw[] = {"
mkdir tmpmultilib.$$ || exit 1