Error out early if trying to compile ada

If we try to do that, clang would end up calling <triplet>-gcc with the
same arguments. In our setup, this recursively ends up calling clang again,
ending up with infinite recursion.
This commit is contained in:
Martin Storsjö committed 2018-10-10 23:33:19 +03:00
1 parent 7bca89b53f
commit 8bfc9a18c6
2 files changed
+22

No files matched your search

+10
View File
@@ -142,6 +142,16 @@ int _tmain(int argc, TCHAR* argv[]) {
if (dash)
*dash = '\0';
// Check if trying to compile Ada; if we try to do this, invoking clang
// would end up invoking <triplet>-gcc with the same arguments, which ends
// up in an infinite recursion.
for (int i = 1; i < argc - 1; i++) {
if (!_tcscmp(argv[i], _T("-x")) && !_tcscmp(argv[i + 1], _T("ada"))) {
fprintf(stderr, "Ada is not supported\n");
return 1;
}
}
int max_arg = argc + 20;
const TCHAR **exec_argv = malloc(max_arg * sizeof(*exec_argv));
int arg = 0;
+12
View File
@@ -9,6 +9,18 @@ if [ "$TARGET" = "$BASENAME" ]; then
fi
ARCH="${TARGET%%-*}"
# Check if trying to compile Ada; if we try to do this, invoking clang
# would end up invoking <triplet>-gcc with the same arguments, which ends
# up in an infinite recursion.
case "$*" in
*-x\ ada*)
echo "Ada is not supported" >&2
exit 1
;;
*)
;;
esac
# Allow setting e.g. CCACHE=1 to wrap all building in ccache.
if [ -n "$CCACHE" ]; then
CCACHE=ccache