@@ -4630,6 +4630,9 @@ def analyse_ctu_info(self, ctu_info_files):
46304630 def is_different_location (loc1 , loc2 ):
46314631 return loc1 ['file' ] != loc2 ['file' ] or loc1 ['line' ] != loc2 ['line' ]
46324632
4633+ def is_different_file (loc1 , loc2 ):
4634+ return loc1 ['file' ] != loc2 ['file' ]
4635+
46334636 try :
46344637 for filename in ctu_info_files :
46354638 for line in open (filename , 'rt' ):
@@ -4676,18 +4679,21 @@ def is_different_location(loc1, loc2):
46764679 all_macro_info [key ] = new_macro
46774680
46784681 if summary_type == 'MisraExternalIdentifiers' :
4679- for s in summary_data :
4682+ for s in sorted ( summary_data , key = lambda d : "%s %s %s" % ( d [ 'file' ], d [ 'line' ], d [ 'column' ] )) :
46804683 is_declaration = s ['decl' ]
46814684 if is_declaration :
46824685 all_external_identifiers = all_external_identifiers_decl
46834686 else :
46844687 all_external_identifiers = all_external_identifiers_def
46854688
46864689 name = s ['name' ]
4687- if name in all_external_identifiers and is_different_location (s , all_external_identifiers [name ]):
4688- num = 5 if is_declaration else 6
4689- self .reportError (Location (s ), 8 , num )
4690- self .reportError (Location (all_external_identifiers [name ]), 8 , num )
4690+ if name in all_external_identifiers :
4691+ if is_declaration and is_different_location (s , all_external_identifiers [name ]):
4692+ self .reportError (Location (s ), 8 , 5 )
4693+ self .reportError (Location (all_external_identifiers [name ]), 8 , 5 )
4694+ elif is_different_file (s , all_external_identifiers [name ]):
4695+ self .reportError (Location (s ), 8 , 6 )
4696+ self .reportError (Location (all_external_identifiers [name ]), 8 , 6 )
46914697 all_external_identifiers [name ] = s
46924698
46934699 if summary_type == 'MisraInternalIdentifiers' :
0 commit comments