Specify language standard when generating compilation database. (#25354)

This commit is contained in:
Nick Brassel 2025-06-11 14:29:37 +10:00 committed by GitHub
parent 802a199bbd
commit 0516cf5ed8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -41,9 +41,9 @@ def cpu_defines(binary: str, compiler_args: str) -> List[str]:
if binary.endswith("gcc") or binary.endswith("g++"):
invocation = [binary, '-dM', '-E']
if binary.endswith("gcc"):
invocation.extend(['-x', 'c'])
invocation.extend(['-x', 'c', '-std=gnu11'])
elif binary.endswith("g++"):
invocation.extend(['-x', 'c++'])
invocation.extend(['-x', 'c++', '-std=gnu++14'])
compiler_args = shlex.split(compiler_args)
invocation.extend(compiler_args)
invocation.append('-')