git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Philip Oakley <philipoakley@iee.email>,
	Patrick Steinhardt <ps@pks.im>,
	Phillip Wood <phillip.wood123@gmail.com>,
	Karthik Nayak <karthik.188@gmail.com>, Jeff King <peff@peff.net>,
	Taylor Blau <me@ttaylorr.com>,
	Eric Sunshine <sunshine@sunshineco.com>,
	Chris Torek <chris.torek@gmail.com>,
	Johannes Schindelin <johannes.schindelin@gmx.de>,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: [PATCH v3 10/10] detect-compiler: detect clang even if it found CUDA
Date: Thu, 27 Mar 2025 11:53:03 +0000	[thread overview]
Message-ID: <77f1dcaca1c9df9e24880680311e5bb3eaeec1f8.1743076383.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1889.v3.git.1743076383.gitgitgadget@gmail.com>

From: Johannes Schindelin <johannes.schindelin@gmx.de>

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>
---
 detect-compiler | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/detect-compiler b/detect-compiler
index a87650b71bb..124ebdd4c9d 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() {
-- 
gitgitgadget

  parent reply	other threads:[~2025-03-27 11:53 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-25  8:01 [PATCH 0/2] Avoid the comma operator Johannes Schindelin via GitGitGadget
2025-03-25  8:01 ` [PATCH 1/2] remote-curl: avoid using the comma operator unnecessarily Johannes Schindelin via GitGitGadget
2025-03-25 16:28   ` Phillip Wood
2025-03-25 16:55     ` Jeff King
2025-03-25  8:01 ` [PATCH 2/2] rebase: " Johannes Schindelin via GitGitGadget
2025-03-25 14:35   ` Phillip Wood
2025-03-25 11:41 ` [PATCH 0/2] Avoid the comma operator Philip Oakley
2025-03-25 14:12   ` Johannes Schindelin
2025-03-26 17:29     ` Taylor Blau
2025-03-25 12:22 ` Patrick Steinhardt
2025-03-25 14:13   ` Johannes Schindelin
2025-03-26 20:17     ` Taylor Blau
2025-03-25 14:37   ` Karthik Nayak
2025-03-25 19:34 ` Junio C Hamano
2025-03-25 23:32 ` [PATCH v2 00/10] " Johannes Schindelin via GitGitGadget
2025-03-25 23:32   ` [PATCH v2 01/10] remote-curl: avoid using the comma operator unnecessarily Johannes Schindelin via GitGitGadget
2025-03-25 23:32   ` [PATCH v2 02/10] rebase: " Johannes Schindelin via GitGitGadget
2025-03-25 23:32   ` [PATCH v2 03/10] kwset: " Johannes Schindelin via GitGitGadget
2025-03-25 23:32   ` [PATCH v2 04/10] clar: " Johannes Schindelin via GitGitGadget
2025-03-26  5:54     ` Patrick Steinhardt
2025-03-26  7:03       ` Johannes Schindelin
2025-03-25 23:32   ` [PATCH v2 05/10] xdiff: " Johannes Schindelin via GitGitGadget
2025-03-25 23:32   ` [PATCH v2 06/10] diff-delta: explicitly mark intentional use of the comma operator Johannes Schindelin via GitGitGadget
2025-03-26  5:54     ` Patrick Steinhardt
2025-03-26  7:20       ` Johannes Schindelin
2025-03-26 10:17         ` Phillip Wood
2025-03-26 20:33           ` Taylor Blau
2025-03-27  1:31             ` Chris Torek
2025-03-25 23:32   ` [PATCH v2 07/10] wildmatch: " Johannes Schindelin via GitGitGadget
2025-03-26  5:54     ` Patrick Steinhardt
2025-03-26  7:46       ` Johannes Schindelin
2025-03-26  7:49     ` Junio C Hamano
2025-03-26 10:14     ` Phillip Wood
2025-03-26 10:34       ` Junio C Hamano
2025-03-25 23:32   ` [PATCH v2 08/10] compat/regex: " Johannes Schindelin via GitGitGadget
2025-03-26 20:35     ` Taylor Blau
2025-03-27 10:29       ` Johannes Schindelin
2025-03-27 21:51         ` Taylor Blau
2025-03-25 23:32   ` [PATCH v2 09/10] clang: warn when the comma operator is used Johannes Schindelin via GitGitGadget
2025-03-26  5:54     ` Patrick Steinhardt
2025-03-26  7:50       ` Johannes Schindelin
2025-03-26  8:33         ` Patrick Steinhardt
2025-03-27 10:18           ` Johannes Schindelin
2025-03-25 23:32   ` [PATCH v2 10/10] detect-compiler: detect clang even if it found CUDA Johannes Schindelin via GitGitGadget
2025-03-26 17:41     ` Jeff King
2025-03-26 18:07       ` Eric Sunshine
2025-03-27  5:14         ` Jeff King
2025-03-27  5:21           ` Eric Sunshine
2025-03-27  6:35             ` Jeff King
2025-03-26  5:54   ` [PATCH v2 00/10] Avoid the comma operator Patrick Steinhardt
2025-03-26 17:50   ` Jeff King
2025-03-27 11:52   ` [PATCH v3 " Johannes Schindelin via GitGitGadget
2025-03-27 11:52     ` [PATCH v3 01/10] remote-curl: avoid using the comma operator unnecessarily Johannes Schindelin via GitGitGadget
2025-03-27 11:52     ` [PATCH v3 02/10] rebase: " Johannes Schindelin via GitGitGadget
2025-03-27 11:52     ` [PATCH v3 03/10] kwset: " Johannes Schindelin via GitGitGadget
2025-03-27 11:52     ` [PATCH v3 04/10] clar: " Johannes Schindelin via GitGitGadget
2025-03-27 11:52     ` [PATCH v3 05/10] xdiff: " Johannes Schindelin via GitGitGadget
2025-03-27 11:52     ` [PATCH v3 06/10] diff-delta: avoid using the comma operator Johannes Schindelin via GitGitGadget
2025-03-27 11:53     ` [PATCH v3 07/10] wildmatch: avoid using of " Johannes Schindelin via GitGitGadget
2025-03-27 11:53     ` [PATCH v3 08/10] compat/regex: explicitly mark intentional use " Johannes Schindelin via GitGitGadget
2025-03-27 11:53     ` [PATCH v3 09/10] clang: warn when the comma operator is used Johannes Schindelin via GitGitGadget
2025-03-27 11:53     ` Johannes Schindelin via GitGitGadget [this message]
2025-03-27 15:07     ` [PATCH v3 00/10] Avoid the comma operator Phillip Wood
2025-03-29  0:39       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=77f1dcaca1c9df9e24880680311e5bb3eaeec1f8.1743076383.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=chris.torek@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=johannes.schindelin@gmx.de \
    --cc=karthik.188@gmail.com \
    --cc=me@ttaylorr.com \
    --cc=peff@peff.net \
    --cc=philipoakley@iee.email \
    --cc=phillip.wood123@gmail.com \
    --cc=ps@pks.im \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).