FreeBSD/contrib/gcc/c-incpath.c
/* Merge the four include chains together in the order quote, bracket,
   system, after.  Remove duplicate dirs (as determined by
   INO_T_EQ()).

   We can't just merge the lists and then uniquify them because then
   we may lose directories from the <> search path that should be
   there; consider -iquote foo -iquote bar -Ifoo -Iquux.  It is
   however safe to treat -iquote bar -iquote foo -Ifoo -Iquux as if
   written -iquote bar -Ifoo -Iquux.  */
Merge the four include chains together in the order quote, bracket,
system, after.  Remove duplicate dirs (as determined by
INO_T_EQ()).

We can't just merge the lists and then uniquify them because then
we may lose directories from the <> search path that should be
there; consider -iquote foo -iquote bar -Ifoo -Iquux.
Merge the four include chains together in the order quote bracket system after . Remove duplicate dirs ( as determined by INO_T_EQ () ) . We can ' t just merge the lists and then uniquify them because then we may lose directories from the < > search path that should be there ; consider - iquote foo - iquote bar - Ifoo - Iquux .
static void
merge_include_chains (cpp_reader *pfile, int verbose)
{
  if (heads[SYSTEM])
    tails[SYSTEM]->next = heads[AFTER];
  else
    heads[SYSTEM] = heads[AFTER];
  heads[SYSTEM] = remove_duplicates (pfile, heads[SYSTEM], 0, 0, verbose);
  heads[BRACKET] = remove_duplicates (pfile, heads[BRACKET], heads[SYSTEM],
				      heads[SYSTEM], verbose);
  heads[QUOTE] = remove_duplicates (pfile, heads[QUOTE], heads[SYSTEM],
				    heads[BRACKET], verbose);
  if (verbose)
    {
      struct cpp_dir *p;
      fprintf (stderr, "%s", _("#include \"...\" search starts here:\n"));
      for (p = heads[QUOTE];; p = p->next)
	{
	  if (p == heads[BRACKET])
	    fprintf (stderr, "%s", _("#include <...> search starts here:\n"));
	  if (!p)
	    break;
	  fprintf (stderr, " %s\n", p->name);
	}
      fprintf (stderr, "%s", _("End of search list.\n"));
    }
}
static void merge_include_chains ( cpp_reader * pfile , int verbose ) { if ( heads [ SYSTEM ] ) tails [ SYSTEM ] -> next = heads [ AFTER ] ; else heads [ SYSTEM ] = heads [ AFTER ] ; heads [ SYSTEM ] = remove_duplicates ( pfile , heads [ SYSTEM ] , 0 , 0 , verbose ) ; heads [ BRACKET ] = remove_duplicates ( pfile , heads [ BRACKET ] , heads [ SYSTEM ] , heads [ SYSTEM ] , verbose ) ; heads [ QUOTE ] = remove_duplicates ( pfile , heads [ QUOTE ] , heads [ SYSTEM ] , heads [ BRACKET ] , verbose ) ; if ( verbose ) { struct cpp_dir * p ; fprintf ( stderr , " " , _ ( " \" \" \n " ) ) ; for ( p = heads [ QUOTE ] ; ; p = p -> next ) { if ( p == heads [ BRACKET ] ) fprintf ( stderr , " " , _ ( " \n " ) ) ; if ( ! p ) break ; fprintf ( stderr , " \n " , p -> name ) ; } fprintf ( stderr , " " , _ ( " \n " ) ) ; } }
Merge the four include chains together in the order quote, bracket,
system, after.
Merge the four include chains together in the order quote bracket system after .
/* Join the SYSTEM and AFTER chains.  Remove duplicates in the
     resulting SYSTEM chain.  */ /* Remove duplicates from BRACKET that are in itself or SYSTEM, and
     join it to SYSTEM.  */ /* Remove duplicates from QUOTE that are in itself or SYSTEM, and
     join it to BRACKET.  */ /* If verbose, print the list of dirs to search.  */