diff options
| author | Nick Brassel <nick@tzarc.org> | 2025-06-15 11:56:10 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-15 11:56:10 +1000 |
| commit | 7f9ceef3dd52066b6349130a93bfc681cd435d68 (patch) | |
| tree | 8ccd6bd67e222b2d3353dcb9ec5fb34a5d6f99cd /lib | |
| parent | 7ecdb574147fb67a89c46609161ca08891a103c0 (diff) | |
More compiledb fixes. (#25355)
Diffstat (limited to 'lib')
| -rwxr-xr-x | lib/python/qmk/compilation_database.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/python/qmk/compilation_database.py b/lib/python/qmk/compilation_database.py index c403297405..851dc3f157 100755 --- a/lib/python/qmk/compilation_database.py +++ b/lib/python/qmk/compilation_database.py | |||
| @@ -44,8 +44,7 @@ def cpu_defines(binary: str, compiler_args: str) -> List[str]: | |||
| 44 | invocation.extend(['-x', 'c', '-std=gnu11']) | 44 | invocation.extend(['-x', 'c', '-std=gnu11']) |
| 45 | elif binary.endswith("g++"): | 45 | elif binary.endswith("g++"): |
| 46 | invocation.extend(['-x', 'c++', '-std=gnu++14']) | 46 | invocation.extend(['-x', 'c++', '-std=gnu++14']) |
| 47 | compiler_args = shlex.split(compiler_args) | 47 | invocation.extend(shlex.split(compiler_args)) |
| 48 | invocation.extend(compiler_args) | ||
| 49 | invocation.append('-') | 48 | invocation.append('-') |
| 50 | result = cli.run(invocation, capture_output=True, check=True, stdin=None, input='\n') | 49 | result = cli.run(invocation, capture_output=True, check=True, stdin=None, input='\n') |
| 51 | define_args = [] | 50 | define_args = [] |
| @@ -55,7 +54,11 @@ def cpu_defines(binary: str, compiler_args: str) -> List[str]: | |||
| 55 | define_args.append(f'-D{line_args[1]}={line_args[2]}') | 54 | define_args.append(f'-D{line_args[1]}={line_args[2]}') |
| 56 | elif len(line_args) == 2 and line_args[0] == '#define': | 55 | elif len(line_args) == 2 and line_args[0] == '#define': |
| 57 | define_args.append(f'-D{line_args[1]}') | 56 | define_args.append(f'-D{line_args[1]}') |
| 58 | return list(sorted(set(define_args))) | 57 | |
| 58 | type_filter = re.compile( | ||
| 59 | r'^-D__(SIZE|INT|UINT|WINT|WCHAR|BYTE|SHRT|SIG|FLOAT|LONG|CHAR|SCHAR|DBL|FLT|LDBL|PTRDIFF|QQ|DQ|DA|HA|HQ|SA|SQ|TA|TQ|UDA|UDQ|UHA|UHQ|USQ|USA|UTQ|UTA|UQQ|UQA|ACCUM|FRACT|UACCUM|UFRACT|LACCUM|LFRACT|ULACCUM|ULFRACT|LLACCUM|LLFRACT|ULLACCUM|ULLFRACT|SACCUM|SFRACT|USACCUM|USFRACT)' | ||
| 60 | ) | ||
| 61 | return list(sorted(set(filter(lambda x: not type_filter.match(x), define_args)))) | ||
| 59 | return [] | 62 | return [] |
| 60 | 63 | ||
| 61 | 64 | ||
| @@ -92,8 +95,8 @@ def parse_make_n(f: Iterator[str]) -> List[Dict[str, str]]: | |||
| 92 | for s in system_libs(binary): | 95 | for s in system_libs(binary): |
| 93 | args += ['-isystem', '%s' % s] | 96 | args += ['-isystem', '%s' % s] |
| 94 | args.extend(cpu_defines(binary, ' '.join(shlex.quote(s) for s in compiler_args))) | 97 | args.extend(cpu_defines(binary, ' '.join(shlex.quote(s) for s in compiler_args))) |
| 95 | new_cmd = ' '.join(shlex.quote(s) for s in args) | 98 | args[0] = binary |
| 96 | records.append({"directory": str(QMK_FIRMWARE.resolve()), "command": new_cmd, "file": this_file}) | 99 | records.append({"arguments": args, "directory": str(QMK_FIRMWARE.resolve()), "file": this_file}) |
| 97 | state = 'start' | 100 | state = 'start' |
| 98 | 101 | ||
| 99 | return records | 102 | return records |
