@@ -4912,13 +4912,13 @@ def is_different_location(loc1, loc2):
49124912 def is_different_file (loc1 , loc2 ):
49134913 return loc1 ['file' ] != loc2 ['file' ]
49144914
4915- def add_declaration (all_info , new_info , num1 , num2 ):
4915+ def add_declaration (all_info , new_info , num1 = None , num2 = None ):
49164916 declarations = all_info .setdefault (new_info ['name' ], [])
49174917 for info in declarations :
49184918 if not is_different_location (info , new_info ):
49194919 info ['used' ] = info ['used' ] or new_info ['used' ]
49204920 return
4921- if declarations :
4921+ if declarations and num1 is not None :
49224922 self .reportError (Location (declarations [0 ]), num1 , num2 )
49234923 self .reportError (Location (new_info ), num1 , num2 )
49244924 declarations .append (new_info )
@@ -4946,12 +4946,7 @@ def read_lines(filename):
49464946
49474947 if summary_type == 'MisraMacro' :
49484948 for new_macro in summary_data :
4949- key = new_macro ['name' ]
4950- existing_macro = all_macro_info .get (key , None )
4951- if existing_macro :
4952- existing_macro ['used' ] = existing_macro ['used' ] or new_macro ['used' ]
4953- else :
4954- all_macro_info [key ] = new_macro
4949+ add_declaration (all_macro_info , new_macro )
49554950
49564951 if summary_type == 'MisraExternalIdentifiers' :
49574952 for s in sorted (summary_data , key = lambda d : "%s %s %s" % (d ['file' ],d ['line' ], d ['column' ] )):
@@ -5001,7 +4996,7 @@ def read_lines(filename):
50014996 for tag in unused_tags :
50024997 self .reportError (Location (tag ), 2 , 4 )
50034998
5004- unused_macros = [m for m in all_macro_info .values () if not m ['used' ]]
4999+ unused_macros = [m for ms in all_macro_info .values () for m in ms if not m ['used' ]]
50055000 for m in unused_macros :
50065001 self .reportError (Location (m ), 2 , 5 )
50075002
0 commit comments