mirror of
https://github.com/Mbed-TLS/mbedtls-framework.git
synced 2026-09-04 01:09:55 +00:00
Log which files get parsed
Signed-off-by: Gilles Peskine <[email protected]>
This commit is contained in:
+11
-5
@@ -307,7 +307,7 @@ class CodeParser():
|
|||||||
exc_files.append(path)
|
exc_files.append(path)
|
||||||
else:
|
else:
|
||||||
inc_files.append(path)
|
inc_files.append(path)
|
||||||
return (inc_files, exc_files)
|
return (sorted(inc_files), sorted(exc_files))
|
||||||
|
|
||||||
def get_included_files(self, include_wildcards, exclude_wildcards):
|
def get_included_files(self, include_wildcards, exclude_wildcards):
|
||||||
"""
|
"""
|
||||||
@@ -327,8 +327,8 @@ class CodeParser():
|
|||||||
for include_wildcard in include_wildcards:
|
for include_wildcard in include_wildcards:
|
||||||
accumulator = accumulator.union(glob.iglob(include_wildcard))
|
accumulator = accumulator.union(glob.iglob(include_wildcard))
|
||||||
|
|
||||||
return list(path for path in accumulator
|
return sorted(path for path in accumulator
|
||||||
if not self.is_file_excluded(path, exclude_wildcards))
|
if not self.is_file_excluded(path, exclude_wildcards))
|
||||||
|
|
||||||
def parse_macros(self, include, exclude=None):
|
def parse_macros(self, include, exclude=None):
|
||||||
"""
|
"""
|
||||||
@@ -350,6 +350,7 @@ class CodeParser():
|
|||||||
|
|
||||||
macros = []
|
macros = []
|
||||||
for header_file in files:
|
for header_file in files:
|
||||||
|
self.log.debug("Parsing macros in " + header_file)
|
||||||
with open(header_file, "r", encoding="utf-8") as header:
|
with open(header_file, "r", encoding="utf-8") as header:
|
||||||
for line_no, line in enumerate(header):
|
for line_no, line in enumerate(header):
|
||||||
for macro in macro_regex.finditer(line):
|
for macro in macro_regex.finditer(line):
|
||||||
@@ -388,6 +389,7 @@ class CodeParser():
|
|||||||
|
|
||||||
mbed_psa_words = []
|
mbed_psa_words = []
|
||||||
for filename in files:
|
for filename in files:
|
||||||
|
self.log.debug("Parsing words in " + filename)
|
||||||
with open(filename, "r", encoding="utf-8") as fp:
|
with open(filename, "r", encoding="utf-8") as fp:
|
||||||
for line_no, line in enumerate(fp):
|
for line_no, line in enumerate(fp):
|
||||||
if exclusions.search(line):
|
if exclusions.search(line):
|
||||||
@@ -424,6 +426,7 @@ class CodeParser():
|
|||||||
enum_consts = []
|
enum_consts = []
|
||||||
for header_file in files:
|
for header_file in files:
|
||||||
state = states.OUTSIDE_KEYWORD
|
state = states.OUTSIDE_KEYWORD
|
||||||
|
self.log.debug("Parsing enums in " + header_file)
|
||||||
with open(header_file, "r", encoding="utf-8") as header:
|
with open(header_file, "r", encoding="utf-8") as header:
|
||||||
for line_no, line in enumerate(header):
|
for line_no, line in enumerate(header):
|
||||||
# Match typedefs and brackets only when they are at the
|
# Match typedefs and brackets only when they are at the
|
||||||
@@ -540,6 +543,7 @@ class CodeParser():
|
|||||||
Append found matches to the list ``identifiers``.
|
Append found matches to the list ``identifiers``.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
self.log.debug("Parsing identifier declarations in " + header_file)
|
||||||
with open(header_file, "r", encoding="utf-8") as header:
|
with open(header_file, "r", encoding="utf-8") as header:
|
||||||
in_block_comment = False
|
in_block_comment = False
|
||||||
# The previous line variable is used for concatenating lines
|
# The previous line variable is used for concatenating lines
|
||||||
@@ -615,11 +619,13 @@ class CodeParser():
|
|||||||
|
|
||||||
self.log.debug("Looking for included identifiers in {} files".format \
|
self.log.debug("Looking for included identifiers in {} files".format \
|
||||||
(len(included_files)))
|
(len(included_files)))
|
||||||
|
|
||||||
included_identifiers = []
|
included_identifiers = []
|
||||||
excluded_identifiers = []
|
|
||||||
for header_file in included_files:
|
for header_file in included_files:
|
||||||
self.parse_identifiers_in_file(header_file, included_identifiers)
|
self.parse_identifiers_in_file(header_file, included_identifiers)
|
||||||
|
|
||||||
|
self.log.debug("Looking for excluded identifiers in {} files".format \
|
||||||
|
(len(excluded_files)))
|
||||||
|
excluded_identifiers = []
|
||||||
for header_file in excluded_files:
|
for header_file in excluded_files:
|
||||||
self.parse_identifiers_in_file(header_file, excluded_identifiers)
|
self.parse_identifiers_in_file(header_file, excluded_identifiers)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user