Skip to content

Commit 33f13ad

Browse files
peffgitster
authored andcommitted
build: clang version may not be followed by extra words
The get_family and get_version helpers of detect-compiler assume that the line to identify the version from the compilers have a token "version", followed by the version number, followed by some other string, e.g. $ CC=gcc get_version_line gcc version 10.2.1 2021011 (Debian 10.2.1-6) But that is not necessarily true, e.g. $ CC=clang get_version_line Debian clang version 11.0.1-2 Tweak the script not to require extra string after the version. Signed-off-by: Junio C Hamano <[email protected]>
1 parent f6bb209 commit 33f13ad

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

detect-compiler

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ get_version_line() {
1313
}
1414

1515
get_family() {
16-
get_version_line | sed 's/^\(.*\) version [0-9][^ ]* .*/\1/'
16+
get_version_line | sed 's/^\(.*\) version [0-9].*/\1/'
1717
}
1818

1919
get_version() {
20-
get_version_line | sed 's/^.* version \([0-9][^ ]*\) .*/\1/'
20+
get_version_line | sed 's/^.* version \([0-9][^ ]*\).*/\1/'
2121
}
2222

2323
print_flags() {

0 commit comments

Comments
 (0)