From 1108d6c6a35f161bad06fd8f07658c3e5c120879 Mon Sep 17 00:00:00 2001 From: John Pennycook Date: Thu, 19 Sep 2024 14:57:00 +0100 Subject: [PATCH] Improve warning message for missing includes - 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 --- codebasin/preprocessor.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/codebasin/preprocessor.py b/codebasin/preprocessor.py index 5a5e43d..0a37ca2 100644 --- a/codebasin/preprocessor.py +++ b/codebasin/preprocessor.py @@ -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):