Skip to content

Commit c4918fa

Browse files
authored
Merge pull request #162 from nosamad/topic/fix_assertion_with_zig_toolchain
Fix: assertion when using zig toolchain
2 parents 09fee2f + 097b179 commit c4918fa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

refresh.template.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ def _parse_headers_from_makefile_deps(d_file_content: str, source_path_for_sanit
161161
# We assume that this Makefile-like dependency file (`*.d`) contains exactly one `target: dependencies` rule.
162162
# There can be an optional space after the target, and long lists of dependencies (often) carry over with a backslash and newline.
163163
# For example, `d_file_content` might be: `"foo.o : foo.cc bar.h \\\n baz.hpp"`.
164-
target, dependencies = d_file_content.split(':', 1)
164+
target, dependencies = d_file_content.split(': ', 1) # Needs to handle absolute Windows paths, like C:\
165165
target = target.strip() # Remove the optional trailing space.
166-
assert target.endswith('.o'), "Something went wrong in makefile parsing to get headers. The target should be an object file. Output:\n" + d_file_content
166+
assert target.endswith(('.o', '.obj')), "Something went wrong in makefile parsing to get headers. The target should be an object file. Output:\n" + d_file_content
167167
# Undo shell-like line wrapping because the newlines aren't eaten by shlex.join. Note also that it's the line wrapping is inconsistently generated across compilers and depends on the lengths of the filenames, so you can't just split on the escaped newlines.
168168
dependencies = dependencies.replace('\\\n', '')
169169
# On Windows, swap out (single) backslash path directory separators for forward slash. Shlex otherwise eats the separators...and Windows gcc intermixes backslash separators with backslash escaped spaces. For a real example of gcc run from Windows, see https://github.com/hedronvision/bazel-compile-commands-extractor/issues/81

0 commit comments

Comments
 (0)