1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

dist/tools/compile_commands: Fix interoperability with localized GCC

GCC supports localized outputs, depending on the currently set locale.
This broke the compile-commands target, as the regexes only match the
English output. By invoking the compiler explicitly with the C locale,
it ensures the expected English language output.
This commit is contained in:
Jan Henke 2022-12-11 17:01:41 +01:00
parent 4ffa4112d4
commit 53c8ebc287
No known key found for this signature in database
GPG Key ID: 33A2274C83B3AA5A

View File

@ -27,9 +27,11 @@ def detect_includes_and_version_gcc(compiler):
:rtype: tuple
"""
try:
process_env = dict(os.environ)
process_env["LC_MESSAGES"] = "C"
with subprocess.Popen([compiler, "-v", "-E", "-"],
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE) as proc:
stderr=subprocess.PIPE, env=process_env) as proc:
inputdata = b"typedef int dont_be_pedantic;"
_, stderrdata = proc.communicate(input=inputdata)
except FileNotFoundError: