fix(hints): handle multiple missing headers in the output

The object files are compiled simultaneously, which can result in
several error messages about missing headers. The current regex used to
find missing headers in the compiler's output employs a greedy search,
potentially capturing multiple error messages from different compilation
units. This can cause bug reports where the original component cannot be
identified. Strengthen the regex to ensure it only processes the first
reported error.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
This commit is contained in:
Frantisek Hrbata 2024-09-24 14:21:37 +02:00 committed by BOT
parent 0564e9d488
commit 496e9cdff8

View File

@ -8,7 +8,7 @@ from idf_py_actions.tools import get_build_context
'''
glossary:
orignal_component: component which compilation failed
original_component: component which compilation failed
source_component: component containing file which is including the missing header file
candidate_component: component which contain the missing header file
original_filename: abs path of file(compilation unit) in original_component
@ -21,7 +21,7 @@ ENOENT_RE = re.compile(r'^(.+):\d+:\d+: fatal error: (.+): No such file or direc
flags=re.MULTILINE)
# Regex to find full preprocessor's error message to identify the original_filename
# in case the missing_header is reported in indirect include.
ENOENT_FULL_RE = re.compile(r'^(In file included.*No such file or directory)$',
ENOENT_FULL_RE = re.compile(r'^(In file included.*?No such file or directory)$',
flags=re.MULTILINE | re.DOTALL)
# Regex to find original_filename in preprocessor's error message
ORIGINAL_FILE_RE = re.compile(r'.*from (.*):[\d]+:')