Skip to content

Commit

Permalink
Fix #13299: misra.py: use language attribute instead of file extensio…
Browse files Browse the repository at this point in the history
…n to determine language
  • Loading branch information
swasti16 committed Dec 5, 2024
1 parent 9989e18 commit baa5f95
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions addons/cppcheckdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -1218,6 +1218,7 @@ def __init__(self, filename):
"""
:param filename: Path to Cppcheck dump file
"""
self.language = None
self.filename = filename
self.rawTokens = []
self.platform = None
Expand All @@ -1234,6 +1235,8 @@ def __init__(self, filename):
for event, node in ElementTree.iterparse(self.filename, events=('start', 'end')):
if platform_done and rawtokens_done and suppressions_done:
break
if node.tag == 'dumps':
self.language = node.get('language')
if node.tag == 'platform' and event == 'start':
self.platform = Platform(node)
platform_done = True
Expand Down
2 changes: 1 addition & 1 deletion addons/misra.py
Original file line number Diff line number Diff line change
Expand Up @@ -4525,7 +4525,7 @@ def fillVerifyExpected(verify_expected, tok):
else:
self.printStatus('Checking ' + dumpfile + '...')

self.is_cpp = data.files and data.files[0].endswith('.cpp')
self.is_cpp = data.language == 'cpp'

for cfgNumber, cfg in enumerate(data.iterconfigurations()):
if not self.settings.quiet:
Expand Down

0 comments on commit baa5f95

Please sign in to comment.