From baa5f9502e85dc1036b58d64810743c8a2ae1b3e Mon Sep 17 00:00:00 2001 From: swasti16 Date: Thu, 5 Dec 2024 21:24:50 +0530 Subject: [PATCH] Fix #13299: misra.py: use language attribute instead of file extension to determine language --- addons/cppcheckdata.py | 3 +++ addons/misra.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/cppcheckdata.py b/addons/cppcheckdata.py index 6f434d5e283e..1966a7c732cb 100755 --- a/addons/cppcheckdata.py +++ b/addons/cppcheckdata.py @@ -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 @@ -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 diff --git a/addons/misra.py b/addons/misra.py index 7a49279dab31..be84a92a29be 100755 --- a/addons/misra.py +++ b/addons/misra.py @@ -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: