diff --git a/wrappers/clang-target-wrapper.c b/wrappers/clang-target-wrapper.c index f0fca61..976d642 100644 --- a/wrappers/clang-target-wrapper.c +++ b/wrappers/clang-target-wrapper.c @@ -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 -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; diff --git a/wrappers/clang-target-wrapper.sh b/wrappers/clang-target-wrapper.sh index 296da77..50badb2 100755 --- a/wrappers/clang-target-wrapper.sh +++ b/wrappers/clang-target-wrapper.sh @@ -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 -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