mirror of
https://github.com/qca/qca-swiss-army-knife.git
synced 2025-12-10 07:44:42 +01:00
ath12k-check: ignore macro reuse warnings about for_each_ar()
Filter the warnings about the upcoming for_each_ar() macro's variable reuse. As the global tool apparently doesn't create symbol names for macro. Add a hack for those cases where we check if the actual line in the file contains the tag name. Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
This commit is contained in:
parent
e9a0327f3f
commit
583eed7e66
1 changed files with 25 additions and 8 deletions
|
|
@ -80,6 +80,9 @@ checkpatch_filter = [
|
|||
|
||||
# __ath12k_dbg has to use dev_printk() so that debug_mask always work
|
||||
('__ath12k_dbg', 'PREFER_DEV_LEVEL'),
|
||||
|
||||
# couldn't figure a way to avoid the reuse warning
|
||||
('for_each_ar', 'MACRO_ARG_REUSE'),
|
||||
]
|
||||
|
||||
sparse_filter = []
|
||||
|
|
@ -215,16 +218,30 @@ def parse_checkpatch_warning(line):
|
|||
|
||||
|
||||
def is_filtered(cpwarning):
|
||||
if cpwarning.tag is None:
|
||||
return False
|
||||
|
||||
for (tag, type) in checkpatch_filter:
|
||||
matchobj = re.match(tag, cpwarning.tag)
|
||||
if matchobj is None:
|
||||
continue
|
||||
if cpwarning.tag is not None:
|
||||
# the global tool was able to find a tag name for this
|
||||
# line so use it directly
|
||||
matchobj = re.match(tag, cpwarning.tag)
|
||||
if matchobj is None:
|
||||
continue
|
||||
|
||||
if cpwarning.type == type:
|
||||
return True
|
||||
if cpwarning.type == type:
|
||||
return True
|
||||
else:
|
||||
# the global tool was not able to find a tag name for this
|
||||
# line so instead check the actual line in the file
|
||||
f = open(cpwarning.path)
|
||||
buf = f.read()
|
||||
f.close()
|
||||
|
||||
lineno = int(cpwarning.lineno) - 1
|
||||
lines = buf.splitlines()
|
||||
line = lines[lineno]
|
||||
logger.debug('file %r tag %r line %r' % (cpwarning.path, tag, line))
|
||||
|
||||
if tag in line:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue