Skip to content

Commit

Permalink
Improve warning message for missing includes
Browse files Browse the repository at this point in the history
- Clarify that the warning pertains to a missing include.
- Differentiate between user and system includes.
- Show the line of code that triggered the warning.

Signed-off-by: John Pennycook <[email protected]>
  • Loading branch information
Pennycook committed Sep 19, 2024
1 parent e82298a commit 1108d6c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion codebasin/preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,12 @@ def evaluate_for_platform(self, **kwargs):
if not include_file:
filename = kwargs["filename"]
line = self.start_line
log.warning(f"{filename}:{line}: '{include_path}' not found")
spelling = self.spelling()[0]
kind = "system include" if is_system_include else "user include"
log.warning(
f"{filename}:{line}: {kind} '{include_path}' not found\n"
+ f"{line:>5} | {spelling}",
)


class IfNode(DirectiveNode):
Expand Down

0 comments on commit 1108d6c

Please sign in to comment.