aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2025-03-27 11:53:03 +0000
committerJunio C Hamano <gitster@pobox.com>2025-03-28 17:38:12 -0700
commitabd4192b07c5a7dbb4b13a532d0643982b42526f (patch)
treed8e7c966e546a76278b7b3da89f5a41f4d996094
parentclang: warn when the comma operator is used (diff)
downloadgit-abd4192b07c5a7dbb4b13a532d0643982b42526f.tar.gz
git-abd4192b07c5a7dbb4b13a532d0643982b42526f.zip
detect-compiler: detect clang even if it found CUDA
In my setup, clang finds `/usr/local/cuda` and hence the output of `clang -v` ends with this line: Found CUDA installation: /usr/local/cuda, version This confuses the `detect-compiler` script because it matches _all_ lines that contain the needle "version" surrounded by spaces. As a consequence, the `get_family` function returns two lines: "Ubuntu clang" and above-mentioned line, which the `case` statement does not handle well and hence reports "unknown compiler family" instead of the expected set of "clang14", "clang13", ..., "clang1" output. Let's unconfuse the script by letting it parse the first matching line and ignore the rest. Helped-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Acked-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xdetect-compiler2
1 files changed, 1 insertions, 1 deletions
diff --git a/detect-compiler b/detect-compiler
index a87650b71b..124ebdd4c9 100755
--- a/detect-compiler
+++ b/detect-compiler
@@ -9,7 +9,7 @@ CC="$*"
#
# FreeBSD clang version 3.4.1 (tags/RELEASE...)
get_version_line() {
- LANG=C LC_ALL=C $CC -v 2>&1 | grep ' version '
+ LANG=C LC_ALL=C $CC -v 2>&1 | sed -n '/ version /{p;q;}'
}
get_family() {