@@ -3611,6 +3611,9 @@ def analyse_ctu_info(self, ctu_info_files):
36113611
36123612 from cppcheckdata import Location
36133613
3614+ def is_different_location (loc1 , loc2 ):
3615+ return loc1 ['file' ] != loc2 ['file' ] or loc1 ['line' ] != loc2 ['line' ]
3616+
36143617 for filename in ctu_info_files :
36153618 for line in open (filename , 'rt' ):
36163619 if not line .startswith ('{' ):
@@ -3626,7 +3629,7 @@ def analyse_ctu_info(self, ctu_info_files):
36263629 for old_typedef_info in all_typedef_info :
36273630 if old_typedef_info ['name' ] == new_typedef_info ['name' ]:
36283631 found = True
3629- if old_typedef_info [ 'file' ] != new_typedef_info [ 'file' ] or old_typedef_info [ 'line' ] != new_typedef_info [ 'line' ] :
3632+ if is_different_location ( old_typedef_info , new_typedef_info ) :
36303633 self .reportError (Location (old_typedef_info ), 5 , 6 )
36313634 self .reportError (Location (new_typedef_info ), 5 , 6 )
36323635 else :
@@ -3642,7 +3645,7 @@ def analyse_ctu_info(self, ctu_info_files):
36423645 for old_tagname_info in all_tagname_info :
36433646 if old_tagname_info ['name' ] == new_tagname_info ['name' ]:
36443647 found = True
3645- if old_tagname_info [ 'file' ] != new_tagname_info [ 'file' ] or old_tagname_info [ 'line' ] != new_tagname_info [ 'line' ] :
3648+ if is_different_location ( old_tagname_info , new_tagname_info ) :
36463649 self .reportError (Location (old_tagname_info ), 5 , 7 )
36473650 self .reportError (Location (new_tagname_info ), 5 , 7 )
36483651 else :
@@ -3664,8 +3667,11 @@ def analyse_ctu_info(self, ctu_info_files):
36643667 if not found :
36653668 all_macro_info .append (new_macro )
36663669
3667- if summary_type == 'MisraGlobalIdentifiers ' :
3670+ if summary_type == 'MisraExternalIdentifiers ' :
36683671 for s in summary_data :
3672+ if s ['name' ] in all_external_identifiers and is_different_location (s , all_external_identifiers [s ['name' ]]):
3673+ self .reportError (Location (s ), 8 , 5 )
3674+ self .reportError (Location (all_external_identifiers [s ['name' ]]), 8 , 5 )
36693675 all_external_identifiers [s ['name' ]] = s
36703676
36713677 if summary_type == 'MisraInternalIdentifiers' :
0 commit comments