GCC Middle and Back End API Reference
|
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "target.h"
#include "cpplib.h"
#include "prefix.h"
#include "intl.h"
#include "incpath.h"
#include "cppdefault.h"
Macros | |
#define | INO_T_EQ(A, B) |
#define | INO_T_COPY(DEST, SRC) |
#define | DIRS_EQ(A, B) |
#define | HOST_STAT_FOR_64BIT_INODES stat |
#define | TARGET_EXTRA_INCLUDES hook_void_charptr_charptr_int |
#define | TARGET_EXTRA_PRE_INCLUDES hook_void_charptr_charptr_int |
Enumerations | |
enum | { REASON_QUIET = 0 , REASON_NOENT , REASON_DUP , REASON_DUP_SYS } |
Functions | |
static void | add_env_var_paths (const char *, incpath_kind) |
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) |
void | split_quote_chain (void) |
void | add_cpp_dir_path (cpp_dir *p, incpath_kind chain) |
void | add_path (char *path, incpath_kind chain, int cxx_aware, bool user_supplied_p) |
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 (incpath_kind chain) |
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 [INC_MAX] |
static struct cpp_dir * | tails [INC_MAX] |
static bool | quote_ignores_source_dir |
struct target_c_incpath_s | target_c_incpath = { TARGET_EXTRA_PRE_INCLUDES, TARGET_EXTRA_INCLUDES } |
#define DIRS_EQ | ( | A, | |
B ) |
Referenced by remove_duplicates().
#define HOST_STAT_FOR_64BIT_INODES stat |
Referenced by remove_duplicates().
#define INO_T_COPY | ( | DEST, | |
SRC ) |
Referenced by remove_duplicates().
#define INO_T_EQ | ( | A, | |
B ) |
Set up combined include path chain for the preprocessor. Copyright (C) 1986-2024 Free Software Foundation, Inc. Broken out of cppinit.c and cppfiles.c and rewritten Mar 2003. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Microsoft Windows does not natively support inodes. VMS has non-numeric inodes.
#define TARGET_EXTRA_INCLUDES hook_void_charptr_charptr_int |
#define TARGET_EXTRA_PRE_INCLUDES hook_void_charptr_charptr_int |
void add_cpp_dir_path | ( | cpp_dir * | p, |
incpath_kind | chain ) |
|
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(), INC_SYSTEM, path, and PATH_SEPARATOR.
Referenced by register_include_chains().
void add_path | ( | char * | path, |
incpath_kind | chain, | ||
int | cxx_aware, | ||
bool | user_supplied_p ) |
Add PATH to the include chain CHAIN. PATH must be malloc-ed and NUL-terminated.
References add_cpp_dir_path(), end(), INC_AFTER, INC_SYSTEM, NULL, and path.
Referenced by add_env_var_paths(), and add_standard_paths().
|
static |
Append the standard include chain defined in cppdefault.cc.
References add_path(), default_include::add_sysroot, default_include::component, default_include::cplusplus, cpp_EXEC_PREFIX, cpp_GCC_INCLUDE_DIR, cpp_GCC_INCLUDE_DIR_len, cpp_include_defaults, cpp_PREFIX, cpp_PREFIX_len, cpp_relocated(), default_include::cxx_aware, DIR_SEPARATOR, dir_separator_str, default_include::fname, free(), gcc_exec_prefix, INC_SYSTEM, default_include::multilib, NULL, and update_path().
Referenced by register_include_chains().
|
static |
Add SYSROOT to any user-supplied paths in CHAIN starting with "=" or "$SYSROOT".
References heads, NULL, and startswith().
Referenced by merge_include_chains().
|
static |
Free an element of the include chain, possibly giving a reason.
References _, free(), REASON_DUP, REASON_DUP_SYS, REASON_NOENT, and REASON_QUIET.
Referenced by remove_duplicates(), and split_quote_chain().
struct cpp_dir * get_added_cpp_dirs | ( | incpath_kind | chain | ) |
Return the current chain of cpp dirs.
References heads.
|
static |
|
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(), heads, INC_AFTER, INC_BRACKET, INC_EMBED, INC_QUOTE, INC_SYSTEM, remove_duplicates(), tails, and verbose.
Referenced by register_include_chains().
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(), cpp_options, target_c_incpath_s::extra_includes, target_c_incpath_s::extra_pre_includes, heads, INC_BRACKET, INC_EMBED, INC_QUOTE, INC_SYSTEM, merge_include_chains(), quote_ignores_source_dir, target_c_incpath, and verbose.
|
static |
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, DIRS_EQ, errno, free_path(), HOST_STAT_FOR_64BIT_INODES, INO_T_COPY, NULL, REASON_DUP, REASON_DUP_SYS, REASON_NOENT, REASON_QUIET, S_ISDIR, and verbose.
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 free_path(), heads, INC_BRACKET, INC_QUOTE, NULL, quote_ignores_source_dir, REASON_QUIET, and tails.
|
static |
Referenced by add_standard_paths().
|
static |
Include chains heads and tails.
Referenced by add_cpp_dir_path(), add_sysroot_to_chain(), get_added_cpp_dirs(), merge_include_chains(), register_include_chains(), and split_quote_chain().
|
static |
Referenced by register_include_chains(), and split_quote_chain().
|
static |
Referenced by add_cpp_dir_path(), merge_include_chains(), and split_quote_chain().
struct target_c_incpath_s target_c_incpath = { TARGET_EXTRA_PRE_INCLUDES, TARGET_EXTRA_INCLUDES } |
Referenced by register_include_chains().