[PATCH] makefile: update detect-compiler for newer Xcode version

Subsystems: the rest

STALE1831d

5 messages, 4 authors, 2021-08-06 · open the first message on its own page

[PATCH] makefile: update detect-compiler for newer Xcode version

From: Carlo Marcelo Arenas Belón <hidden>
Date: 2021-08-06 08:06:59

1da1580e4c (Makefile: detect compiler and enable more warnings in
DEVELOPER=1, 2018-04-14) uses the output of the compiler banner to
detect the compiler family.

Apple had since changed the wording used to refer to its compiler
as clang instead of LLVM as shown by:

  $ cc --version
  Apple clang version 12.0.5 (clang-1205.0.22.9)
  Target: x86_64-apple-darwin20.6.0
  Thread model: posix
  InstalledDir: /Library/Developer/CommandLineTools/usr/bin

so update the script to match, and allow DEVELOPER=1 to work as
expected again in macOS.

Signed-off-by: Carlo Marcelo Arenas Belón <redacted>
---
 detect-compiler | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/detect-compiler b/detect-compiler
index 70b754481c..c85be83c64 100755
--- a/detect-compiler
+++ b/detect-compiler
@@ -44,7 +44,7 @@ clang)
 "FreeBSD clang")
 	print_flags clang
 	;;
-"Apple LLVM")
+"Apple LLVM"|"Apple clang")
 	print_flags clang
 	;;
 *)
-- 
2.33.0.rc0.443.g98cc19b6c0

Re: [PATCH] makefile: update detect-compiler for newer Xcode version

From: Bagas Sanjaya <hidden>
Date: 2021-08-06 12:00:47

On 06/08/21 15.06, Carlo Marcelo Arenas Belón wrote:
-"Apple LLVM")
+"Apple LLVM"|"Apple clang")
  	print_flags clang
Why not just s/Apple LLVM/Apple clang/?

-- 
An old man doll... just what I always wanted! - Clara

Re: [PATCH] makefile: update detect-compiler for newer Xcode version

From: Carlo Arenas <hidden>
Date: 2021-08-06 13:33:09

On Fri, Aug 6, 2021 at 5:00 AM Bagas Sanjaya [off-list ref] wrote:
Why not just s/Apple LLVM/Apple clang/?
because that would break it for older versions of Xcode that reported
themselves as "Apple LLVM" and I am not even sure when the change was
made to even consider those versions as obsolete.

Either way, I am sure once we figure out which versions are affected
and which versions macOS developers care enough for, that would be the
obvious next step.

note that DEVELOPER=1 was broken for a while in macOS and that also
affects CI, and it is still known to be suboptimal, since version
numbers for Xcode compilers are not always representative of what
features can be found in the opensource version with similar numbers.

Carlo

Carlo

Re: [PATCH] makefile: update detect-compiler for newer Xcode version

From: Atharva Raykar <hidden>
Date: 2021-08-06 13:42:51

Carlo Marcelo Arenas Belón [off-list ref] writes:
1da1580e4c (Makefile: detect compiler and enable more warnings in
DEVELOPER=1, 2018-04-14) uses the output of the compiler banner to
detect the compiler family.

Apple had since changed the wording used to refer to its compiler
as clang instead of LLVM as shown by:

  $ cc --version
  Apple clang version 12.0.5 (clang-1205.0.22.9)
  Target: x86_64-apple-darwin20.6.0
  Thread model: posix
  InstalledDir: /Library/Developer/CommandLineTools/usr/bin

so update the script to match, and allow DEVELOPER=1 to work as
expected again in macOS.
Thanks for submitting this enhancement!

For those of us using Homebrew and using the LLVM installation from
there, we get:

$ cc --version
Homebrew clang version 12.0.1
Target: arm64-apple-darwin20.5.0
Thread model: posix
InstalledDir: /opt/homebrew/opt/llvm/bin
quoted hunk
Signed-off-by: Carlo Marcelo Arenas Belón <redacted>
---
 detect-compiler | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/detect-compiler b/detect-compiler
index 70b754481c..c85be83c64 100755
--- a/detect-compiler
+++ b/detect-compiler
@@ -44,7 +44,7 @@ clang)
 "FreeBSD clang")
 	print_flags clang
 	;;
-"Apple LLVM")
+"Apple LLVM"|"Apple clang")
 	print_flags clang
 	;;
 *)
So maybe we could add another case for "Homebrew clang"?

---
Atharva Raykar
ಅಥರ್ವ ರಾಯ್ಕರ್
अथर्व रायकर

Re: [PATCH] makefile: update detect-compiler for newer Xcode version

From: Eric Sunshine <hidden>
Date: 2021-08-06 16:37:20

On Fri, Aug 6, 2021 at 9:33 AM Carlo Arenas [off-list ref] wrote:
On Fri, Aug 6, 2021 at 5:00 AM Bagas Sanjaya [off-list ref] wrote:
quoted
Why not just s/Apple LLVM/Apple clang/?
because that would break it for older versions of Xcode that reported
themselves as "Apple LLVM" and I am not even sure when the change was
made to even consider those versions as obsolete.

Either way, I am sure once we figure out which versions are affected
and which versions macOS developers care enough for, that would be the
obvious next step.
My daily development machine still reports "Apple LLVM", so it would
indeed be premature to `s/Apple LLVM/Apple clang/`. Moreover, there's
simply no good reason to `s/Apple LLVM/Apple clang/` since it's not a
maintenance burden to leave "Apple LLVM" in the match pattern.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help