GCC Middle and Back End API Reference
incpath.c File Reference

Enumerations

enum  { REASON_QUIET = 0, REASON_NOENT, REASON_DUP, REASON_DUP_SYS }

Functions

static void add_env_var_paths (const char *, int)
static void add_standard_paths (const char *, const char *, const char *, int)
static void free_path (struct cpp_dir *, int)
static void merge_include_chains (const char *, cpp_reader *, int)
static void add_sysroot_to_chain (const char *, int)
static struct cpp_dir * remove_duplicates (cpp_reader *, struct cpp_dir *, struct cpp_dir *, struct cpp_dir *, int)
static void free_path ()
static void add_env_var_paths ()
static void add_sysroot_to_chain ()
static void merge_include_chains ()
void split_quote_chain ()
void add_cpp_dir_path ()
void add_path ()
void register_include_chains (cpp_reader *pfile, const char *sysroot, const char *iprefix, const char *imultilib, int stdinc, int cxx_stdinc, int verbose)
struct cpp_dir * get_added_cpp_dirs ()
static void hook_void_charptr_charptr_int (const char *sysroot, const char *iprefix, int stdinc)

Variables

static const char dir_separator_str [] = { DIR_SEPARATOR, 0 }
static struct cpp_dir * heads [4]
static struct cpp_dir * tails [4]
static bool quote_ignores_source_dir
struct target_c_incpath_s target_c_incpath = { TARGET_EXTRA_PRE_INCLUDES, TARGET_EXTRA_INCLUDES }

Enumeration Type Documentation

anonymous enum
Enumerator:
REASON_QUIET 
REASON_NOENT 
REASON_DUP 
REASON_DUP_SYS 

Function Documentation

void add_cpp_dir_path ( )
Add P to the chain specified by CHAIN.   

References heads, and tails.

Referenced by add_path().

static void add_env_var_paths ( const char *  ,
int   
)
static

Referenced by register_include_chains().

static void add_env_var_paths ( )
static
Read ENV_VAR for a PATH_SEPARATOR-separated list of file names; and
   append all the names to the search path CHAIN.   

References add_path(), getenv(), memcpy(), path, and SYSTEM.

void add_path ( )
Add PATH to the include chain CHAIN. PATH must be malloc-ed and
   NUL-terminated.   

References add_cpp_dir_path(), AFTER, path, strlen(), and SYSTEM.

Referenced by add_env_var_paths(), and add_standard_paths().

static void add_standard_paths ( const char *  sysroot,
const char *  iprefix,
const char *  imultilib,
int  cxx_stdinc 
)
static
static void add_sysroot_to_chain ( const char *  ,
int   
)
static

Referenced by merge_include_chains().

static void add_sysroot_to_chain ( )
static
Add SYSROOT to any user-supplied paths in CHAIN starting with
   "=".   

References heads.

static void free_path ( struct cpp_dir *  ,
int   
)
static
static void free_path ( )
static
Free an element of the include chain, possibly giving a reason.   

References free(), REASON_DUP, REASON_DUP_SYS, REASON_NOENT, and REASON_QUIET.

struct cpp_dir* get_added_cpp_dirs ( )
read
Return the current chain of cpp dirs.   

References heads.

static void hook_void_charptr_charptr_int ( const char *  sysroot,
const char *  iprefix,
int  stdinc 
)
static
static void merge_include_chains ( const char *  ,
cpp_reader *  ,
int   
)
static

Referenced by register_include_chains().

static void merge_include_chains ( )
static
Merge the four include chains together in the order quote, bracket,
   system, after.  Remove duplicate dirs (determined in
   system-specific manner).

   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.   

References add_sysroot_to_chain(), AFTER, BRACKET, heads, QUOTE, remove_duplicates(), SYSTEM, and tails.

void register_include_chains ( cpp_reader *  pfile,
const char *  sysroot,
const char *  iprefix,
const char *  imultilib,
int  stdinc,
int  cxx_stdinc,
int  verbose 
)
Exported function to handle include chain merging, duplicate
   removal, and registration with cpplib.   

References add_env_var_paths(), add_standard_paths(), BRACKET, cpp_options, target_c_incpath_s::extra_includes, target_c_incpath_s::extra_pre_includes, heads, merge_include_chains(), QUOTE, quote_ignores_source_dir, SYSTEM, and target_c_incpath.

static struct cpp_dir * remove_duplicates ( cpp_reader *  pfile,
struct cpp_dir *  head,
struct cpp_dir *  system,
struct cpp_dir *  join,
int  verbose 
)
staticread
For each duplicate path in chain HEAD, keep just the first one.
   Remove each path in chain HEAD that also exists in chain SYSTEM.
   Set the NEXT pointer of the last path in the resulting chain to
   JOIN, unless it duplicates JOIN in which case the last path is
   removed.  Return the head of the resulting chain.  Any of HEAD,
   JOIN and SYSTEM can be NULL.   

References cpp_options, errno, free_path(), REASON_DUP, REASON_DUP_SYS, REASON_NOENT, and REASON_QUIET.

Referenced by merge_include_chains().

void split_quote_chain ( void  )
Use given -I paths for #include "..." but not #include <...>, and
   don't search the directory of the present file for #include "...".
   (Note that -I. -I- is not the same as the default setup; -I. uses
   the compiler's working dir.)   

References BRACKET, free_path(), heads, QUOTE, quote_ignores_source_dir, REASON_QUIET, and tails.


Variable Documentation

const char dir_separator_str[] = { DIR_SEPARATOR, 0 }
static

Referenced by add_standard_paths().

struct cpp_dir* heads[4]
static
bool quote_ignores_source_dir
static
struct cpp_dir* tails[4]
static
struct target_c_incpath_s target_c_incpath = { TARGET_EXTRA_PRE_INCLUDES, TARGET_EXTRA_INCLUDES }

Referenced by register_include_chains().