FreeBSD/contrib/gcc/cp/class.c
/* Warn about hidden virtual functions that are not overridden in t.
   We know that constructors and destructors don't apply.  */
Warn about hidden virtual functions that are not overridden in t.
We know that constructors and destructors don't apply.
Warn about hidden virtual functions that are not overridden in t . We know that constructors and destructors don ' t apply .
static void
warn_hidden (tree t)
{
  VEC(tree,gc) *method_vec = CLASSTYPE_METHOD_VEC (t);
  tree fns;
  size_t i;
  for (i = CLASSTYPE_FIRST_CONVERSION_SLOT;
       VEC_iterate (tree, method_vec, i, fns);
       ++i)
    {
      tree fn;
      tree name;
      tree fndecl;
      tree base_fndecls;
      tree base_binfo;
      tree binfo;
      int j;
      name = DECL_NAME (OVL_CURRENT (fns));
      base_fndecls = NULL_TREE;
      for (binfo = TYPE_BINFO (t), j = 0;
	   BINFO_BASE_ITERATE (binfo, j, base_binfo); j++)
	{
	  tree basetype = BINFO_TYPE (base_binfo);
	  base_fndecls = chainon (get_basefndecls (name, basetype),
				  base_fndecls);
	}
      if (!base_fndecls)
	continue;
      for (fn = fns; fn; fn = OVL_NEXT (fn))
	{
	  fndecl = OVL_CURRENT (fn);
	  if (DECL_VINDEX (fndecl))
	    {
	      tree *prev = &base_fndecls;
	      while (*prev)
		if (same_signature_p (fndecl, TREE_VALUE (*prev)))
		  *prev = TREE_CHAIN (*prev);
		else
		  prev = &TREE_CHAIN (*prev);
	    }
	}
      while (base_fndecls)
	{
	  warning (0, "%q+D was hidden", TREE_VALUE (base_fndecls));
	  warning (0, "  by %q+D", fns);
	  base_fndecls = TREE_CHAIN (base_fndecls);
	}
    }
}
static void warn_hidden ( tree t ) { VEC ( tree , gc ) * method_vec = CLASSTYPE_METHOD_VEC ( t ) ; tree fns ; size_t i ; for ( i = CLASSTYPE_FIRST_CONVERSION_SLOT ; VEC_iterate ( tree , method_vec , i , fns ) ; ++ i ) { tree fn ; tree name ; tree fndecl ; tree base_fndecls ; tree base_binfo ; tree binfo ; int j ; name = DECL_NAME ( OVL_CURRENT ( fns ) ) ; base_fndecls = NULL_TREE ; for ( binfo = TYPE_BINFO ( t ) , j = 0 ; BINFO_BASE_ITERATE ( binfo , j , base_binfo ) ; j ++ ) { tree basetype = BINFO_TYPE ( base_binfo ) ; base_fndecls = chainon ( get_basefndecls ( name , basetype ) , base_fndecls ) ; } if ( ! base_fndecls ) continue ; for ( fn = fns ; fn ; fn = OVL_NEXT ( fn ) ) { fndecl = OVL_CURRENT ( fn ) ; if ( DECL_VINDEX ( fndecl ) ) { tree * prev = & base_fndecls ; while ( * prev ) if ( same_signature_p ( fndecl , TREE_VALUE ( * prev ) ) ) * prev = TREE_CHAIN ( * prev ) ; else prev = & TREE_CHAIN ( * prev ) ; } } while ( base_fndecls ) { warning ( 0 , " " , TREE_VALUE ( base_fndecls ) ) ; warning ( 0 , " " , fns ) ; base_fndecls = TREE_CHAIN ( base_fndecls ) ; } } }
Warn about hidden virtual functions that are not overridden in t.
We know that constructors and destructors don't apply.
Warn about hidden virtual functions that are not overridden in t . We know that constructors and destructors don ' t apply .
/* We go through each separately named virtual function.  */ /* All functions in this slot in the CLASSTYPE_METHOD_VEC will
	 have the same name.  Figure out what name that is.  */ /* There are no possibly hidden functions yet.  */ /* Iterate through all of the base classes looking for possibly
	 hidden functions.  */ /* If there are no functions to hide, continue.  */ /* Remove any overridden functions.  */ /* If the method from the base class has the same
		   signature as the method from the derived class, it
		   has been overridden.  */ /* Now give a warning for all base functions without overriders,
	 as they are hidden.  */ /* Here we know it is a hider, and no overrider exists.  */