Skip to content

Commit cdac7d4

Browse files
committed
Resolved an issue related to the inaccurate detection of the Clang compiler // Resolve platformio#4897
1 parent 591b377 commit cdac7d4

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

HISTORY.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ test-driven methodologies, and modern toolchains for unrivaled success.
2222
~~~~~~~~~~~~~~~~~~~
2323

2424
* Resolved an issue where the |LDF| couldn't locate a library dependency declared via version control system repository (`issue #4885 <https://github.com/platformio/platformio-core/issues/4885>`_)
25+
* Resolved an issue related to the inaccurate detection of the Clang compiler (`pull #4897 <https://github.com/platformio/platformio-core/pull/4897>`_)
2526

2627
6.1.14 (2024-03-21)
2728
~~~~~~~~~~~~~~~~~~~

platformio/builder/tools/piomisc.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,23 @@
2020

2121

2222
@util.memoized()
23-
def GetCompilerType(env):
24-
if env.subst("$CC").endswith("-gcc"):
23+
def GetCompilerType(env): # pylint: disable=too-many-return-statements
24+
CC = env.subst("$CC")
25+
if CC.endswith("-gcc"):
2526
return "gcc"
27+
if os.path.basename(CC) == "clang":
28+
return "clang"
2629
try:
30+
2731
sysenv = os.environ.copy()
2832
sysenv["PATH"] = str(env["ENV"]["PATH"])
29-
result = exec_command([env.subst("$CC"), "-v"], env=sysenv)
33+
result = exec_command([CC, "-v"], env=sysenv)
3034
except OSError:
3135
return None
3236
if result["returncode"] != 0:
3337
return None
3438
output = "".join([result["out"], result["err"]]).lower()
35-
if "clang" in output and "LLVM" in output:
39+
if "clang version" in output:
3640
return "clang"
3741
if "gcc" in output:
3842
return "gcc"

0 commit comments

Comments
 (0)