Re: [PATCH v2 10/10] detect-compiler: detect clang even if it found CUDA
- From
Jeff King <peff@peff.net>
- Date
- Mar 27, 2025, 06:35 UTC
- Message-ID
- <20250327063510.GC3042475@coredump.intra.peff.net>
- In-Reply-To
- <CAPig+cTmcPY9XDJcYc8s+O+a78x5vwBXV76tw7+S2wbOaMAMyA@mail.gmail.com>
On Thu, Mar 27, 2025 at 01:21:03AM -0400, Eric Sunshine wrote:
Show 8 quoted lines
> > I think just "/foo/p;q" works on GNU sed, but no idea if it does > > elsewhere. What you wrote seems the safest. > > That's not quite the same, though. The patternless `q` will cause > `sed` to terminate upon reading the first line of input, not upon the > first line which contains " version ". This matters, for instance, if > the first line output by `$CC -v` is not the version string (i.e. it > might be a copyright notice).
Oh, duh, you're right. I even tested to make sure were still quitting after matching, but of course that is because we were quitting even when _not_ matching.
For some reason I also thought /foo/pq would work, but it doesn't. I wonder if it used to under some implementations, or if I'm simply going senile.
(The point still remains that what you wrote is the correct thing).
-Peff