if_diff/src/idfReport.cxx
//============================================================================
// Report mismatches in attributes for the given symbols.
// Return true if any mismatches found.
//============================================================================
Report mismatches in attributes for the given symbols.
Return true if any mismatches found.
Report mismatches in attributes for the given symbols . Return true if any mismatches found .
static boolean report_attributes(idfAttributeDictionary &attr1,
      	      	      	      	 idfAttributeDictionary &attr2,
      	      	      	         const char *sym_id1, const char *sym_id2,
      	      	      	      	 boolean (*filter)(void *, const char *),
      	      	      	      	 void *filter_object)
{
  boolean discrepancy = false;
  idfStringSet *ssp = idf_configuration.lookup("Attribute differs().");
  for (idfIterator iter = attr1.first(); !attr1.done(iter); attr1.next(iter)) {
    const char *attribute = attr1.index(iter);
    const char *value1 = attr1.lookup(iter);
    const char *value2 = attr2.lookup(attribute);
    if (   !idf_strmatch(value1, value2)
        && !(ssp != NULL && ssp->lookup(attribute))
        && !(filter != NULL && filter(filter_object, attribute))) {
      boolean ignore = false;
      genString s;
      if (!attr2.contains(attribute)) {
        s.printf("%s has \"%s\" attribute, but correspondingly %s does not.",
                 sym_id1, attribute, sym_id2);
        if (   idf_configuration.contains("Watch out for inlinestatic attribute.")
            && (   (   idf_strmatch(attribute, "inlinestatic") 
                    && attr2.contains("inline")) 
                || (   (idf_strmatch(attribute, "inline") || idf_strmatch(attribute, "static"))
                    && attr2.contains("inlinestatic")))) {
          ignore = true;
        }
      }
      else {
        s.printf("%s has \"%s\" attribute value \"%s\","
                 " but correspondingly %s has value \"%s\".",
                 sym_id1, attribute, nonnull(value1, "<default value>"),
                 sym_id2, nonnull(value2, "<default value>"));
      }
      if (!ignore) {
        idf_report(s, difference_note);
      }
      discrepancy = true;
    }
  }
  for (idfIterator iter2 = attr2.first(); !attr2.done(iter2); attr2.next(iter2)) {
    const char *attribute = attr2.index(iter2);
    const char *value1 = attr1.lookup(attribute);
    if (   value1 == NULL
        && !(ssp != NULL && ssp->lookup(attribute))
        && !(filter != NULL && filter(filter_object, attribute))) {
      boolean ignore = false;
      genString s;
      s.printf("%s has \"%s\" attribute, but correspondingly %s does not.",
               sym_id2, attribute, sym_id1);
      if (   idf_configuration.contains("Watch out for inlinestatic attribute.")
          && (   (   idf_strmatch(attribute, "inlinestatic") 
                  && attr1.contains("inline")) 
              || (   (idf_strmatch(attribute, "inline") || idf_strmatch(attribute, "static"))
                  && attr1.contains("inlinestatic")))) {
        ignore = true;
      }
      if (!ignore) {
        idf_report(s, difference_note);
      }
      discrepancy = true;
    }
  }
  return discrepancy;
}
static boolean report_attributes ( idfAttributeDictionary & attr1 , idfAttributeDictionary & attr2 , const char * sym_id1 , const char * sym_id2 , boolean ( * filter ) ( void * , const char * ) , void * filter_object ) { boolean discrepancy = false ; idfStringSet * ssp = idf_configuration . lookup ( " " ) ; for ( idfIterator iter = attr1 . first ( ) ; ! attr1 . done ( iter ) ; attr1 . next ( iter ) ) { const char * attribute = attr1 . index ( iter ) ; const char * value1 = attr1 . lookup ( iter ) ; const char * value2 = attr2 . lookup ( attribute ) ; if ( ! idf_strmatch ( value1 , value2 ) && ! ( ssp != NULL && ssp -> lookup ( attribute ) ) && ! ( filter != NULL && filter ( filter_object , attribute ) ) ) { boolean ignore = false ; genString s ; if ( ! attr2 . contains ( attribute ) ) { s . printf ( " \" \" " , sym_id1 , attribute , sym_id2 ) ; if ( idf_configuration . contains ( " " ) && ( ( idf_strmatch ( attribute , " " ) && attr2 . contains ( " " ) ) || ( ( idf_strmatch ( attribute , " " ) || idf_strmatch ( attribute , " " ) ) && attr2 . contains ( " " ) ) ) ) { ignore = true ; } } else { s . printf ( " \" \" \" \" " " \" \" " , sym_id1 , attribute , nonnull ( value1 , " " ) , sym_id2 , nonnull ( value2 , " " ) ) ; } if ( ! ignore ) { idf_report ( s , difference_note ) ; } discrepancy = true ; } } for ( idfIterator iter2 = attr2 . first ( ) ; ! attr2 . done ( iter2 ) ; attr2 . next ( iter2 ) ) { const char * attribute = attr2 . index ( iter2 ) ; const char * value1 = attr1 . lookup ( attribute ) ; if ( value1 == NULL && ! ( ssp != NULL && ssp -> lookup ( attribute ) ) && ! ( filter != NULL && filter ( filter_object , attribute ) ) ) { boolean ignore = false ; genString s ; s . printf ( " \" \" " , sym_id2 , attribute , sym_id1 ) ; if ( idf_configuration . contains ( " " ) && ( ( idf_strmatch ( attribute , " " ) && attr1 . contains ( " " ) ) || ( ( idf_strmatch ( attribute , " " ) || idf_strmatch ( attribute , " " ) ) && attr1 . contains ( " " ) ) ) ) { ignore = true ; } if ( ! ignore ) { idf_report ( s , difference_note ) ; } discrepancy = true ; } } return discrepancy ; }
Report mismatches in attributes for the given symbols.
Report mismatches in attributes for the given symbols .
// Either 1 had inlinestatic and 2 had inline, or 1 had inline or static and 2 had // inlinestatic;  either way, this is OK. // Now look for attributes missing from attr1. // Either 1 had inlinestatic and 2 had inline, or 1 had inline or static and 2 had // inlinestatic;  either way, this is OK.